============
A reusable django application for google sso
Installation
------------
To get the latest stable release from PyPi
.. code-block:: bash
pip install eckerd-django-google-sso
To get the latest commit from GitHub
.. code-block:: bash
pip install -e git+git://github.com/christopherdavenport/eckerd-django-google-sso.git#egg=eckerd-django-google-sso
TODO: Describe further installation steps (edit / remove the examples below):
Add ``eckerd-django-google-sso`` to your ``INSTALLED_APPS``
.. code-block:: python
INSTALLED_APPS = (
...,
'eckerd-django-google-sso',
'social.apps.django_app.default',
'django12factor',
)
Add the ``eckerd-django-google-sso`` URLs to your ``urls.py``
.. code-block:: python
urlpatterns = [
url(r'^/', include('eckerd-django-google-sso.urls')),
]
Before your tags/filters are available in your templates, load them by using
.. code-block:: html
{% load backend_utils %}
Don't forget to migrate your database
.. code-block:: bash
./manage.py migrate
Usage
-----
Simple Wrap Your Content In a @LOGIN_REQUIRED
Finally Drop These Settings In Place In The Final Application
.. code-block:: python
AUTHENTICATION_BACKENDS = (
'social.backends.google.GoogleOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
AUTH_USER_MODEL = 'eckerd-django-google-sso.CustomUser'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
URL_PATH = ''
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
# Google OAuth2 (google-oauth2)
SOCIAL_AUTH_GOOGLE_OAUTH2_IGNORE_DEFAULT_SCOPE = True
SOCIAL_AUTH_GOOGLE_OAUTH2_USE_UNIQUE_USER_ID = True
SOCIAL_AUTH_GOOGLE_OAUTH2_WHITELISTED_DOMAINS = ['eckerd.edu']
SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'
]
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.associate_by_email',
'social.pipeline.social_auth.social_user',
'social.pipeline.user.get_username',
'social.pipeline.user.create_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details'
)
SOCIAL_AUTH_ADMIN_USER_SEARCH_FIELDS = ['first_name', 'last_name', 'email',
'username']
custom_settings = (
'SOCIAL_AUTH_GOOGLE_OAUTH2_KEY',
'SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET',
)
import django12factor
d12f = django12factor.factorise(custom_settings=custom_settings)
DATABASES = d12f['DATABASES']
SECRET_KEY = d12f['SECRET_KEY']
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = d12f['SOCIAL_AUTH_GOOGLE_OAUTH2_KEY']
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = d12f['SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET']
ALLOWED_HOSTS = d12f['ALLOWED_HOSTS']
DEBUG = d12f['DEBUG']
LOGGING = d12f['LOGGING']
Contribute
----------
If you want to contribute to this project, please perform the following steps
.. code-block:: bash
# Fork this repository
# Clone your fork
mkvirtualenv -p python2.7 eckerd-django-google-sso
make develop
git co -b feature_branch master
# Implement your feature and tests
git add . && git commit
git push -u origin feature_branch
# Send us a pull request for your feature branch
In order to run the tests, simply execute ``tox``. This will install two new
environments (for Django 1.8 and Django 1.9) and run the tests against both
environments.
Metadata
Release files for eckerd-django-google-sso 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eckerd-django-google-sso-0.0.1.tar.gz | 9.2 kB | Without provenance | Details for eckerd-django-google-sso-0.0.1.tar.gz |
Release files / eckerd-django-google-sso-0.0.1.tar.gz
| Download URL | eckerd-django-google-sso-0.0.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a23d391faa461e3dc1f45ffae80dc7e2ab0e40ef7695311b42c326612862ca99
|
|
BLAKE2b-256 checksum How to use checksums |
c3c58fdf864a2289f710986295fb0f1bf0cd8999a81ff678e998d66ca1623cf5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for eckerd-django-google-sso 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.