Skip to main content

django-esteid

pypi Status CI Coverage Status

Django-esteid is a package that provides Esteid based authentication and signing for your Django applications.

Quickstart

Install django-esteid:

pip install django-esteid

Add esteid to installed apps:

INSTALLED_APPS = [
    # ...
    'esteid',
    # ...
]

Please refer to the more detailed guides on signing and authentication.

Be sure to read the testing section below.

Static files such as the services' logos and helper JS are also shipped with this library.

SmartID

Detailed docs are here.

MobileID

Detailed docs are here.

ID Card

Detailed docs are here.

Service settings

You can

Context processors

esteid.context_processors.esteid_services adds service enabled/demo statuses to the template context. This way you can easily manage the necessary services displayed on the auth/signing page.

Testing

For a guide to authentication testing, please refer to the authentication readme.

There is a possibility to test the signing flow with ID card, SmartID and Mobile ID (the demo services) with the test views coming with the library.

NOTE: you may not be able to use the live Esteid services even with live credentials. The live services keep an IP address whitelist which only contains IP addresses as specified in customer's contract.

To run the django-esteid test server with the test views,

  • install the virtual environment if not installed yet,
  • run ./manage.py migrate to create the SQLite DB for sessions,
  • run ./manage.py runserver 8765, where 8765 is a port of your liking

then visit the URL http://localhost:8765/ and follow the instructions on that page.

Mobile ID

To test Mobile ID signing, you will need test phone numbers and ID codes.

You can not use real phone numbers or ID codes with the demo service.

SmartID

To test signing with SmartID, yoy can use the test ID codes.

You can also register a demo SmartID account and use a demo SmartID app to enter the PINs; please visit the demo SmartID portal for the details.

ID card

ID card signing requires SSL to work, even in a testing environment.
Note that the signature will not be valid neither with the real certificates, nor with the test ones.

To perform signing with ID card, you would need the chrome-token-signing browser plugin installed. apt-get install chrome-token-signing

Testing with ssl

You can run an HTTPS webserver with ./manage.py runsslserver 127.0.0.1:8765. It will use a development certificate coming with the djangosslserver package.

Note that the cert is self-signed, so you will need to create a security exception in browser.

If you need to create your own cert using openssl:

openssl req -x509 -out localhost.crt -keyout localhost.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name=dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Then start the HTTPS webserver as follows:

python manage.py runsslserver 127.0.0.1:8765 --certificate localhost.crt --key localhost.key

A security exception is also necessary as marked above.

ngrok

If you don't want to use a self-signed cert you can route the test site through HTTPS with ngrok.

With ngrok installed, and the ./manage.py runserver 8765 started, run ngrok http http://127.0.0.1:8765 and it will create a tunnel with an HTTPS URL for your local site.

Verify demo containers with digidoc-tool

It's possible to use the command line utility digidoc-tool from the libdigidocpp library to verify containers with signatures created by demo services:

digidoc-tool open --tslurl=https://open-eid.github.io/test-TL/tl-mp-test-EE.xml --tslcert=trusted-test-tsl.crt <file>

Instructions on setting up the environment can be found here.

Metadata

Release files for django-esteid 4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-esteid 4.2
File Size Uploaded Provenance
django_esteid-4.2.tar.gz 94.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-esteid 4.2
File Interpreter ABI Platform
django_esteid-4.2-py3-none-any.whl Python 3 none any Details

Total release size: 221.9 kB

Release files / django_esteid-4.2.tar.gz

Download URL django_esteid-4.2.tar.gz
Size 94.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d9e3667533f038ea85638b985aa109c7bdc9cfffafd6e1e8b519f74e54b0b825
BLAKE2b-256 checksum
How to use checksums
5ef9c5e3a23e76aface5c6fe2f30c77c9b5f007617c6be98ef073509cd7030e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.11 Linux/6.5.0-1025-azure

Release files / django_esteid-4.2-py3-none-any.whl

Download URL django_esteid-4.2-py3-none-any.whl
Size 127.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c239afd42269ff2b0771af9658c6a6bd6e7eb6aad6c0bc8df49e1f40d9e6c5a7
BLAKE2b-256 checksum
How to use checksums
e174a1bddc0e5b5eed438995b2b925ab4c154d3788251be424d753d31b73ecbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.11.11 Linux/6.5.0-1025-azure

Security for django-esteid 4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.2 This release

2 release files No provenance

3.1

1.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page