from django.conf.urls import url, include from oauth2_provider.views import AuthorizationView from drf_social_oauth2.views import ( ConvertTokenView, TokenView, RevokeTokenView, invalidate_sessions, DisconnectBackendView, ) app_name = 'drfso2' urlpatterns = [ url(r'^authorize/?$', AuthorizationView.as_view(), name='authorize'), url(r'^token/?$', TokenView.as_view(), name='token'), url('', include('social_django.urls', namespace='social')), url(r'^convert-token/?$', ConvertTokenView.as_view(), name='convert_token'), url(r'^revoke-token/?$', RevokeTokenView.as_view(), name='revoke_token'), url(r'^invalidate-sessions/?$', invalidate_sessions, name='invalidate_sessions'), url( r'^disconnect-backend/?$', DisconnectBackendView.as_view(), name='disconnect_backend', ), ]
# -*- coding: utf-8 -*- from django.conf.urls import url, include from oauth2_provider.views import AuthorizationView, TokenView, RevokeTokenView from .views import ConvertTokenView, invalidate_sessions urlpatterns = [ url(r'^authorize/?$', AuthorizationView.as_view(), name="authorize"), url(r'^token/?$', TokenView.as_view(), name="token"), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^convert-token/?$', ConvertTokenView.as_view(), name="convert_token"), url(r'^revoke-token/?$', RevokeTokenView.as_view(), name="revoke_token"), url(r'^invalidate-sessions/?$', invalidate_sessions, name="invalidate_sessions") ]
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns, include from oauth2_provider.views import AuthorizationView, TokenView, RevokeTokenView from .views import ConvertTokenView, invalidate_sessions urlpatterns = patterns( '', url(r'^authorize/?$', AuthorizationView.as_view(), name="authorize"), url(r'^token/?$', TokenView.as_view(), name="token"), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^convert-token/?$', ConvertTokenView.as_view(), name="convert_token"), url(r'^revoke-token/?$', RevokeTokenView.as_view(), name="revoke_token"), url(r'^invalidate-sessions/?$', invalidate_sessions, name="invalidate_sessions"))
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import include, path, reverse from django.views.generic import RedirectView from oauth2_provider.views import AuthorizationView, RevokeTokenView, TokenView urlpatterns = [ path("admin/", admin.site.urls), url(r"", include("user_sessions.urls", "user_sessions")), url( r"^login/$", auth_views.LoginView.as_view(template_name="auth/login.html"), name="login", ), url(r"^logout/$", auth_views.LogoutView.as_view(), name="logout"), path("", RedirectView.as_view(pattern_name="profile:profile"), name="index"), path("profile/", include("unilogin.apps.profile.urls", namespace="profile")), path("api/", include("unilogin.apps.api.urls", namespace="api")), # Django OAuth Toolkit doesn't restrict admin views to staff, # so I have to specify relevant ones manually here. url(r"^oauth2/authorize/$", AuthorizationView.as_view(), name="authorize"), url(r"^oauth2/token/$", TokenView.as_view(), name="token"), url(r"^oauth2/revoke_token/$", RevokeTokenView.as_view(), name="revoke-token"), ]
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns, include from oauth2_provider.views import AuthorizationView, TokenView, RevokeTokenView from .views import convert_token, invalidate_sessions urlpatterns = patterns( "", url(r"^authorize/?$", AuthorizationView.as_view(), name="authorize"), url(r"^token/?$", TokenView.as_view(), name="token"), url("", include("social.apps.django_app.urls", namespace="social")), url(r"^convert-token/?$", convert_token, name="convert_token"), url(r"^revoke-token/?$", RevokeTokenView.as_view(), name="revoke_token"), url(r"^invalidate-sessions/?$", invalidate_sessions, name="invalidate_sessions"), )
from django.urls import path, include from oauth2_provider.views import AuthorizationView from rest_framework_social_oauth2.views import ConvertTokenView from auth import views urlpatterns = [ path(r'authorize', AuthorizationView.as_view(), name='authorize'), path(r'token/', views.token, name="token"), path(r'revoke-token/', views.revoke_token, name="revoke-token"), path('', include('social_django.urls', namespace="social")), path(r'convert-token/', ConvertTokenView.as_view(), name="auth-convert-token") ]
path("logout/", views.Logout.as_view(), name='logout'), path("user/create/", views.UserRegister.as_view(), name='create'), path("user/create/auth/<token>/", views.UserRegisterChecker.as_view(), name='checker'), path("user/update/", views.UserUpdateInfo.as_view(), name="update_user"), path("user/password/update/", views.UserUpdatePasswordInfo.as_view(), name="update_user_password"), path("user/password/reset/", views.UserResetPasswordInfo.as_view(), name="updatereset"), path("reset_password/token/", views.ResetPasswordValidateToken.as_view(), name="resetpasswordtoken"), path("reset_password/<uidb64>/<token>/", views.ResetPasswordConfirm.as_view(), name="resetpassword"), path("authorize/", AuthorizationView.as_view(), name="authorize"), path("api/login/social/session/", csrf_exempt(views.SocialSessionFacebook.as_view()), name="facebookapi"), path("facebook/auth/", views.FacebookAuth.as_view(), name="facebookauth"), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) # urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # router = routers.DefaultRouter() # router.register(r"testapi", views.TestAPI) # urlpatterns = router.urls
WrappedConvertTokenView, WrappedRefreshTokenView, ) # register URL like # router.register(r'users', UsersAPIView) router = DefaultRouter() router.register(r'users', UsersViewSet, base_name='user') urlpatterns = router.urls urlpatterns += [ url( # authorize could be called by server with reverse(), but it's not # cool if it will be scammed at any case. r'^oauth/{0}{0}{0}/authorize/?$'.format(uuid4()), AuthorizationView.as_view(), # Pre-defined name by oauth2_provider lib, don't change it name='authorize'), url(r'^lookup/users/$', LookupUserOptionsView.as_view()), # Exchange external token for ours url(r'^oauth/(?P<local_backend>.*)/convert-token/?$', WrappedConvertTokenView.as_view(), name='convert_token'), url(r'^oauth/(?P<local_backend>.*)/refresh-token/?$', WrappedRefreshTokenView.as_view(), name='refresh_token'), # Revoke our internal token url(r'^oauth/revert-token/?$', rest_auth_views.RevokeTokenView.as_view(), name='revoke_token'), # Get token from external backend for the local backend
from django.urls import path, include from django.views.decorators.http import require_POST from oauth2_provider.views import ( AuthorizationView, TokenView, RevokeTokenView, ) from rest_framework import routers from open_auth.views.application import ApplicationViewSet router = routers.SimpleRouter() router.register('application', ApplicationViewSet, base_name='application') app_name = 'open_auth' urlpatterns = [ path('authorise/', require_POST(AuthorizationView.as_view()), name='authorise'), path('token/', TokenView.as_view(), name='token'), path('revoke_token/', RevokeTokenView.as_view(), name='revoke_token'), path('', include(router.urls)), ]
from django.contrib.admin import site from django.urls import include, path, re_path from oauth2_provider.views import AuthorizationView import unicef_rest_framework.urls import etools_datamart.api.urls from etools_datamart.apps.multitenant.views import SelectSchema urlpatterns = [ path(r'me/', include('etools_datamart.apps.me.urls')), path(r's/', include('etools_datamart.apps.subscriptions.urls')), path(r'', include('etools_datamart.apps.web.urls')), path(r'', include('social_django.urls', namespace='social')), re_path(r'^authorize/?$', AuthorizationView.as_view(), name="authorize"), path(r'api/', include(etools_datamart.api.urls)), path(r'urf/', include(unicef_rest_framework.urls, namespace='urf')), path(r'admin/schemas/', SelectSchema.as_view(), name='select-schema'), path(r'admin/', site.urls), path(r'impersonate/', include('impersonate.urls')), path(r'explorer/', include('explorer.urls')), ] def trigger_error(request): division_by_zero = 1 / 0 # noqa urlpatterns += [ path('sentry-debug/', trigger_error),
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from django.conf.urls import patterns, include, url from django.contrib import admin from oauth2_provider.views import TokenView, AuthorizationView from magpie.api.routers import router admin.autodiscover() handler500 = 'magpie.views.handler500' urlpatterns = patterns('', url(r'^$', 'magpie.views.index', name='index'), url(r'^servers/', include('magpie.servers.urls')), url(r'^account/', include('magpie.account.urls')), url(r'^vpn/', include('magpie.management.urls')), url(r'^api/', include(router.urls)), url(r'^oauth/authorize/$', AuthorizationView.as_view(), name="authorize"), url(r'^oauth/token/$', TokenView.as_view(), name="token"), url(r'^admin/doc/', include('django.contrib.admindocs.urls')), url(r'^admin/', include(admin.site.urls)), )
views.CBODetailEndpoint.as_view(), name='api-enventure'), url(r'^api/v1/enventures', views.EnventureEndpoint.as_view(), name='api-enventure'), url(r'^api/v1/enventureInfo', views.EnventureDetailEndpoint.as_view(), name='api-enventure'), url(r'^api/v1/accounts', views.AccountsEndpoint.as_view(), name='api-accounts'), url(r'^api/v1/cbodata', views.CBODataEndpoint.as_view(), name='api-cbo-data'), url(r'^auth/', include('oauth2_provider.urls', namespace='oauth2_provider')), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^social_auth/', include('rest_framework_social_oauth2.urls')), url(r'^users/authorize/?$', AuthorizationView.as_view(), name="authorize"), url(r'^users/token/?$', TokenView.as_view(), name="token"), url(r'^users/convert-token/?$', ConvertTokenView.as_view(), name="convert_token"), url(r'^users/revoke-token/?$', RevokeTokenView.as_view(), name="revoke_token"), url(r'^users/invalidate-sessions/?$', invalidate_sessions, name="invalidate_sessions") ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)