Browse Source

fix lint issue

pull/2079/head
Clovin 2 years ago
parent
commit
1185ce52ee
6 changed files with 21 additions and 14 deletions
  1. 2
      backend/config/settings/base.py
  2. 2
      backend/config/urls.py
  3. 2
      backend/social/okta.py
  4. 4
      backend/social/urls.py
  5. 7
      backend/social/v1_urls.py
  6. 18
      backend/social/views.py

2
backend/config/settings/base.py

@ -291,4 +291,4 @@ SOCIALACCOUNT_PROVIDERS = {
'secret': env("OAUTH_OKTA_OAUTH2_SECRET", '')
}
}
}
}

2
backend/config/urls.py

@ -53,7 +53,7 @@ urlpatterns += [
path("admin/", admin.site.urls),
path("api-auth/", include("rest_framework.urls")),
path('social/', include("social.urls")),
path('v1/social/', include("social.urls")),
path('v1/social/', include("social.v1_urls")),
path("v1/health/", include("health_check.urls")),
path("v1/", include("api.urls")),
path("v1/", include("roles.urls")),

2
backend/social/okta.py

@ -5,4 +5,4 @@ from allauth.socialaccount.providers.oauth2.client import OAuth2Client
class OktaLogin(SocialLoginView):
adapter_class = OktaOAuth2Adapter
callback_url = '/projects'
client_class = OAuth2Client
client_class = OAuth2Client

4
backend/social/urls.py

@ -1,9 +1,7 @@
from django.urls import include, path
from django.urls import path
from .okta import OktaLogin
from .views import Social
urlpatterns = [
path('links/', Social.as_view()),
path('complete/okta-oauth2/', OktaLogin.as_view(), name='okta_login'),
]

7
backend/social/v1_urls.py

@ -0,0 +1,7 @@
from django.urls import path
from .views import Social
urlpatterns = [
path('links/', Social.as_view()),
]

18
backend/social/views.py

@ -7,12 +7,14 @@ class Social(APIView):
def get(self, request, *args, **kwargs):
return Response({
'okta': {
'type': 'oauth2',
'base_url': settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL'),
'client_id': settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id'),
'redirect_path': '/social/complete/okta-oauth2',
'authorize_url': 'https://' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') + '/oauth2/v1/authorize?response_type=code&client_id=' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id') + '&scope=openid&state=unknown&response_mode=form_post'
} if settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') else {},
'okta': {
'type': 'oauth2',
'base_url': settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL'),
'client_id': settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id'),
'redirect_path': '/social/complete/okta-oauth2',
'authorize_url':
'https://' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') +
'/oauth2/v1/authorize?response_type=code&client_id=' + settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('APP').get('client_id') +
'&scope=openid&state=unknown&response_mode=form_post'
} if settings.SOCIALACCOUNT_PROVIDERS.get('okta').get('OKTA_BASE_URL') else {},
})
Loading…
Cancel
Save