21
21
22
22
class BaseAuthorizationView (LoginRequiredMixin , OAuthLibMixin , View ):
23
23
"""
24
- Implements a generic endpoint to handle *Authorization Requests* as in :rfc:`4.1.1`. The view does not implement
25
- any strategy to determine *authorize/do not authorize* logic.
24
+ Implements a generic endpoint to handle *Authorization Requests* as in :rfc:`4.1.1`. The view
25
+ does not implement any strategy to determine *authorize/do not authorize* logic.
26
26
The endpoint is used in the following flows:
27
- * Authorization code
28
- * Implicit grant
27
+
28
+ * Authorization code
29
+ * Implicit grant
30
+
29
31
"""
30
32
def dispatch (self , request , * args , ** kwargs ):
31
33
self .oauth2_data = {}
32
34
return super (BaseAuthorizationView , self ).dispatch (request , * args , ** kwargs )
33
35
34
36
def error_response (self , error , ** kwargs ):
35
37
"""
36
- Handle errors either by redirecting to redirect_uri with a json in the body containing error details or
37
- providing an error response
38
+ Handle errors either by redirecting to redirect_uri with a json in the body containing
39
+ error details or providing an error response
38
40
"""
39
41
redirect , error_response = super (BaseAuthorizationView , self ).error_response (error , ** kwargs )
40
42
@@ -47,21 +49,23 @@ def error_response(self, error, **kwargs):
47
49
48
50
class AuthorizationView (BaseAuthorizationView , FormView ):
49
51
"""
50
- Implements and endpoint to handle *Authorization Requests* as in :rfc:`4.1.1` and prompting the user with a form
51
- to determine if she authorizes the client application to access her data. This endpoint is reached two times during
52
- the authorization process:
53
- * first receive a ``GET`` request from user asking authorization for a certain client application, a form is served
54
- possibly showing some useful info and prompting for *authorize/do not authorize*.
55
-
56
- * then receive a ``POST`` request possibly after user authorized the access
57
-
58
- Some informations contained in the ``GET`` request and needed to create a Grant token during the ``POST`` request
59
- would be lost between the two steps above, so they are temporary stored in hidden fields on the form.
52
+ Implements and endpoint to handle *Authorization Requests* as in :rfc:`4.1.1` and prompting the
53
+ user with a form to determine if she authorizes the client application to access her data.
54
+ This endpoint is reached two times during the authorization process:
55
+ * first receive a ``GET`` request from user asking authorization for a certain client
56
+ application, a form is served possibly showing some useful info and prompting for
57
+ *authorize/do not authorize*.
58
+
59
+ * then receive a ``POST`` request possibly after user authorized the access
60
+
61
+ Some informations contained in the ``GET`` request and needed to create a Grant token during
62
+ the ``POST`` request would be lost between the two steps above, so they are temporary stored in
63
+ hidden fields on the form.
60
64
A possible alternative could be keeping such informations in the session.
61
65
62
66
The endpoint is used in the followin flows:
63
- * Authorization code
64
- * Implicit grant
67
+ * Authorization code
68
+ * Implicit grant
65
69
"""
66
70
template_name = 'oauth2_provider/authorize.html'
67
71
form_class = AllowForm
@@ -139,9 +143,9 @@ class TokenView(CsrfExemptMixin, OAuthLibMixin, View):
139
143
Implements an endpoint to provide access tokens
140
144
141
145
The endpoint is used in the following flows:
142
- * Authorization code
143
- * Password
144
- * Client credentials
146
+ * Authorization code
147
+ * Password
148
+ * Client credentials
145
149
"""
146
150
server_class = Server
147
151
validator_class = oauth2_settings .OAUTH2_VALIDATOR_CLASS
0 commit comments