2018-11-16 08:10:35 +00:00
|
|
|
"""passbook oauth_provider urls"""
|
|
|
|
|
2019-10-07 15:14:52 +00:00
|
|
|
from django.urls import include, path
|
2019-02-26 08:08:22 +00:00
|
|
|
from oauth2_provider import views
|
2018-11-16 08:10:35 +00:00
|
|
|
|
2020-05-16 14:02:42 +00:00
|
|
|
from passbook.providers.oauth.views import github, oauth2
|
2018-11-16 08:10:35 +00:00
|
|
|
|
2019-10-07 14:57:36 +00:00
|
|
|
oauth_urlpatterns = [
|
2018-11-16 08:10:35 +00:00
|
|
|
# Custom OAuth 2 Authorize View
|
2019-12-31 11:51:16 +00:00
|
|
|
path(
|
|
|
|
"authorize/",
|
|
|
|
oauth2.PassbookAuthorizationLoadingView.as_view(),
|
|
|
|
name="oauth2-authorize",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"authorize/permission_ok/",
|
|
|
|
oauth2.PassbookAuthorizationView.as_view(),
|
|
|
|
name="oauth2-ok-authorize",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"authorize/permission_denied/",
|
|
|
|
oauth2.OAuthPermissionDenied.as_view(),
|
|
|
|
name="oauth2-permission-denied",
|
|
|
|
),
|
2018-11-16 08:10:35 +00:00
|
|
|
# OAuth API
|
2019-02-26 08:08:22 +00:00
|
|
|
path("token/", views.TokenView.as_view(), name="token"),
|
|
|
|
path("revoke_token/", views.RevokeTokenView.as_view(), name="revoke-token"),
|
|
|
|
path("introspect/", views.IntrospectTokenView.as_view(), name="introspect"),
|
2018-11-16 08:10:35 +00:00
|
|
|
]
|
2019-10-07 14:33:48 +00:00
|
|
|
|
|
|
|
github_urlpatterns = [
|
2019-12-31 11:51:16 +00:00
|
|
|
path(
|
|
|
|
"login/oauth/authorize",
|
|
|
|
oauth2.PassbookAuthorizationView.as_view(),
|
|
|
|
name="github-authorize",
|
|
|
|
),
|
|
|
|
path(
|
|
|
|
"login/oauth/access_token",
|
|
|
|
views.TokenView.as_view(),
|
|
|
|
name="github-access-token",
|
|
|
|
),
|
|
|
|
path("user", github.GitHubUserView.as_view(), name="github-user"),
|
2019-10-07 14:33:48 +00:00
|
|
|
]
|
|
|
|
|
2019-10-07 14:57:36 +00:00
|
|
|
urlpatterns = [
|
2019-12-31 11:51:16 +00:00
|
|
|
path("", include(github_urlpatterns)),
|
|
|
|
path("application/oauth/", include(oauth_urlpatterns)),
|
2019-10-07 14:57:36 +00:00
|
|
|
]
|