Skip to content

Authentication backend get_userinfo incorrectly assumes the endpoint responds with application/json #517

@sergei-maertens

Description

@sergei-maertens

return user_response.json()

This line tries to decode the response content as JSON, which is one of the ways this endpoint may be implemented. The other way is that it responds with a JWT, having a Content-Type header of application/jwt;charset=utf-8 and that fails to decode as JSON, as the JWT itself needs to be processed.

Environment details:

  • OS: Arch Linux
  • Python: 3.10
  • Django: 3.2 LTS
  • mozilla-django-oidc: 3.0.0

How to reproduce:

  • Use an OIDC_OP_USER_ENDPOINT that responds with a JWT
  • Authenticate using OIDC
  • Observe JSONDecodeError crash

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions