Reusable Django app for Penn Labs accounts
Project description
Requirements
Python 3.4+
Django 2.0+
Installation
- Install with pipenv
pipenv install django-labs-accounts
Add accounts to INSTALLED_APPS
INSTALLED_APPS = (
...
'accounts.apps.AccountsConfig',
...
)
Add the new accounts backend to AUTHENTICATION_BACKENDS
AUTHENTICATION_BACKENDS = (
...
'django.contrib.auth.backends.ModelBackend',
...
)
Add the following to urls.py
urlpatterns = [
...
path('accounts/', include('accounts.urls', namespace='accounts')),
...
]
Documentation
All settings are handled with a PLATFORM_ACCOUNTS dictionary.
Example:
PLATFORM_ACCOUNTS = {
'CLIENT_ID': 'id',
'CLIENT_SECRET': 'secret',
'REDIRECT_URI': 'example',
'ADMIN_PERMISSION': 'example_admin'
}
The available settings are:
CLIENT_ID the client ID to connect to platform with. Defaults to LABS_CLIENT_ID environment variable.
CLIENT_SECRET the client secret to connect to platform with. Defaults to LABS_CLIENT_SECRET environment variable.
REDIRECT_URI the redirect uri to send to platform. Defaults to LABS_REDIRECT_URI environment variable.
SCOPE the scope for this applications tokens. Must include introspection. Defaults to ['read', 'introspection'].
PLATFORM_URL URL of platform server to connect to. Should be https://platform(-dev).pennlabs.org (no trailing slash)
ADMIN_PERMISSION The name of the permission on platform to grant admin access. Defaults to example_admin
When developing with an http (not https) callback URL, it may be helpful to set the OAUTHLIB_INSECURE_TRANSPORT environment variable.
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1"
Changelog
See CHANGELOG.md.
License
See LICENSE.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-labs-accounts-0.3.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | db8ac846eb2312f2a3e0e13b3b9e2b1a7230e06f77e0ad8bac8598f8eca46e4c |
|
MD5 | a76d1012148d1d878c2704a5d1fd7cbc |
|
BLAKE2b-256 | 5cb806df640e31bb3ce399d8f7d45cf8675e769ad0da735faa57123326e6b0e9 |
Hashes for django_labs_accounts-0.3.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e12e3a2eb12a9daae9ccacc09ce8ffe3b860fc419db8a23fb8175f3cce06274 |
|
MD5 | 0f8f457f8955feda5e43402947bbaba7 |
|
BLAKE2b-256 | 3c83d010eb60f2df155f91e7a5fded08f5d283194a53c359932e2aa3f5752242 |