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.17.1.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_gar-2.17.1-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_gar-2.17.1.tar.gz
  • Upload date:
  • Size: 29.6 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.17.1.tar.gz
Algorithm Hash digest
SHA256 b07e0b9a27ae7786c4c859c479ab49fd50dbeca79a2dcc94a2274408df994289
MD5 5218b700da175124601614b36a028723
BLAKE2b-256 d77908235781a68d73ddeb5f3fcafa730a0647eea872a6a4698dff39287a3f50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_gar-2.17.1-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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.17.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26c63688caabdad74f22af0dd90b75c8f2ac05d148f7196955e1159553a93cd6
MD5 bbb064549ebb0f125ac620d58a799ecb
BLAKE2b-256 84c34e475308f1075df0a343a5216b4d6c7afc870fe902ce601896b1f5ae8f4e

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