OIDC extension rejects RFC 9068 access tokens (`typ: at+jwt`) with client credentials

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:

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!

Hi @Yvain

Today I encountered the same problem and I think it’s a bug.

Did you open a Jira ticket or find a work around?

Logging

DEBUG  [authentication.JwtAuthenticationProvider] - Failed to authenticate since the JWT was invalid
DEBUG  [authentication.ProviderManager] - Authentication failed with provider JwtAuthenticationProvider since An error occurred while attempting to decode the Jwt: the given typ value needs to be one of [JWT]
WARN   [geoserver.security] - Failed login, user 

Environment

  • GeoServer 3.0.2
  • OIDC extension
  • Identity provider: ASP.NET Core + Duende IdentityServer

Hi @Martijnk ,

I didn’t open a Jira issue because I don’t have permission. As I understand it, the issue needs to be confirmed here first.

My current workaround is token introspection: I’ve configured GeoServer to validate the token against my identity provider.