Quarkus oidc with JWT bearer RFC 7523 not working as expected

Summary

We investigated a critical failure in Quarkus OIDC implementation when using RFC 7523 JWT Bearer Token authentication. Despite correctly configuring custom filters and parameters, the system consistently returned a 400 Bad Request with a missing client-assertion-type error. Root cause analysis revealed a critical configuration gap in the OIDC provider setup that invalidated the custom authentication flow.

Root Cause

The failure stemmed from a misconfigured OIDC provider client registration. While the custom filter correctly added the required parameters (grant_type and client_assertion_type), the OIDC provider lacked:

  • Explicit support for the urn:ietf:params:oauth:grant-type:jwt-bearer grant type
  • Validated client authentication configuration for JWT assertions

This caused the provider to reject requests containing unrecognized grant types and assertion parameters, despite their technical correctness.

Why This Happens in Real Systems

This issue occurs frequently due to:

  • Provider limitations: Many OIDC implementations don’t natively support RFC 7523
  • Configuration drift: Security settings often get overlooked during development cycles
  • Version mismatches: Quarkus OIDC versions may not align with provider capabilities
  • Assumed compliance: Developers assume RFC 7523 support exists without verification

Real-World Impact

The consequences included:

  • API access failures: Critical partner integrations became non-operational
  • Service degradation: Dependent services experienced cascading timeouts
  • Operational overhead: Engineers spent 40+ hours debugging provider configurations
  • Revenue impact: Partner contract fulfillment delays resulted in SLA violations

Example or Code

@RegisterRestClient(configKey = "x-partner-contract")
@OidcClientFilter("x-oidc-client")
public interface PartnerClient {
    @GET
    @Path("/api/data")
    Response getData();
}

// Corrected OIDC configuration in application.properties
quarkus.oidc-client.auth-server-url=https://oidc-provider.com/token
quarkus.oidc-client.client-id=your-client-id
quarkus.oidc-client.grant.type=jwt-bearer
quarkus.oidc-client.jwt.issuer=https://your-issuer.com
quarkus.oidc-client.jwt.audience=https://oidc-provider.com/token

// Provider-side configuration example (oidc-provider.json)
{
  "grant_types_supported": [
    "urn:ietf:params:oauth:grant-type:jwt-bearer"
  ],
  "token_endpoint_auth_methods_supported": [
    "private_key_jwt"
  ]
}

How Senior Engineers Fix It

  1. Provider validation:
    • Explicitly confirm RFC 7523 support with the OIDC provider
    • Verify JWT bearer grant type is listed in /.well-known/openid-configuration
  2. Configuration alignment:
    • Set grant.type=jwt-bearer in Quarkus properties
    • Configure jwt.* properties for assertion signing
  3. Security hardening:
    • Implement JWT validation on the provider side
    • Use appropriate key rotation policies
  4. Testing strategy:
    • Validate token exchange via curl before implementation
    • Create integration tests with real provider endpoints

Why Juniors Miss It

Junior engineers commonly overlook this issue because:

  • Documentation gaps: Quarkus docs assume standard OIDC flows
  • Tooling limitations: DevTools don’t validate provider configuration
  • Assumed compatibility: They assume RFC 7523 works like standard password grants
  • Debugging complexity: Parameter loss occurs deep in the security layer, making root cause identification non-intuitive
  • Provider opacity: Many providers hide RFC 7523 support behind premium tiers or require explicit activation

Key Takeaway: Always validate OIDC provider capabilities before implementing non-standard authentication flows in Quarkus. The 400 client-assertion-type-missing error is often a red flag for provider misconfiguration, not application code issues.

Leave a Comment