Some endpoints for testing authentication
This commit is contained in:
parent
03a7eda48e
commit
b2a64e4227
|
@ -23,4 +23,6 @@ urlpatterns = [
|
||||||
path('oauth/', include('oauth2_provider.urls', namespace='oauth2_provider')),
|
path('oauth/', include('oauth2_provider.urls', namespace='oauth2_provider')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('scim/v2/', include('django_scim.urls')),
|
path('scim/v2/', include('django_scim.urls')),
|
||||||
|
path('api/hello/', views.ApiEndpoint.as_view()),
|
||||||
|
path('secret/', views.secret_page, name='secret'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from oauth2_provider.views.generic import ProtectedResourceView
|
||||||
|
|
||||||
|
|
||||||
class AuthView(TemplateView):
|
class AuthView(TemplateView):
|
||||||
template_name = "index.html"
|
template_name = "index.html"
|
||||||
|
|
||||||
|
|
||||||
|
class ApiEndpoint(ProtectedResourceView):
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
return HttpResponse('Hello world!')
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def secret_page(request, *args, **kwargs):
|
||||||
|
return HttpResponse('Secret contents!', status=200)
|
||||||
|
|
Loading…
Reference in New Issue