from django.urls import path, include from rest_framework import routers from django.conf import settings import oauth2_provider.views as oauth2_views from Authentication.views import ( register, login, change_password, check_otp, send_otp, UserIdentityViewSet, store_send_otp, Find_User, Identity, register_all, change_user_mobile, NumberOfActiveUsers, remove_access_token,check_user_exists, remove_user_role ) router = routers.DefaultRouter() router.register('user_identity', UserIdentityViewSet, basename='user_identity') oauth2_endpoint_views = [ path('authorize/', oauth2_views.AuthorizationView.as_view(), name="authorize"), path('token/', oauth2_views.TokenView.as_view(), name="token"), path('register/', register, name="register"), path('register_all/', register_all, name="register_all"), path('login/', login, name="login"), path('change_password/', change_password, name="change_password"), path('send_otp/', send_otp, name="send_otp"), path('send/', store_send_otp, name="send"), path('check_otp/', check_otp, name="check_otp"), path('find/', Find_User, name="find"), path('identity/', Identity, name="identity"), path('active-users/', NumberOfActiveUsers, name="active-users"), path('remove_access_token/', remove_access_token, name="remove_access_token"), path('check_user_exists/', check_user_exists, name="check_user_exists"), path('remove_user_role/', remove_user_role, name="remove_user_role"), ] if settings.DEBUG: # OAuth2 Application Management endpoints oauth2_endpoint_views += [ path('applications/', oauth2_views.ApplicationList.as_view(), name="list"), path('applications/register/', oauth2_views.ApplicationRegistration.as_view(), name="register"), path('applications//', oauth2_views.ApplicationDetail.as_view(), name="detail"), path('applications//delete/', oauth2_views.ApplicationDelete.as_view(), name="delete"), path('applications//update/', oauth2_views.ApplicationUpdate.as_view(), name="update"), ] # OAuth2 Token Management endpoints oauth2_endpoint_views += [ path('authorized-tokens/', oauth2_views.AuthorizedTokensListView.as_view(), name="authorized-token-list"), path('authorized-tokens//delete/', oauth2_views.AuthorizedTokenDeleteView.as_view(), name="authorized-token-delete"), ] urlpatterns = [ path('', include(router.urls)), path('api/', include((oauth2_endpoint_views, 'oauth2_provider.urls'), namespace="oauth2_provider")), path('change_mobile_number/', change_user_mobile), ]