|
2 | 2 |
|
3 | 3 | from django.conf import settings
|
4 | 4 | from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
|
5 |
| -from django.http import HttpResponseForbidden, HttpResponseNotFound |
| 5 | +from django.http import HttpRequest, HttpResponseForbidden, HttpResponseNotFound |
6 | 6 |
|
7 | 7 | from ..exceptions import FatalClientError
|
8 | 8 | from ..scopes import get_scopes_backend
|
@@ -114,6 +114,20 @@ def create_authorization_response(self, request, scopes, credentials, allow):
|
114 | 114 | core = self.get_oauthlib_core()
|
115 | 115 | return core.create_authorization_response(request, scopes, credentials, allow)
|
116 | 116 |
|
| 117 | + def create_device_authorization_response(self, request: HttpRequest): |
| 118 | + """ |
| 119 | + A wrapper method that calls create_device_authorization_response on `server_class` |
| 120 | + instance. |
| 121 | + :param request: The current django.http.HttpRequest object |
| 122 | + """ |
| 123 | + oauth2_settings.EXTRA_SERVER_KWARGS = { |
| 124 | + "verification_uri": oauth2_settings.OAUTH_DEVICE_VERIFICATION_URI, |
| 125 | + "interval": oauth2_settings.DEVICE_FLOW_INTERVAL, |
| 126 | + "user_code_generator": oauth2_settings.OAUTH_DEVICE_USER_CODE_GENERATOR, |
| 127 | + } |
| 128 | + core = self.get_oauthlib_core() |
| 129 | + return core.create_device_authorization_response(request) |
| 130 | + |
117 | 131 | def create_token_response(self, request):
|
118 | 132 | """
|
119 | 133 | A wrapper method that calls create_token_response on `server_class` instance.
|
|
0 commit comments