Skip to main content

A Django app for HelseID authentication.

Project description

django-helseid

CI

Django application for authenticating users with HelseID

Installation

⚠️ WARNING: This project is currently under development and is NOT production-ready. It is intended for demonstration and testing purposes only. Do not use in a production environment without thorough security review and further development. ⚠️

Requirements: Python 3.12+, Django 6.0+

  1. Install the package:

    pip install django-helseid
    

    Or locally for development:

    uv pip install -e .
    
  2. Add helseid to your INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        ...
        'helseid',
    ]
    
  3. Add the authentication backend:

    AUTHENTICATION_BACKENDS = [
        'django.contrib.auth.backends.ModelBackend',
        'helseid.backends.HelseIDBackend',
    ]
    
  4. Configure HELSEID settings:

    HELSEID = {
        'CLIENT_ID': 'your-client-id',
        'CLIENT_SECRET': { ... },  # JWK dict (private key)
        'SCOPE': ['openid', 'profile', ...],
        'ENVIRONMENT': 'production',  # 'test' or 'production'
    }
    

    ENVIRONMENT sets the HelseID server URL and JWT audience automatically:

    • 'test'https://helseid-sts.test.nhn.no
    • 'production'https://helseid-sts.nhn.no

    For non-standard deployments you can override the URL explicitly instead:

    HELSEID = {
        ...
        'SERVER_METADATA_URL': 'https://helseid-sts.nhn.no/.well-known/openid-configuration',
    }
    
  5. Include the URL configuration in your urls.py:

    from django.urls import path, include
    
    urlpatterns = [
        ...
        path('', include('helseid.urls')),
    ]
    

    This registers the following routes:

    • GET /login/ — initiates the HelseID authentication flow
    • GET /authorize/ — handles the OAuth2 callback
    • GET /logout/ — clears the local session

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_helseid-1.0.3.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_helseid-1.0.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file django_helseid-1.0.3.tar.gz.

File metadata

  • Download URL: django_helseid-1.0.3.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_helseid-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c54cb6b38f0a6a8f3d51903fe392d5b5c8e42c738b9c2b24e73319fbcddcbe36
MD5 110aa56a5064db2444e52bff23b0dea6
BLAKE2b-256 cdb819b43174834e4460325e44309598e52f6312ca2e1f396b8402f7abdf81f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_helseid-1.0.3.tar.gz:

Publisher: publish.yml on haakontk/django-helseid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_helseid-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: django_helseid-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_helseid-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c38e7f98692e3bbcdcd0953249a44f78b07536ead5591f9fe340e38310547839
MD5 51ff16df97a5d5e2bf7f643bed28134c
BLAKE2b-256 19c215ca34464efeff155b489f1eb0a58e3341d669134327085485ca87482eb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_helseid-1.0.3-py3-none-any.whl:

Publisher: publish.yml on haakontk/django-helseid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page