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.0.tar.gz (29.7 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.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_gar-2.17.0.tar.gz
  • Upload date:
  • Size: 29.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.17.0.tar.gz
Algorithm Hash digest
SHA256 7aed29d8ebbecc6a45550c5612b82a3748029d1da824ba380e8dec4b0baae58d
MD5 6d464fb4ef283d123cac7178104dd9fe
BLAKE2b-256 098129047dae856f46e69ea26e9366599d1228675781abc7b4841c82649a724b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_gar-2.17.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d932f1297422d803c3702b52dd8ed2d20d259b5727e43345474b6c28bfd9ca2
MD5 4d3784820bd9b2b0a76ab1a5c3973b45
BLAKE2b-256 88d0cdacfd6030e60a069f298707d81ac45272b5dc61fcec542c2f4c0c650123

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