1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
from django.views.generic import View
from .mixins import (
ClientProtectedResourceMixin,
ProtectedResourceMixin,
ReadWriteScopedResourceMixin,
ScopedResourceMixin,
)
class ProtectedResourceView(ProtectedResourceMixin, View):
"""
Generic view protecting resources by providing OAuth2 authentication out of the box
"""
pass
class ScopedProtectedResourceView(ScopedResourceMixin, ProtectedResourceView):
"""
Generic view protecting resources by providing OAuth2 authentication and Scopes handling
out of the box
"""
pass
class ReadWriteScopedResourceView(ReadWriteScopedResourceMixin, ProtectedResourceView):
"""
Generic view protecting resources with OAuth2 authentication and read/write scopes.
GET, HEAD, OPTIONS http methods require "read" scope. Otherwise "write" scope is required.
"""
pass
class ClientProtectedResourceView(ClientProtectedResourceMixin, View):
"""View for protecting a resource with client-credentials method.
This involves allowing access tokens, Basic Auth and plain credentials in request body.
"""
pass
class ClientProtectedScopedResourceView(ScopedResourceMixin, ClientProtectedResourceView):
"""Impose scope restrictions if client protection fallsback to access token."""
pass
|