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

   ### What changes were proposed in this pull request?
   
   Add a `default void initialize(Config config) {}` method to 
`PrincipalMapper` and `GroupMapper` interfaces, following the same lifecycle 
pattern already used by `OAuthTokenValidator` and `Authenticator`.
   
   Changes:
   - Add `default void initialize(Config config) {}` to `PrincipalMapper`
   - Add `default void initialize(Config config) {}` to `GroupMapper`
   - Update `PrincipalMapperFactory` and `GroupMapperFactory` to accept 
`Config` and call `initialize()` after construction
   - Update `JwksTokenValidator`, `StaticSignKeyValidator`, and 
`KerberosAuthenticator` to pass `Config` to factories
   - Add tests verifying `initialize()` is called for custom mapper 
implementations
   
   ### Why are the changes needed?
   
   Custom `PrincipalMapper` and `GroupMapper` implementations loaded via FQCN 
have no way to receive server configuration. The factories instantiate them via 
no-arg constructor but never pass config, unlike `OAuthTokenValidator` and 
`Authenticator` which both have `initialize(Config config)` called after 
construction.
   
   This gap prevents building config-driven mappers (e.g., a static mapping 
table for Azure AD service principal GUIDs to friendly names).
   
   ### Does this PR introduce _any_ user-facing change?
   
   No breaking changes. The `initialize(Config)` method is a default no-op, so 
existing custom implementations continue to work unchanged. Custom mappers can 
now optionally override `initialize(Config)` to receive configuration.
   
   ### How was this patch tested?
   
   - Added `TestCustomMapper` / `TestCustomGroupMapper` inner classes in 
existing factory tests
   - Added `testCustomMapperInitializeCalledWithConfig` tests verifying 
`initialize()` is called with the correct `Config` instance
   - All existing tests continue to pass
   - `./gradlew :core:test :server-common:compileJava` — BUILD SUCCESSFUL


-- 
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