Class JwksUriSignatureFactory
java.lang.Object
io.micronaut.security.oauth2.client.JwksUriSignatureFactory
Factory to create
ReactiveJwksSignature beans for the OpenIdProviderMetadata.getJwksUri() of OpenID clients.
The beans are only created for the AuthenticationMode.IDTOKEN authentication mode, where the
ID token issued by the provider is the request credential. In any other authentication mode, tokens signed by the provider's keys, such
as ID tokens issued to other clients, must not authenticate requests. The ID token obtained during the authorization code flow is
validated against the provider's JWKS independently of these beans. No bean is created for a disabled OAuth 2.0 client.
The key set of a provider is bound to the issuer of that provider (see JwksSignatureConfiguration.getIssuer()),
so that a token whose iss claim names one provider cannot be verified with the keys of another provider.
- Since:
- 1.3.0
- Author:
- Sergio del Amo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateJwksSignatureConfiguration(OpenIdClientConfiguration openIdClientConfiguration, io.micronaut.context.BeanProvider<DefaultOpenIdProviderMetadata> openIdProviderMetadata, ExecutorService executorService, JwksClientConfiguration jwksClientConfiguration) Creates aJwksSignatureConfigurationfor thejwks_uriexposed via the OpenID configuration of the client.
-
Constructor Details
-
JwksUriSignatureFactory
public JwksUriSignatureFactory(io.micronaut.context.BeanContext beanContext) - Parameters:
beanContext- The bean context
-
-
Method Details
-
createJwksSignatureConfiguration
@Requires(property="micronaut.security.authentication",value="idtoken") @Requires(condition=OauthClientEnabledCondition.class) @EachBean(OpenIdClientConfiguration.class) public JwksSignatureConfiguration createJwksSignatureConfiguration(@Parameter OpenIdClientConfiguration openIdClientConfiguration, @Parameter io.micronaut.context.BeanProvider<DefaultOpenIdProviderMetadata> openIdProviderMetadata, @Named("blocking") ExecutorService executorService, JwksClientConfiguration jwksClientConfiguration) Creates aJwksSignatureConfigurationfor thejwks_uriexposed via the OpenID configuration of the client. The configuration is created for every enabled OpenID client, even if the OpenID configuration could not be fetched at startup, so that an unreachable provider never leaves the application without signature configurations. Thejwks_uriand the issuer come from the provider metadata: the one already created at startup, or else one resolved on the blocking executor, seeOpenIdProviderJwksSignatureConfiguration.- Parameters:
openIdClientConfiguration- The OpenID client configurationopenIdProviderMetadata- The open id provider metadataexecutorService- Executor used to resolve the provider metadata when it was not created at startupjwksClientConfiguration- JWKS client configuration, whose failure back-off bounds how often the provider metadata is requested after a failure- Returns:
- a
JwksSignatureConfigurationpointed to the jwks_uri exposed via OpenID configuration and bound to the issuer of the OpenID client
-