Skip to content

Commit 5cd9288

Browse files
realsuayipdopry
authored andcommitted
Fix possible crash in validator when 'client' key is mentioned in request body
1 parent 87fef47 commit 5cd9288

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
@@ -219,7 +219,8 @@ def _load_application(self, client_id, request):
219219
assert hasattr(request, "client"), '"request" instance has no "client" attribute'
220220

221221
try:
222-
request.client = request.client or Application.objects.get(client_id=client_id)
222+
if not isinstance(request.client, Application):
223+
request.client = Application.objects.get(client_id=client_id)
223224
# Check that the application can be used (defaults to always True)
224225
if not request.client.is_usable(request):
225226
log.debug("Failed body authentication: Application %r is disabled" % (client_id))

0 commit comments

Comments
 (0)