io.quarkus.oidc.runtime.OidcConfigurationMetadataProducer 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 jakarta.enterprise.context.RequestScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.inject.Inject;
import io.quarkus.oidc.OIDCException;
import io.quarkus.oidc.OidcConfigurationMetadata;
import io.quarkus.security.identity.SecurityIdentity;
@RequestScoped
public class OidcConfigurationMetadataProducer {
@Inject
TenantConfigBean tenantConfig;
@Inject
SecurityIdentity identity;
@Produces
@RequestScoped
OidcConfigurationMetadata produce() {
OidcConfigurationMetadata configMetadata = null;
configMetadata = (OidcConfigurationMetadata) identity.getAttribute(OidcUtils.CONFIG_METADATA_ATTRIBUTE);
if (configMetadata == null && tenantConfig.getDefaultTenant().oidcConfig.tenantEnabled) {
configMetadata = tenantConfig.getDefaultTenant().provider.getMetadata();
}
if (configMetadata == null) {
throw new OIDCException("OidcConfigurationMetadata can not be injected");
}
return configMetadata;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy