This is an automated email from the ASF dual-hosted git repository.
emaynard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new 10175616 Add Identifier annotation to DefaultActiveRolesProvider
(#1111)
10175616 is described below
commit 101756166090a90072e764d85f29ae3a56362326
Author: Eric Maynard <[email protected]>
AuthorDate: Wed Mar 5 11:22:52 2025 -0800
Add Identifier annotation to DefaultActiveRolesProvider (#1111)
* add identifier
* add producer
* add to config
---
quarkus/defaults/src/main/resources/application.properties | 2 ++
.../apache/polaris/service/quarkus/config/QuarkusProducers.java | 9 +++++++++
.../apache/polaris/service/auth/DefaultActiveRolesProvider.java | 2 ++
3 files changed, 13 insertions(+)
diff --git a/quarkus/defaults/src/main/resources/application.properties
b/quarkus/defaults/src/main/resources/application.properties
index d3a20573..a523b15f 100644
--- a/quarkus/defaults/src/main/resources/application.properties
+++ b/quarkus/defaults/src/main/resources/application.properties
@@ -116,6 +116,8 @@ polaris.rate-limiter.token-bucket.type=default
polaris.rate-limiter.token-bucket.requests-per-second=9999
polaris.rate-limiter.token-bucket.window=PT10S
+polaris.active-roles-provider.type=default
+
polaris.authentication.authenticator.type=default
polaris.authentication.token-service.type=default
polaris.authentication.token-broker.type=rsa-key-pair
diff --git
a/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
b/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
index cbe1cc26..70e262c4 100644
---
a/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
+++
b/quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java
@@ -47,6 +47,7 @@ import
org.apache.polaris.core.persistence.PolarisMetaStoreManager;
import org.apache.polaris.core.persistence.cache.EntityCache;
import
org.apache.polaris.core.persistence.transactional.TransactionalPersistence;
import org.apache.polaris.core.storage.cache.StorageCredentialCache;
+import org.apache.polaris.service.auth.ActiveRolesProvider;
import org.apache.polaris.service.auth.Authenticator;
import org.apache.polaris.service.auth.TokenBrokerFactory;
import org.apache.polaris.service.catalog.api.IcebergRestOAuth2ApiService;
@@ -64,6 +65,7 @@ import
org.apache.polaris.service.quarkus.ratelimiter.QuarkusTokenBucketConfigur
import org.apache.polaris.service.ratelimiter.RateLimiter;
import org.apache.polaris.service.ratelimiter.TokenBucketFactory;
import org.apache.polaris.service.task.TaskHandlerConfiguration;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.context.ThreadContext;
@@ -239,6 +241,13 @@ public class QuarkusProducers {
return new PolarisEntityManager(polarisMetaStoreManager, credentialCache,
entityCache);
}
+ @Produces
+ public ActiveRolesProvider activeRolesProvider(
+ @ConfigProperty(name = "polaris.active-roles-provider.type") String
persistenceType,
+ @Any Instance<ActiveRolesProvider> activeRolesProviders) {
+ return
activeRolesProviders.select(Identifier.Literal.of(persistenceType)).get();
+ }
+
public void closeTaskExecutor(@Disposes @Identifier("task-executor")
ManagedExecutor executor) {
executor.close();
}
diff --git
a/service/common/src/main/java/org/apache/polaris/service/auth/DefaultActiveRolesProvider.java
b/service/common/src/main/java/org/apache/polaris/service/auth/DefaultActiveRolesProvider.java
index 869a27b5..c679cddc 100644
---
a/service/common/src/main/java/org/apache/polaris/service/auth/DefaultActiveRolesProvider.java
+++
b/service/common/src/main/java/org/apache/polaris/service/auth/DefaultActiveRolesProvider.java
@@ -18,6 +18,7 @@
*/
package org.apache.polaris.service.auth;
+import io.smallrye.common.annotation.Identifier;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import java.util.List;
@@ -45,6 +46,7 @@ import org.slf4j.LoggerFactory;
* available roles are active for this request.
*/
@RequestScoped
+@Identifier("default")
public class DefaultActiveRolesProvider implements ActiveRolesProvider {
private static final Logger LOGGER =
LoggerFactory.getLogger(DefaultActiveRolesProvider.class);