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.2.tar.gz (49.3 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.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_helseid-1.0.2.tar.gz
  • Upload date:
  • Size: 49.3 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.2.tar.gz
Algorithm Hash digest
SHA256 1c83eb0ffdfac413f29531d2e0a76a7fb5656923382a367a7a3cbb105d688213
MD5 f48e14530afb472abd11d97bb98dd9eb
BLAKE2b-256 5cb740f9c04b7284fb12c4f5f2d62c9cfcf574adcf820a676773c0bc4e14b661

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_helseid-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: django_helseid-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22b5536a6caa467133fcbbbcd07a4fe5d9b137fbf6f84e3b9d0696370f13488e
MD5 f51aa06c3138969f80911dab72a0524d
BLAKE2b-256 f411571bada067c46e9156f30712dae804800db42125158de9e50472809dd2fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_helseid-1.0.2-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