Django EDS authentication package
Project description
django-eds-auth
A secure Django authentication backend for EDS (Electronic Digital Signature) based authentication. Uses X.509 certificates and nonce-based challenge-response for cryptographically secure authentication.
Overview
django-eds-auth is a Django authentication backend that implements EDS (Electronic Digital Signature) based login using X.509 certificates. It provides:
- ✅ Challenge-response authentication with single-use nonces
- ✅ RSA, ECDSA, and DSA signature verification support
- ✅ X.509 certificate chain validation
- ✅ Replay attack prevention
- ✅ Comprehensive audit logging
- ✅ No private keys stored on server
Project Structure
src/django_eds_auth/- Main package codeexample_project/- Example Django project for testingtests/- Unit and integration testsdocs/- Documentation and guides
Quick Start
Installation
# Install the package with development dependencies
pip install -e ".[dev]"
# Or install using pip directly
pip install django-eds-auth
Configuration
- Add to
INSTALLED_APPSin Django settings:
INSTALLED_APPS = [
# ...
'django_eds_auth',
]
- Add authentication backend:
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'django_eds_auth.backends.EDSAuthBackend',
]
- Configure certificate paths (example):
EDS_AUTH_SERVER_CERT_PATH = os.getenv('EDS_AUTH_SERVER_CERT_PATH', '/path/to/cert.pem')
EDS_AUTH_SERVER_KEY_PATH = os.getenv('EDS_AUTH_SERVER_KEY_PATH', '/path/to/key.pem')
EDS_AUTH_TRUSTED_CA_CERTS_PATH = os.getenv('EDS_AUTH_TRUSTED_CA_CERTS_PATH', '')
- Run migrations:
python manage.py migrate
- Start the development server:
cd example_project
python manage.py runserver
Docker Integration
The project includes Dockerfile and docker-compose.yml for local development with PostgreSQL.
1) Prepare environment variables
cp .env.example .env
Update .env if needed (database credentials, Django settings, etc.).
2) Build and start containers
docker compose up --build
This starts:
db- PostgreSQL 16web- Django app onhttp://localhost:8000
3) Run migrations inside container
In a second terminal:
docker compose exec web python example_project/manage.py migrate
4) Optional: create superuser
docker compose exec web python example_project/manage.py createsuperuser
5) Stop containers
docker compose down
To remove volumes too:
docker compose down -v
Testing
Running the full test suite:
# Run all tests with verbose output
pytest tests/ -v
# Run with coverage report
pytest tests/ --cov=django_eds_auth --cov-report=term-missing
# Run only security tests
pytest tests/test_security_and_coverage.py -v
# Run with timing information
pytest tests/ -v --durations=10
Current test results: 75 tests PASSED ✅
Documentation
- COVERAGE_REPORT.md - Detailed test coverage analysis
- VERIFICATION.md - Requirement verification and compliance
- IMPLEMENTATION_GUIDE.md - Detailed implementation guide
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_eds_auth-0.2.2.tar.gz.
File metadata
- Download URL: django_eds_auth-0.2.2.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Linux/6.19.8-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
965b477c34d91b2c0149e85d3a54bc33844b1af03f6c266fb01c6afe01db6d07
|
|
| MD5 |
2b3926d6ae77c75abcd99696bef082a7
|
|
| BLAKE2b-256 |
c58b8408e1deb1884d554915e4f7c59b932037329d50bb1cbbfea0fad9078011
|
File details
Details for the file django_eds_auth-0.2.2-py3-none-any.whl.
File metadata
- Download URL: django_eds_auth-0.2.2-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.14.3 Linux/6.19.8-arch1-1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3538c8181a2ff69c7ead9a4dc52cd4746d402e10ab85494ce827309c386c4c31
|
|
| MD5 |
e0be54396bfa6b9f6ba3e2e662b11b08
|
|
| BLAKE2b-256 |
79f6cb20c9b333279f4f4f578923050ed8a6c49988b03590ef5e9bbf543a58f5
|