io.quarkus.oidc.runtime.TenantConfigBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-oidc Show documentation
Show all versions of quarkus-oidc Show documentation
Secure your applications with OpenID Connect Adapter and IDP such as Keycloak
package io.quarkus.oidc.runtime;
import java.util.Map;
import java.util.function.Function;
import jakarta.enterprise.context.spi.CreationalContext;
import io.quarkus.arc.BeanDestroyer;
import io.quarkus.oidc.OidcTenantConfig;
import io.smallrye.mutiny.Uni;
public class TenantConfigBean {
private final Map staticTenantsConfig;
private final Map dynamicTenantsConfig;
private final TenantConfigContext defaultTenant;
private final Function> tenantConfigContextFactory;
public TenantConfigBean(
Map staticTenantsConfig,
Map dynamicTenantsConfig,
TenantConfigContext defaultTenant,
Function> tenantConfigContextFactory) {
this.staticTenantsConfig = staticTenantsConfig;
this.dynamicTenantsConfig = dynamicTenantsConfig;
this.defaultTenant = defaultTenant;
this.tenantConfigContextFactory = tenantConfigContextFactory;
}
public Map getStaticTenantsConfig() {
return staticTenantsConfig;
}
public TenantConfigContext getDefaultTenant() {
return defaultTenant;
}
public Function> getTenantConfigContextFactory() {
return tenantConfigContextFactory;
}
public Map getDynamicTenantsConfig() {
return dynamicTenantsConfig;
}
public static class Destroyer implements BeanDestroyer {
@Override
public void destroy(TenantConfigBean instance, CreationalContext creationalContext,
Map params) {
if (instance.defaultTenant != null && instance.defaultTenant.provider != null) {
instance.defaultTenant.provider.close();
}
for (var i : instance.staticTenantsConfig.values()) {
if (i.provider != null) {
i.provider.close();
}
}
for (var i : instance.dynamicTenantsConfig.values()) {
if (i.provider != null) {
i.provider.close();
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy