| 9 | |
| 10 | |
| 11 | class SkeletonValidator(RequestValidator): |
| 12 | |
| 13 | # Ordered roughly in order of appearance in the authorization grant flow |
| 14 | |
| 15 | # Pre- and post-authorization. |
| 16 | |
| 17 | def validate_client_id(self, client_id, request, *args, **kwargs): |
| 18 | # Simple validity check, does client exist? Not banned? |
| 19 | pass |
| 20 | |
| 21 | def validate_redirect_uri(self, client_id, redirect_uri, request, *args, **kwargs): |
| 22 | # Is the client allowed to use the supplied redirect_uri? i.e. has |
| 23 | # the client previously registered this EXACT redirect uri. |
| 24 | pass |
| 25 | |
| 26 | def get_default_redirect_uri(self, client_id, request, *args, **kwargs): |
| 27 | # The redirect used if none has been supplied. |
| 28 | # Prefer your clients to pre register a redirect uri rather than |
| 29 | # supplying one on each authorization request. |
| 30 | pass |
| 31 | |
| 32 | def validate_scopes(self, client_id, scopes, client, request, *args, **kwargs): |
| 33 | # Is the client allowed to access the requested scopes? |
| 34 | pass |
| 35 | |
| 36 | def get_default_scopes(self, client_id, request, *args, **kwargs): |
| 37 | # Scopes a client will authorize for if none are supplied in the |
| 38 | # authorization request. |
| 39 | pass |
| 40 | |
| 41 | def validate_response_type(self, client_id, response_type, client, request, *args, **kwargs): |
| 42 | # Clients should only be allowed to use one type of response type, the |
| 43 | # one associated with their one allowed grant type. |
| 44 | # In this case it must be "code". |
| 45 | pass |
| 46 | |
| 47 | # Post-authorization |
| 48 | |
| 49 | def save_authorization_code(self, client_id, code, request, *args, **kwargs): |
| 50 | # Remember to associate it with request.scopes, request.redirect_uri |
| 51 | # request.client and request.user (the last is passed in |
| 52 | # post_authorization credentials, i.e. { 'user': request.user}. |
| 53 | pass |
| 54 | |
| 55 | # Token request |
| 56 | |
| 57 | def client_authentication_required(self, request, *args, **kwargs): |
| 58 | # Check if the client provided authentication information that needs to |
| 59 | # be validated, e.g. HTTP Basic auth |
| 60 | pass |
| 61 | |
| 62 | def authenticate_client(self, request, *args, **kwargs): |
| 63 | # Whichever authentication method suits you, HTTP Basic might work |
| 64 | pass |
| 65 | |
| 66 | def authenticate_client_id(self, client_id, request, *args, **kwargs): |
| 67 | # The client_id must match an existing public (non-confidential) client |
| 68 | pass |
no outgoing calls
no test coverage detected
searching dependent graphs…