38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""
|
|
New URL mapping to be compatible with Blender Cloud and other Blender ID users.
|
|
|
|
This mapping uses optional trailing slashes, and thus adheres better to RFC 6749.
|
|
I've also removed the "management" URLs, as we use the admin interface for that.
|
|
"""
|
|
# TODO(Sybren): move this file into bid_main, or move OAuth2 views into their own app.
|
|
|
|
from django.urls import re_path
|
|
from django.views.generic import RedirectView
|
|
|
|
from oauth2_provider import views as default_oauth2_views
|
|
from oauth2_provider import urls as default_oauth2_urls
|
|
|
|
app_name = "oauth2_provider"
|
|
urlpatterns = (
|
|
re_path(r"^authorize/?$", default_oauth2_views.AuthorizationView.as_view(), name="authorize"),
|
|
re_path(r"^token/?$", default_oauth2_views.TokenView.as_view(), name="token"),
|
|
re_path(
|
|
r"^revoke/?$",
|
|
default_oauth2_views.RevokeTokenView.as_view(),
|
|
name="revoke-token",
|
|
),
|
|
# Also add the OIDC urls as originally defined
|
|
*default_oauth2_urls.oidc_urlpatterns,
|
|
# Add a redirect for .well-known/openid-configuration (to add a trailing /)
|
|
# This does not happen automatically because APPEND_SLASH is False
|
|
# This way we support OIDC clients that require either "openid-configuration" or
|
|
# "openid-configuration/".
|
|
re_path(
|
|
r"^\.well-known/openid-configuration$",
|
|
RedirectView.as_view(
|
|
pattern_name="oauth2_provider:oidc-connect-discovery-info",
|
|
permanent=True,
|
|
),
|
|
),
|
|
)
|