Skip to main content

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 code
  • example_project/ - Example Django project for testing
  • tests/ - Unit and integration tests (56 tests total)
  • docs/ - 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

  1. Add to INSTALLED_APPS in Django settings:
INSTALLED_APPS = [
    # ...
    'django_eds_auth',
]
  1. Add authentication backend:
AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'django_eds_auth.backends.EDSAuthBackend',
]
  1. 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', '')
  1. Run migrations:
python manage.py migrate
  1. 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 16
  • web - Django app on http://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: 56 tests PASSED

  • Coverage: 60% (improved from 46%)
  • Security module (signature_verification.py): 85% (critical coverage)

Documentation

License

MIT License

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_eds_auth-0.2.0.tar.gz (16.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_eds_auth-0.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file django_eds_auth-0.2.0.tar.gz.

File metadata

  • Download URL: django_eds_auth-0.2.0.tar.gz
  • Upload date:
  • Size: 16.4 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

Hashes for django_eds_auth-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b6c9f0eba2d50f1b0dcf0bd371b686583856a07fc6d6e1bb331c9caf2d45fdb3
MD5 eb0a299d76f3289f1bafe2ece8ac3a61
BLAKE2b-256 368e9cc04d04081b4e85c40414de57a52d52617bbe9347b7eed141839d2cb501

See more details on using hashes here.

File details

Details for the file django_eds_auth-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_eds_auth-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 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

Hashes for django_eds_auth-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc98ecb5c4aa42f7102f79488d237f8f4eddd4ff99dc2ac91439b55dc350917a
MD5 cd85846f51047a0680656fec5e4494c2
BLAKE2b-256 2e1e70e0621705b076f8910e88b826e9a5aa1456e6dbdd99f665d7523e12f21e

See more details on using hashes here.

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