You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "bharos (via GitHub)" <gi...@apache.org> on 2026/06/03 15:48:19 UTC

[PR] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11412] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #11411:
URL: https://github.com/apache/gravitino/pull/11411#issuecomment-4618474119

   > > @lasdf1234 Could u take a look again?
   > 
   > Got.I reviewed it and have no other comments.
   
   You can approve this pull request.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11412] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11411:
URL: https://github.com/apache/gravitino/pull/11411#issuecomment-4616897247

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|66.76% **`+0.07%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|89.09%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|46.82%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|3.66%|:red_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|10.04%|:red_circle:|
   |catalog-fileset|80.33%|:green_circle:|
   |catalog-glue|66.08%|:green_circle:|
   |catalog-hive|79.33%|:green_circle:|
   |catalog-jdbc-clickhouse|80.02%|:green_circle:|
   |catalog-jdbc-common|45.31%|:green_circle:|
   |catalog-jdbc-doris|80.28%|:green_circle:|
   |catalog-jdbc-hologres|54.03%|:green_circle:|
   |catalog-jdbc-mysql|79.23%|:green_circle:|
   |catalog-jdbc-oceanbase|78.38%|:green_circle:|
   |catalog-jdbc-postgresql|82.29%|:green_circle:|
   |catalog-jdbc-starrocks|78.51%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|44.89%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.66%|:green_circle:|
   |catalog-lakehouse-paimon|79.29%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.51%|:green_circle:|
   |client-java|77.91%|:green_circle:|
   |common|49.99%|:green_circle:|
   |core|82.49% **`-0.01%`**|:green_circle:|
   |filesystem-hadoop3|76.97%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|41.2%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-common|10.39%|:red_circle:|
   |hive-metastore-common|53.26%|:green_circle:|
   |iceberg-common|56.54%|:green_circle:|
   |iceberg-rest-server|72.76%|:green_circle:|
   |idp-basic|85.99%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|66.17%|:green_circle:|
   |lance-common|20.83%|:red_circle:|
   |lance-rest-server|60.27%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|82.95%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|85.73%|:green_circle:|
   |server-common|73.13% **`+1.92%`**|:green_circle:|
   |spark|32.79%|:red_circle:|
   |spark-common|37.99%|:red_circle:|
   |trino-connector|39.44%|:red_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |core|[GroupMapper.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/core/src/main/java/org/apache/gravitino/auth/GroupMapper.java)|100.0%|:green_circle:|
   ||[PrincipalMapper.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/core/src/main/java/org/apache/gravitino/auth/PrincipalMapper.java)|100.0%|:green_circle:|
   ||[PrincipalMapperFactory.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/core/src/main/java/org/apache/gravitino/auth/PrincipalMapperFactory.java)|76.92%|:green_circle:|
   ||[GroupMapperFactory.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/core/src/main/java/org/apache/gravitino/auth/GroupMapperFactory.java)|72.22%|:green_circle:|
   |server-common|[StaticSignKeyValidator.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/server-common/src/main/java/org/apache/gravitino/server/authentication/StaticSignKeyValidator.java)|93.51%|:green_circle:|
   ||[JwksTokenValidator.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/server-common/src/main/java/org/apache/gravitino/server/authentication/JwksTokenValidator.java)|93.1%|:green_circle:|
   ||[KerberosAuthenticator.java](https://github.com/bharos/gravitino/blob/28ea29bdccbae37c481a4731ba2c76f69d1ebf1f/server-common/src/main/java/org/apache/gravitino/server/authentication/KerberosAuthenticator.java)|85.9%|:green_circle:|
   
   </details>


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11412] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11411:
URL: https://github.com/apache/gravitino/pull/11411#issuecomment-4618357721

   > @lasdf1234 Could u take a look again?
   
   Got.I reviewed it and have no other comments.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11412] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #11411:
URL: https://github.com/apache/gravitino/pull/11411#issuecomment-4618278537

   @lasdf1234 Could u take a look again?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#11412] feat(auth): Add initialize(Config) to PrincipalMapper and GroupMapper interfaces [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi merged PR #11411:
URL: https://github.com/apache/gravitino/pull/11411


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org