Skip to content

Commit 1535949

Browse files
realsuayipdopry
authored andcommitted
Fix possible crash in validator when 'client' key is mentioned in request body
1 parent ef7ca6d commit 1535949

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

oauth2_provider/oauth2_validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def _load_application(self, client_id, request):
207207
assert hasattr(request, "client"), '"request" instance has no "client" attribute'
208208

209209
try:
210-
request.client = request.client or Application.objects.get(client_id=client_id)
210+
if not isinstance(request.client, Application):
211+
request.client = Application.objects.get(client_id=client_id)
211212
# Check that the application can be used (defaults to always True)
212213
if not request.client.is_usable(request):
213214
log.debug("Failed body authentication: Application %r is disabled" % (client_id))

0 commit comments

Comments
 (0)