Skip to main content

The Data Central authentication django app

Project description

dc-auth is a dedicated Django app to connect the Data Central authentication backend (LDAP) to multiple dc sites (api, cms etc) via CAS. It supports session-based authentication (tested) and JWT authentication (untested).

For users outside of Data Central, you’ll need to send us details about your application in order to be able to connect, please contact us at https://jira.aao.org.au/servicedesk/customer/portal/3.

Quick start

Add “dc_auth” + the following apps to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    'rest_framework',
    'rest_framework.authtoken',
    'rest_auth',
    ...
    'dc_auth',
]

Add django_settings_export.settings_export to your project’s context_processors:

'OPTIONS': {
    'context_processors': [
        'django.template.context_processors.debug',
        'django.template.context_processors.request',
        'django.contrib.auth.context_processors.auth',
        'django.contrib.messages.context_processors.messages',
        'django_settings_export.settings_export',                   # <----
    ],
},

Include the dc_auth URLconf in your project urls.py like this:

path('auth/', include('dc_auth.urls')),

Migrate to create the Profile table. Run python manage.py migrate.

Start the development server and visit http://127.0.0.1:8000/auth/login to log into your account.

Tests

From the top-level directory run:

$ tox

dcauth comes with some helpers that tools building on dcauth can use, specifically pytest fixtures for affiliation (affiliation) and test passwords (secure_password), as well as factories and fixtures for the User and Profile classes.

Installing for internal applications

To install into another Data Central project, add dc_auth to your requirements file (lock to a specific version), and ensure that pip is pointed to the DC devpi instance.

Contributing

For local development (within a virtualenv), run the following to get a django test web server (dc_auth.settings_testing is for running the tests, but should be fine for interactive use).

$ export DJANGO_SETTINGS_MODULE=dc_auth.settings_testing
$ pip install -e .
$ python -m django runserver

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

dc_auth-1.3.2.tar.gz (99.5 kB view details)

Uploaded Source

Built Distribution

dc_auth-1.3.2-py3-none-any.whl (82.2 kB view details)

Uploaded Python 3

File details

Details for the file dc_auth-1.3.2.tar.gz.

File metadata

  • Download URL: dc_auth-1.3.2.tar.gz
  • Upload date:
  • Size: 99.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for dc_auth-1.3.2.tar.gz
Algorithm Hash digest
SHA256 808e73c3989116e4e55b27988984c797effe299fe6c8cad1be6a8a88f48ca673
MD5 700b52eef0ce8d3419b0a3c204b1128a
BLAKE2b-256 4d97b9582dcd133b55ea2d23f78954518a36d5485e17d57aaf15ab3c95466a08

See more details on using hashes here.

File details

Details for the file dc_auth-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: dc_auth-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for dc_auth-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad1b0358dd3e0befb345d1d6ea397e4bf7a79daa212185e0caf20901076eb03e
MD5 ef8f4482957bf6b3d46171d4bd7a40fd
BLAKE2b-256 4bf54abb9f288da916f1de041c88d3050d55c4a831cf50acfdeac61e439d3a98

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