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'
'CUSTOM_ADMIN': True
}
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
CUSTOM_ADMIN enable the custom admin login page to log in users through platform. Defaults to True
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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 792103cd39b780155b5f52c22e16290e20156b4e373c76b30feee3e565ef15d0 |
|
MD5 | 9a64a213c020ed346cd277cb5efda089 |
|
BLAKE2b-256 | fcb0e68f078175e893103a7f85831d1b9dbb277567c4113c72f6524a943db0e9 |
Hashes for django_labs_accounts-0.3.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 054f3afd2f3e64adf1e727d27bb9a05a4dd66e85a65ffebe5606442ea77e4c01 |
|
MD5 | 147fc6c44a5b0322112f0416a570ac04 |
|
BLAKE2b-256 | 241a157d6150a33513af02a499a9807e874770d76924068d5b0c211478fee7f9 |