lasdf1234 opened a new pull request, #13972:
URL: https://github.com/apache/gravitino/pull/13972

   ### What changes were proposed in this pull request?
   
   `JwksTokenValidator.validateToken` now rethrows `UnauthorizedException` from 
`principalMapper.map` as-is, instead of wrapping every failure as `"JWKS JWT 
validation error"`.
   
   ### Why are the changes needed?
   
   Custom `PrincipalMapper` implementations may throw `UnauthorizedException` 
with a deliberate client message (for example rejecting a disabled identity). 
On the JWKS path that message was overwritten. The static-key path already 
preserves `UnauthorizedException` via `OAuth2TokenAuthenticator`.
   
   Fix: #13971
   
   Related enterprise follow-up: datastrato/gravitino-enterprise#2024 / 
datastrato/gravitino-enterprise#2742
   
   ### Does this PR introduce _any_ user-facing change?
   
   When a configured `PrincipalMapper` throws `UnauthorizedException`, JWKS 
OAuth authentication returns that exception's message unchanged.
   
   ### How was this patch tested?
   
   - `./gradlew :server-common:test --tests 
org.apache.gravitino.server.authentication.TestJwksTokenValidator.testValidateTokenPreservesUnauthorizedExceptionFromPrincipalMapper`
   
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to