@@ -222,17 +222,19 @@ def get_allowed_schemes(self):
222
222
return oauth2_settings .ALLOWED_REDIRECT_URI_SCHEMES
223
223
224
224
def get_cors_header (self , origin ):
225
- ''' Return a proper cors-header for this origin, in the context of this
225
+ """ Return a proper cors-header for this origin, in the context of this
226
226
application.
227
227
:param origin: Origin-url from HTTP-request.
228
228
:raises: Application.NoSuitableOriginFoundError
229
- '''
229
+ """
230
230
parsed_origin = urlparse (origin )
231
231
for allowed_uri in self .redirect_uris .split ():
232
232
parsed_allowed_uri = urlparse (allowed_uri )
233
- if (parsed_allowed_uri .scheme == parsed_origin .scheme and
234
- parsed_allowed_uri .netloc == parsed_origin .netloc and
235
- parsed_allowed_uri .port == parsed_origin .port ):
233
+ if (
234
+ parsed_allowed_uri .scheme == parsed_origin .scheme
235
+ and parsed_allowed_uri .netloc == parsed_origin .netloc
236
+ and parsed_allowed_uri .port == parsed_origin .port
237
+ ):
236
238
return origin
237
239
raise AbstractApplication .NoSuitableOriginFoundError
238
240
@@ -257,10 +259,10 @@ def jwk_key(self):
257
259
return jwk .JWK (kty = "oct" , k = base64url_encode (self .client_secret ))
258
260
raise ImproperlyConfigured ("This application does not support signed tokens" )
259
261
260
-
261
262
class NoSuitableOriginFoundError (Exception ):
262
263
pass
263
264
265
+
264
266
class ApplicationManager (models .Manager ):
265
267
def get_by_natural_key (self , client_id ):
266
268
return self .get (client_id = client_id )
0 commit comments