Skip to content

Commit

Permalink
Fix possible crash in validator when 'client' key is mentioned in req…
Browse files Browse the repository at this point in the history
…uest body
  • Loading branch information
realsuayip committed Feb 28, 2023
1 parent bd865d6 commit eda18ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion oauth2_provider/oauth2_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def _load_application(self, client_id, request):
assert hasattr(request, "client"), '"request" instance has no "client" attribute'

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

0 comments on commit eda18ca

Please sign in to comment.