Skip to content

Decoded JWT Token results in invalid content in newer versions #12329

Closed
@madduci

Description

@madduci

Describe the bug
We use Spring Security for OAuth2 login using Keycloak. Until Spring Security 5.7.5 the JWT Token validation has worked perfectly.
Since the update at 5.8.0, but also using the newer version, 6.0.0, it stopped working, producing an odd format.

Spring Security 5.7.5:
jwt.getClaimAsString("resource_access") produces {"notification-entry-service":{"roles":["disease-notification-sender"]}}

Spring Security 5.8.0+:
jwt.getClaimAsString("resource_access") produces {notification-entry-service={roles=[disease-notification-sender]}}

This happens by simply updating the dependency in the project, without touching/modifying the existing code.

To Reproduce
Setup Spring Security 5.8. 0with OAuth2 and JWT.

Expected behavior
The JWT parsing should not change behaviour (not even reported in the Changelog here - https://docs.spring.io/spring-security/reference/5.8/whats-new.html)

Sample

Could not be provided

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions