Feature/single sign on
Created by: MagdaN
How this can be tested:
In the project that is going to be the SERVER create a new Application in the django dashboard (admin/oauth2_provider/application/):
- add /accounts/wechange/login/callback/ to redirects
- Client type : Confidential
- Authorization grant type: Authorization code
- Skip authorization: checked
In the project that is going to be the CLIENT:
-
add the following to your settings: COSINNUS_IS_OAUTH_CLIENT = True COSINNUS_OAUTH_SERVER_BASEURL = 'http://oauth-provider:8000' ACCOUNT_ADAPTER = 'cosinnus_oauth_client.views.CosinusAccountAdapter' ACCOUNT_EMAIL_REQUIRED = True SOCIALACCOUNT_ADAPTER = 'cosinnus_oauth_client.views.CosinusSocialAccountAdapter' SOCIALACCOUNT_AUTO_SIGNUP = False SOCIALACCOUNT_FORMS = {'signup': 'cosinnus_oauth_client.forms.SocialSignupProfileSettingsForm'} SOCIALACCOUNT_EMAIL_VERIFICATION = "none"
-
add the following to urls.py:
if getattr(settings, 'IS_COSINNUS_OAUTH_CLIENT', False) and getattr(settings, 'COSINNUS_OAUTH_SERVER_BASEURL', False):
from cosinnus_oauth_client.views import custom_connections
from cosinnus_oauth_client.views import custom_password_set
urlpatterns += [
url(r'accounts/social/connections/$', custom_connections, name='socialaccount_connections'),
url(r'accounts/password/set/', custom_password_set, name='account_set_password'),
url(r'accounts/', include('allauth.urls')),
]
- Go to /admin/socialaccount/socialapp/add/ and add a new provider with the data from your Django OAuth Toolkit Application on the Oauth Server