Giter Club home page Giter Club logo

janus-allauth-provider's Introduction

installation

pip install git+https://github.com/smartlgt/[email protected]#egg=allauth_janus

configuration

setup your settings.py:

INSTALLED_APPS = [
    # your setup with allauth and allauth.socialaccount
    'django.contrib.sites',
    
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth_janus',
    
]
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
)

# ALLAUTh settigs
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = True

# disable signup for all normal requests (allow them for your social providers)
ACCOUNT_ADAPTER = 'allauth_janus.adapter.NoNewUsersAccountAdapter'
SOCIALACCOUNT_ADAPTER = 'allauth_janus.adapter.AllowNewUsersSocialAccountAdapter'

# path to redirect after login
LOGIN_REDIRECT_URL = "/"
# force sso login via the janus provider (don't display a login page on this website)
LOGIN_URL = "/accounts/janus/login/"

########################################
## JANUS
########################################
# define a custom function to handle your app need for data syncing
#ALLAUTH_JANUS_PRE_SOCIAL_CALLBACK = 'allauth_janus.helper.janus_sync_user_properties'  # (default)
ALLAUTH_JANUS_URL = 'https://sso.example.com/oauth2'
ALLAUTH_JANUS_REDIRECT_PROTOCOL = 'http'
ALLAUTH_JANUS_REMOTE_LOGOUT = True

# disable default linking by username on signup behavior (if account allready exists)
# ALLAUTH_JANUS_PRE_SOCIAL_CALLBACK=allauth_janus.signals.noop  

SITE_ID = 1

setup your man urls.py` and include allauth urls

path('accounts/', include('allauth.urls')),

the provider will automatically registered by allauth and a login/callback endpoint will be present at /accounts/janus/login/ and /accounts/janus/login/callback/

first run

setup the social app credentials for the social app "janus" /admin/socialaccount/socialapp/add/

debug

if you see some Social Network Login Failure a good start is the OAuth2CallbackView class dispatch function

sync custom data from janus

add your custom code to the signal handler for social_account_updated and user_signed_up

see signals.py for example

sessions

your django sessions need to work, before a client leave the application and calls the sso, a random verifier and your login state will be stored in a session, on return this information need to be present.

important session behavior

ensure your site framework ist configured correctly.

also if you debug/develop locally, use localhost instead of an ip. on ips your cookies may be disappearing.

janus-allauth-provider's People

Contributors

aritas1 avatar ioannisnezis avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

mepto1913 qup42

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.