Skip to main content

Handle login and ticket validation for french GAR

Project description

django-gar

Python 3.11 Django 4.x Python CI codecov Code style: black
security: bandit
Handle CAS login for the french Gestionnaire d'Accès au Ressources (GAR).

Installation

Install with pip:

pip install django-gar

Setup

In order to make django-gar works, you'll need to follow the steps below.

Settings

First you need to add the following configuration to your settings:

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.messages',

    'django_gar',
    ...
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    
    'django_gar.middleware.GARMiddleware', # mandatory
    ...
)

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    
    'django_gar.backends.GARBackend',
    ...
)

Migrations

Next, you need to run the migrations in order to update your database schema.

python manage.py migrate

Mandatory settings

Here is the list of all the mandatory settings:

GAR_BASE_URL
GAR_BASE_SUBSCRIPTION_URL
GAR_SUBSCRIPTION_PREFIX
GAR_DISTRIBUTOR_ID
GAR_CERTIFICATE_PATH
GAR_KEY_PATH
GAR_RESOURCES_ID
GAR_ORGANIZATION_NAME

The optional settings with their default values:

GAR_ACTIVE_USER_REDIRECT (default: "/")
GAR_INACTIVE_USER_REDIRECT (default: "/")
GAR_QUERY_STRING_TRIGGER (default: "sso_id")

Tests

Testing is managed by pytest. Required package for testing can be installed with:

pip install -r test_requirements.txt

To run testing locally:

pytest

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_gar-2.16.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

django_gar-2.16.0-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file django_gar-2.16.0.tar.gz.

File metadata

  • Download URL: django_gar-2.16.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for django_gar-2.16.0.tar.gz
Algorithm Hash digest
SHA256 8a0830e85b119d53f64145a13f413d34acdbb3586bca9b5914dee7d876ecc69f
MD5 8b114f33d4e3bfb7cddf244b075f1057
BLAKE2b-256 7292e4bd260ac490f4507d76e21a87c8720cf53c1dcd0091cb127e45545d0fc2

See more details on using hashes here.

File details

Details for the file django_gar-2.16.0-py3-none-any.whl.

File metadata

  • Download URL: django_gar-2.16.0-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for django_gar-2.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b0a63ec2d099a3520339804705293ab140e5393e17d2dcc1a8ca47ac81d7ef8
MD5 42ae2374b179c11ff3edef3b5f589914
BLAKE2b-256 5954150d97384d3aa34be690fd56171db7110215ed6a7696ae02dad6df0ebb66

See more details on using hashes here.

Supported by

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