from django.conf.urls import include, url from django.conf import settings from oauth2_provider.views.base import AuthorizationView, TokenView, RevokeTokenView from .views import MyselfResource, EventResource assert 'oauth2_provider' in settings.INSTALLED_APPS, 'api_v2 requires oauth2_provider' urlpatterns = [ url(r'^oauth2/authorize/?$', AuthorizationView.as_view(), name="authorize"), url(r'^oauth2/token/?$', TokenView.as_view(), name="token"), url(r'^oauth2/revoke/?$', RevokeTokenView.as_view(), name="revoke"), url(r'^api/v2/people/me?$', MyselfResource.as_view(), name='api_v2_self_resource'), url(r'^api/v2/events/(?P<event_slug>[a-z0-9-]+)/?$', EventResource.as_view(), name='api_v2_event_resource'), ]
from django.conf.urls import url from django.urls import path from oauth2_provider.views.base import TokenView from apps.api import views as api_views from apps.shop import views as shop_views urlpatterns = [ url(r"^v1/rfid/$", shop_views.SetRFIDView.as_view(), name="set_rfid"), url(r"^v1/auth/$", TokenView.as_view(), name="oauth2_provider_token"), path("v1/docs/", api_views.SwaggerUIView.as_view(), name="swagger-ui"), path( "v1/openapi-schema", api_views.OpenAPISchemaView.as_view(), name="openapi-schema", ), ]
def login(self, request, *args, **kwargs): logger.debug("OAuth2Login") view = TokenView.as_view() return view(request._request, *args, **kwargs)
from .views import MyselfResource, EventResource assert 'oauth2_provider' in settings.INSTALLED_APPS, 'api_v2 requires oauth2_provider' urlpatterns = [ url( r'^oauth2/authorize/?$', csp_exempt(AuthorizationView.as_view()), name="authorize" ), url( r'^oauth2/token/?$', csp_exempt(TokenView.as_view()), name="token" ), url( r'^oauth2/revoke/?$', csp_exempt(RevokeTokenView.as_view()), name="revoke" ), url( r'^api/v2/people/me?$', csp_exempt(MyselfResource.as_view()), name='api_v2_self_resource' ),
from django.conf.urls import url from . import views from oauth2_provider.views.base import TokenView, RevokeTokenView urlpatterns = [ url(r"^register/$", views.register, name="account_api_register"), url(r"^registrations/(?P<user_id>[^/]+)/$", views.check_registration, name="account_api_check_registration"), url(r"^send-email-confirmation/$", views.send_email_confirmation, name="account_api_send_email_confirmation"), url(r"^confirm-email/$", views.confirm_email, name="account_api_confirm_email"), url(r"^login/$", views.login, name="account_api_login"), url(r"^oauth-login/$", TokenView.as_view(), name="account_api_oauth2_login"), url(r"^logout/$", views.logout, name="account_api_logout"), url(r"^oauth-logout/$", RevokeTokenView, name="account_api_oauth2_logout"), url(r"^password/$", views.change_password, name="account_api_change_password"), url(r"^password/reset/$", views.reset_password, name="account_api_reset_password"), url(r"^password/reset/confirm/$", views.confirm_reset_password, name="account_api_reset_password_confirm"), ]
users_view.IdentifyingCodeAction.as_view()), url(r'^verify_identifying_code/$', users_view.IdentifyingCodeVerify.as_view()), url(r'^send_identifying_code_with_login/$', users_view.IdentifyingCodeActionWithLogin.as_view()), url(r'^user_not_logged_action/$', users_view.UserNotLoggedAction.as_view()), url(r'^user_action/$', users_view.UserAction.as_view()), url(r'^user_detail/$', users_view.UserDetail.as_view()), url(r'^role_list/$', users_view.RoleList.as_view()), # 微信授权登录 url(r'^wx_login/$', users_view.WXAuthAction.as_view()), # 微信授权登录后获取token url(r'^wxauth/token/$', wx_auth_views.AuthCallback.as_view()), # 获取微信授权登录的结果 url(r'^wx_authorized_result/$', users_view.WXAuthorizedResult.as_view()), # 微博授权登录 url(r'^wb_login/$', users_view.WBAuthAction.as_view()), # 微博授权登录后获取token url(r'^wbauth/token/$', wb_auth_views.AuthCallback.as_view()), # 绑定手机号、邮箱及微博等 url(r'^binding_action/$', users_view.UserBindingAction.as_view()), url(r'^login/$', TokenView.as_view(), name='login'), url(r'^logout/$', users_view.AuthLogout.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns)
# -*- coding:utf8 -*- from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from rest_framework.urlpatterns import format_suffix_patterns from users import views as users_view from oauth2_provider.views.base import TokenView urlpatterns = [ url(r'^send_identifying_code/$', users_view.IdentifyingCodeAction.as_view()), url(r'^verify_identifying_code/$', users_view.IdentifyingCodeVerify.as_view()), url(r'^send_identifying_code_with_login/$', users_view.IdentifyingCodeActionWithLogin.as_view()), url(r'^user_not_logged_action/$', users_view.UserNotLoggedAction.as_view()), url(r'^user_action/$', users_view.UserAction.as_view()), url(r'^user_detail/$', users_view.UserDetail.as_view()), url(r'^user_list/$', users_view.UserList.as_view()), url(r'^login/$', TokenView.as_view()), url(r'^logout/$', users_view.AuthLogout.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns)
__author__ = 'kako' from django.conf.urls import url from oauth2_provider.views.base import TokenView, RevokeTokenView from .views.apps import HomeView as AppHomeView from .views.oauth import CustomAuthorizationView from .views.public import PublicView app_home_view = AppHomeView.as_view() public_view = PublicView.as_view() oauth_auth_view = CustomAuthorizationView.as_view() oauth_token_view = TokenView.as_view() oauth_revoke_view = RevokeTokenView.as_view() urlpatterns = [ url(r'^$', app_home_view, name='home'), url(r'^(?P<page>\w+)$', public_view, name='public'), url(r'^oauth/authorize/$', oauth_auth_view, name="authorize"), url(r'^oauth/token/$', oauth_token_view, name="token"), url(r'^oauth/revoke_token/$', oauth_revoke_view, name="revoke-token"), ]