From 513163fc56a7193377ac218c2edd827df49971db Mon Sep 17 00:00:00 2001 From: mahdavi Date: Tue, 9 Jun 2020 17:44:30 +0430 Subject: [PATCH] user gooyal oauth --- apps/gooyal_oauth/migrations/0001_initial.py | 4 ++++ .../gooyal_oauth/validators.py | 0 gooyal_accounts/settings.py | 15 +++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) rename utils/oauth2_provider.py => apps/gooyal_oauth/validators.py (100%) diff --git a/apps/gooyal_oauth/migrations/0001_initial.py b/apps/gooyal_oauth/migrations/0001_initial.py index 05c2bf7..63f4126 100644 --- a/apps/gooyal_oauth/migrations/0001_initial.py +++ b/apps/gooyal_oauth/migrations/0001_initial.py @@ -10,6 +10,10 @@ class Migration(migrations.Migration): initial = True + run_before = [ + ('oauth2_provider', '0001_initial'), + ] + dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), migrations.swappable_dependency(settings.OAUTH2_PROVIDER_APPLICATION_MODEL), diff --git a/utils/oauth2_provider.py b/apps/gooyal_oauth/validators.py similarity index 100% rename from utils/oauth2_provider.py rename to apps/gooyal_oauth/validators.py diff --git a/gooyal_accounts/settings.py b/gooyal_accounts/settings.py index edf1045..caaae42 100644 --- a/gooyal_accounts/settings.py +++ b/gooyal_accounts/settings.py @@ -58,26 +58,25 @@ MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', ] -# Tell Django OAuth Toolkit to use the RestrictedApplication model -OAUTH2_PROVIDER_APPLICATION_MODEL = 'gooyal_restrict_scopes.RestrictedApplication' +# Tell Django OAuth Toolkit to use the Gooyal Application model +OAUTH2_PROVIDER_APPLICATION_MODEL = 'gooyal_oauth.Application' OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = 'oauth2_provider.AccessToken' OAUTH2_PROVIDER_GRANT_MODEL = 'oauth2_provider.Grant' OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = 'oauth2_provider.RefreshToken' OAUTH2_PROVIDER = { # this is the list of available scopes - # 'SCOPES_BACKEND_CLASS': 'apps.gooyal_restrict_scopes.scopes.RestrictApplicationScopes', - 'SCOPES_BACKEND_CLASS': 'apps.gooyal_dynamic_scopes.scopes.DynamicScopes', + 'SCOPES_BACKEND_CLASS': 'apps.gooyal_oauth.scopes.Scopes', 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups', 'introspection': 'Introspect token scope'}, - 'OAUTH2_VALIDATOR_CLASS': 'utils.oauth2_provider.MultiGatewayOAuth2Validator' + 'OAUTH2_VALIDATOR_CLASS': 'apps.gooyal_oauth.validators.MultiGatewayOAuth2Validator' } -GOOYAL_RESTRICT_SCOPES = { - 'WRAPPED_SCOPES_BACKEND_CLASS': 'oauth2_provider.scopes.SettingsScopes', -} +# GOOYAL_RESTRICT_SCOPES = { +# 'WRAPPED_SCOPES_BACKEND_CLASS': 'oauth2_provider.scopes.SettingsScopes', +# } # GOOYAL_DYNAMIC_SCOPES