Title: OIDC extension rejects RFC 9068 access tokens (typ: at+jwt) with client credentials
Hi everyone,
I think I’ve found a bug in the OIDC security extension and would like to confirm it here before opening a Jira ticket.
Environment
- GeoServer 3.0.1
- OIDC extension, client credentials flow
- Identity provider: Asp.net core + openiddict 7.2.0
Problem
When a client authenticates with the client credentials flow, GeoServer rejects the access token. The token’s typ header is at+jwt, as specified in RFC 9068, but GeoServer only accepts JWT.
Bearer error="invalid_token",
error_description="An error occurred while attempting to decode the Jwt:
the given typ value needs to be one of [JWT]",
error_uri="https://tools.ietf.org/html/rfc6750#section-3.1",
resource_metadata="http://localhost:8080/geoserver/.well-known/oauth-protected-resource"
Cause
GeoServer builds its validator with Spring Security’s defaults:
- GeoServer: HttpSecurityConfigurer.java#L158 calls
JwtValidators.createDefault() - Spring: JwtValidators.java#L77 and JwtTypeValidator.java#L55
The default type validator only accepts JWT.
Possible fix
Configure the type validator explicitly:
JwtTypeValidator typeValidator = new JwtTypeValidator("JWT", "at+jwt");
typeValidator.setAllowEmpty(true);
OAuth2TokenValidator<Jwt> validator = JwtValidators.createDefaultWithValidators(typeValidator);
Full disclosure: I’m not a Java developer, and this fix was suggested by an AI coding assistant (Claude Code). I haven’t tested it, so it would be great if someone familiar with the extension could review it. It might also be worth accepting application/at+jwt, since RFC 9068 allows both forms.
Does this look like a bug to you? If so, I’m happy to open the Jira ticket.
Thanks!