Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Okta Login for newer versions of Doccano #2079

Merged
merged 9 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lint issue
  • Loading branch information
Clovin committed Dec 2, 2022
commit 1185ce52ee2987e29ed79d54f02db1a07cb7e538
2 changes: 1 addition & 1 deletion backend/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@
'secret': env("OAUTH_OKTA_OAUTH2_SECRET", '')
}
}
}
}
2 changes: 1 addition & 1 deletion backend/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
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")),
Expand Down
2 changes: 1 addition & 1 deletion backend/social/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class OktaLogin(SocialLoginView):
adapter_class = OktaOAuth2Adapter
callback_url = '/projects'
client_class = OAuth2Client
client_class = OAuth2Client
4 changes: 1 addition & 3 deletions backend/social/urls.py
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions backend/social/v1_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from .views import Social

urlpatterns = [
path('links/', Social.as_view()),
]
18 changes: 10 additions & 8 deletions backend/social/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {},
})