A Django authentication backend for GeoAxIS
Project description
A Django authentication backend for GeoAxIS OAuth.
requirements
pip install git+ssh://git@github.com:boundlessgeo/django-geoaxis.git#egg=django_geoaxis
local_settings.py (example)
import os
from django.conf import settings
def isValid(v):
if v and len(v) > 0:
return True
else:
return False
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/'
DEFAULT_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
'social_core.pipeline.mail.mail_validation',
'social_core.pipeline.social_auth.associate_by_email',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details'
)
SOCIAL_AUTH_GEOAXIS_KEY = os.getenv('OAUTH_GEOAXIS_KEY', None)
SOCIAL_AUTH_GEOAXIS_SECRET = os.getenv('OAUTH_GEOAXIS_SECRET', None)
SOCIAL_AUTH_GEOAXIS_HOST = os.getenv('OAUTH_GEOAXIS_HOST', None)
OAUTH_GEOAXIS_USER_FIELDS = os.getenv(
'OAUTH_GEOAXIS_USER_FIELDS', 'username, email, last_name, first_name')
SOCIAL_AUTH_GEOAXIS_USER_FIELDS = map(
str.strip, OAUTH_GEOAXIS_USER_FIELDS.split(','))
OAUTH_GEOAXIS_SCOPES = os.getenv('OAUTH_GEOAXIS_SCOPES', 'UserProfile.me')
SOCIAL_AUTH_GEOAXIS_SCOPE = map(str.strip, OAUTH_GEOAXIS_SCOPES.split(','))
ENABLE_GEOAXIS_LOGIN = isValid(SOCIAL_AUTH_GEOAXIS_KEY)
if settings.SITEURL.startswith('https'):
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
# GeoAxisOAuth2 will cause all login attempt to fail if
# SOCIAL_AUTH_GEOAXIS_HOST is None
if ENABLE_GEOAXIS_LOGIN:
settings.AUTHENTICATION_BACKENDS += (
'django_geoaxis.backends.geoaxis.GeoAxisOAuth2',
)
login template addition
Add the following to your login template.
{% if ENABLE_GEOAXIS_LOGIN %}
<a class="btn-geoaxis btn-social btn bg-ms btn-block" href="{% url 'social:begin' 'geoaxis' %}?{{ redirect_field_name }}={{ redirect_field_value }}">
<i class="fa fa-lock"></i> Log In with GeoAxis
</a>
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
django_geoaxis-0.0.2.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_geoaxis-0.0.2.tar.gz.
File metadata
- Download URL: django_geoaxis-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.6.0 setuptools/0.9.8 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f234f01f093f130e7f89532ddedb9b8b115d66da5007f3be94177aefe787c02
|
|
| MD5 |
6c2bc805214eec6f9912b415a3bc1a03
|
|
| BLAKE2b-256 |
1109ab77381391be6e170dfbd15cf8a4c178c261a6a1bb2e58994199ba1b5b66
|
File details
Details for the file django_geoaxis-0.0.2-py2-none-any.whl.
File metadata
- Download URL: django_geoaxis-0.0.2-py2-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.6.0 setuptools/0.9.8 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c596ba9c3be0728a292e44f9128800beaa1c9cf44b266afbb8fc00ef898184c5
|
|
| MD5 |
12d4f1854a30784e3f22e5c79acc6240
|
|
| BLAKE2b-256 |
6b3a03e59b6ea02d9b7bec4a65ac8b88f1d33f2b14f2e0c7f3a86a2a721ef586
|