# -*- 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"))
name="update_cluster_archetype"), # mailchimp url(r"^mailchimp/webhook/$", MailchimpWebhookView.as_view(), name="mailchimp_webhook"), # oauth2 url(r"^oauth2/login/$", OAuth2LoginView.as_view(), name="oauth2_login"), url(r"^oauth2/authorize/$", OAuth2AuthorizeView.as_view(), name="authorize"), url(r"^oauth2/revoke/$", OAuth2RevokeView.as_view(), name="oauth2_revoke_access"), url(r"^oauth2/token/$", TokenView.as_view(), name="token"), url(r"^oauth2/application/reset_secret/$", OAuth2ResetSecretView.as_view(), name="oauth2_reset_secret"), url(r"^oauth2/revoke_all_tokens/$", OAuth2RevokeAllTokensView.as_view(), name="oauth2_revoke_all_tokens"), # profiles (currently unused) url(r"^profile/packs/$", PackListView.as_view(), name="profile_packs"), url(r"^leaderboards/$", LeaderboardsView.as_view(), name="profile_packs"), url(r"^profiles/(?P<user_id>\d+)/$", ProfileView.as_view(), name="profile_packs"), # redirects
from django.conf import settings from django.contrib import admin from django.urls import include, path from oauth2_provider.views import TokenView from config import api_urls from config.api_docs_urls import api_docs_urls from datahub.ping.views import ping from datahub.user.views import who_am_i unversioned_urls = [ path('admin/', admin.site.urls), path('', include('datahub.admin_report.urls')), path('', include('datahub.investment.project.report.urls')), path('ping.xml', ping, name='ping'), path('token/', TokenView.as_view(), name='token'), path('whoami/', who_am_i, name='who_am_i'), ] if settings.ADMIN_OAUTH2_ENABLED: from datahub.oauth.admin.views import callback as admin_oauth_callback unversioned_urls += [ # This endpoint is used for Django Admin OAuth2 authentication path('admin/oauth/callback', admin_oauth_callback, name='admin_oauth_callback'), ] if settings.DEBUG: import debug_toolbar unversioned_urls += [
application = context.get('application') scopes = context.get('scopes') if application is not None and application.can_auto_approve(scopes): uri, headers, body, status = self.create_authorization_response( request=self.request, scopes=" ".join(scopes), credentials=context, allow=True) return HttpResponseRedirect(uri) context['oauth_request'] = context.get('request') context['request'] = self.request return super(CustomAuthorizationView, self).render_to_response(context, **kwargs) urlpatterns = [ url(r'^authorize/$', CustomAuthorizationView.as_view(), name="authorize"), url(r'^token/$', TokenView.as_view(), name="token"), ] class CustomApplicationUpdate(ApplicationUpdate): fields = ['name', 'redirect_uris', 'description', 'homepage', 'image_url'] # Application management views app_name = 'account' urlpatterns += [ url(r'^applications/$', ApplicationList.as_view(), name="list"), url(r'^applications/register/$', ApplicationRegistration.as_view(), name="register"), url(r'^applications/(?P<pk>\d+)/$', ApplicationDetail.as_view(), name="detail"), url(r'^applications/(?P<pk>\d+)/delete/$', ApplicationDelete.as_view(), name="delete"), url(r'^applications/(?P<pk>\d+)/update/$', CustomApplicationUpdate.as_view(), name="update"),
# -*- 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.conf.urls import url from oauth2_provider.views import TokenView from .views import AuthorizationView, UserDataView, oauth2_logout urlpatterns = [ url(r'^authorize/$', AuthorizationView.as_view(), name='authorize'), url(r'^token/$', TokenView.as_view(), name='token'), url(r'^user/$', UserDataView.as_view(), name='userdata'), url(r'^logout/$', oauth2_logout, name='oauth2_logout') ]
urlpatterns = [ url(r'^register/$', RegisterView.as_view(), name='register'), url(r'^login/$', LogInView.as_view(), name='login'), url(r'^logout/$', LogOutView.as_view(), name='logout'), url(r'^profile/(?P<pk>\d+)$', ProfileDetailView.as_view(), name='profile'), url(r'^users/$', AllUsersView.as_view(), name='all_users'), url(r'^edit/(?P<pk>\d+)$', EditProfileView.as_view(), name='edit_profile'), url(r'^password/$', ChangePasswordView.as_view()), url(r'^city/$', CityAutocompleteView.as_view()), url(r'^send_request/(?P<pk>\d+)$', SendFriendRequestView.as_view(), name='send_request'), url(r'^add_to_friend/(?P<pk>\d+)$', AddToFriendView.as_view(), name='add_to_friend'), url(r'^remove/(?P<pk>\d+)$', RemoveFromFriendView.as_view(), name='remove'), url(r'^notification/$', NotificationView.as_view(), name='notification'), url(r'^friends/$', FriendsView.as_view(), name='friends'), url(r'^nearest_users/$', NearestUserView.as_view(), name='nearest_users'), url(r'^token/?$', GetAccessTokenView.as_view()), url(r'^protected_data/?$', ProtectedDataView.as_view()), url(r'^get_csv_data/?$', ReturnCsvDataView.as_view(), name='get_csv'), url(r'^accounts/', include('allauth.urls')), url(r'^authorize/?$', AuthorizationView.as_view(), name="authorize"), url(r'^google_token/?$', TokenView.as_view(), name="token"), url(r'^revoke_token/?$', RevokeTokenView.as_view(), name="revoke-token"), url(r'^success/$', views.success, name='success'), ]
from youckan.apps.sso.views import RegisterView, RegisterMailView, RegisterDoneView, RegisterConfirmView from youckan.apps.sso.views import login, OAuthAuthorizationView from oauth2_provider.views import TokenView urlpatterns = patterns('', url(r'^login/$', login, name='login'), url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'sso/logout.html'}, name='logout'), url(r'^register/$', RegisterView.as_view(), name='register'), url(r'^register/mail/$', RegisterMailView.as_view(), name='register-mail'), url(r'^register/mail/(?P<key>[\w\d_-]+)/$', RegisterConfirmView.as_view(), name='register-confirm'), url(r'^register/done/$', RegisterDoneView.as_view(), name='register-done'), url(r'^oauth2/authorize/$', OAuthAuthorizationView.as_view(), name="authorize"), url(r'^oauth2/token/$', TokenView.as_view(), name="token"), url(r'^password/reset/$', 'django.contrib.auth.views.password_reset', {'post_reset_redirect': '/password/reset/done/', 'template_name': 'sso/password_reset_form.html'}, name="password-reset"), url(r'^password/reset/done/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'sso/password_reset_done.html'}), url(r'^password/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', {'post_reset_redirect': '/password/done/', 'template_name': 'sso/password_reset_confirm.html'}, name='password_reset_confirm'), url(r'^password/done/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'sso/password_reset_complete.html'}), url('', include('social.apps.django_app.urls', namespace='social')),
from django.contrib import admin from django.urls import path, include from oauth2_provider.views import AuthorizationView, TokenView, RevokeTokenView, IntrospectTokenView admin.site.site_header = "AI Administration" admin.site.site_title = "AI Administration" auth_urls = [ path("authorize/", AuthorizationView.as_view(), name="authorize"), path("token/", TokenView.as_view(), name="token"), path("revoke_token/", RevokeTokenView.as_view(), name="revoke-token"), path("introspect/", IntrospectTokenView.as_view(), name="introspect"), ] urlpatterns = [ path('admin/', include('admin_honeypot.urls', namespace='admin_honeypot')), path('secret/', admin.site.urls), path('o/', include(auth_urls, namespace='oauth2_provider')), ]
"clusters/latest/<str:game_format>/<str:player_class>/<str:cluster_id>/", ClusterSnapshotUpdateView.as_view(), name="update_cluster_archetype"), # mailchimp path("mailchimp/webhook/", MailchimpWebhookView.as_view(), name="mailchimp_webhook"), # oauth2 path("oauth2/login/", OAuth2LoginView.as_view(), name="oauth2_login"), path("oauth2/authorize/", OAuth2AuthorizeView.as_view(), name="authorize"), path("oauth2/revoke/", OAuth2RevokeView.as_view(), name="oauth2_revoke_access"), path("oauth2/token/", TokenView.as_view(), name="token"), path("oauth2/application/reset_secret/", OAuth2ResetSecretView.as_view(), name="oauth2_reset_secret"), path("oauth2/revoke_all_tokens/", OAuth2RevokeAllTokensView.as_view(), name="oauth2_revoke_all_tokens"), # profiles (currently unused) path("profile/packs/", PackListView.as_view(), name="profile_packs"), path("leaderboards/", LeaderboardsView.as_view(), name="profile_packs"), path("profiles/<int:user_id>/", ProfileView.as_view(), name="profile_packs"), # redirects
def post(self, request): try: grant_type = request.data['grant_type'] except MultiValueDictKeyError: return Response( {'detail': 'Badly built request. grant_type field required'}, status=status.HTTP_400_BAD_REQUEST, content_type='application/json') data = { 'grant_type': grant_type, 'client_id': os.environ['CLIENT_ID'], 'client_secret': os.environ['CLIENT_SECRET'] } if (grant_type == 'password'): try: username = request.data['username'] password = request.data['password'] except MultiValueDictKeyError: return Response( { 'detail': 'Badly built request. Required fields: username, password' }, status=status.HTTP_400_BAD_REQUEST, content_type='application/json') try: user_data = Profile.objects.get( username__iexact=username) #get the user data except Profile.DoesNotExist: return Response( {'detail': f'Username {username} does not exist'}, status=status.HTTP_404_NOT_FOUND, content_type='application/json') data = { **data, 'username': user_data.username, 'password': password } if grant_type == 'refresh_token': try: data['refresh_token'] = request.data['refresh_token'] except MultiValueDictKeyError: return Response({'detail': 'Missing refresh_token'}, status=status.HTTP_400_BAD_REQUEST) new_req = factory.post('/o/token.json', data) accestoken_view = TokenView.as_view() response = accestoken_view(new_req) if (response.status_code == status.HTTP_200_OK and grant_type == 'password'): #append user_data on first login user_dict = { 'user_data': { 'id': user_data.id, 'username': user_data.username, 'email': user_data.email, 'first_name': user_data.first_name, 'last_name': user_data.last_name } } response.content = json.dumps({ **json.loads(response.content), **user_dict }) return response
from django.views.decorators.csrf import csrf_exempt from skynet_resources.decorators import token_check from oauth2_provider.views import TokenView from skynet_resources import views from django.urls import path urlpatterns = [ path('o/token/', csrf_exempt(token_check(TokenView.as_view())), name='token'), path('devices/', views.DevicesView.as_view(), name='devices'), path('devices/<int:device_id>/', views.DevicesView.as_view(), name='specific_device'), path('rooms/', views.RoomsView.as_view(), name='rooms'), path('rooms/<int:room_id>/', views.RoomsView.as_view(), name='specific_room') ]
from django.conf.urls import url from oauth2_provider.views import AuthorizationView, TokenView from .views import ( ApplicationCreateView, ApplicationDeleteView, ApplicationDetailView, ApplicationEditView, ApplicationListView, ) urlpatterns = [ url(r"^applications/$", ApplicationListView.as_view(), name="list"), url(r"^applications/(?P<pk>\d+)/$", ApplicationDetailView.as_view(), name="detail"), url(r"^applications/new/$", ApplicationCreateView.as_view(), name="create"), url(r"^applications/(?P<pk>\d+)/edit/$", ApplicationEditView.as_view(), name="edit"), url( r"^applications/(?P<pk>\d+)/delete/$", ApplicationDeleteView.as_view(), name="delete", ), url(r"^authorize/$", AuthorizationView.as_view(), name="authorize"), url(r"^token/$", TokenView.as_view(), name="token"), ]
from django.contrib import admin from django.urls import include from django.urls import path from oauth2_provider.views import TokenView urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include('api.v1.urls')), path('token/', TokenView.as_view()), ]