Skip to content

Incompatibility with Spring Security 5.6 #518

@andrea-pellegatta

Description

@andrea-pellegatta

Describe the bug
I've recently updated spring boot (spring-boot-starter-parent) version from 2.5.6 to 2.6.1.
Spring Boot starter parent contains a dependency to spring-security-oauth2-jose 5.6.0.
When I request the access token, using the authorization code flow, I now get the following error

failed to access class org.springframework.security.oauth2.jwt.JoseHeader from class org.springframework.security.oauth2.server.authorization.authentication.JwtUtils (org.springframework.security.oauth2.jwt.JoseHeader and org.springframework.security.oauth2.server.authorization.authentication.JwtUtils are in unnamed module of loader 'app')

Stacktrace
java.lang.IllegalAccessError: failed to access class org.springframework.security.oauth2.jwt.JoseHeader from class org.springframework.security.oauth2.server.authorization.authentication.JwtUtils (org.springframework.security.oauth2.jwt.JoseHeader and org.springframework.security.oauth2.server.authorization.authentication.JwtUtils are in unnamed module of loader 'app') at org.springframework.security.oauth2.server.authorization.authentication.JwtUtils.headers(JwtUtils.java:46) ~[spring-security-oauth2-authorization-server-0.2.1.jar:0.2.1] at org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeAuthenticationProvider.authenticate(OAuth2AuthorizationCodeAuthenticationProvider.java:174) ~[spring-security-oauth2-authorization-server-0.2.1.jar:0.2.1] at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182) ~[spring-security-core-5.6.0.jar:5.6.0] at org.springframework.security.oauth2.server.authorization.web.OAuth2TokenEndpointFilter.doFilterInternal(OAuth2TokenEndpointFilter.java:165) ~[spring-security-oauth2-authorization-server-0.2.1.jar:0.2.1] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.0.jar:5.6.0] at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.0.jar:5.6.0] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]

Code triggering the error
JwtUtils - headers()

static Builder headers() { return JoseHeader.withAlgorithm(SignatureAlgorithm.RS256); }

The flow was correctly working when I had Spring Boot parent 2.5.6

To Reproduce
spring-authorization-server 0.2.0 (or 0.2.1)
spring-boot-starter-parent 2.6.1
authorization code, request an access token

Expected behavior
the access token is correctly returned

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions