Class HttpClientJwksClient
java.lang.Object
io.micronaut.security.token.jwt.signature.jwks.HttpClientJwksClient
- All Implemented Interfaces:
JwksClient
@Singleton
@Requires(beans=io.micronaut.http.client.HttpClientRegistry.class) @Requires(property="micronaut.security.token.jwt.signatures.jwks-client.http-client.enabled",value="true",defaultValue="true")
public class HttpClientJwksClient
extends Object
implements JwksClient
Implementation of
JwksClient that uses the Micronaut HttpClient.
If a named service-specific client is configured (i.e. with "micronaut.http.services.foo.*") with a name that matches the name used for security configuration (i.e. "micronaut.security.token.jwt.signatures.jwks.foo.*") then that client will be used for the request. Otherwise, a default client will be used.
Neither the default client nor a named service-specific client follows redirects: the settings of the
service configuration are copied but micronaut.http.services.foo.follow-redirects is ignored.
- Since:
- 4.5.0
- Author:
- Jeremy Grelle
-
Constructor Summary
ConstructorsConstructorDescriptionHttpClientJwksClient(io.micronaut.context.BeanContext beanContext, io.micronaut.http.client.HttpClientRegistry<io.micronaut.http.client.HttpClient> clientRegistry, io.micronaut.http.client.HttpClientConfiguration defaultClientConfiguration) -
Method Summary
-
Constructor Details
-
HttpClientJwksClient
public HttpClientJwksClient(io.micronaut.context.BeanContext beanContext, io.micronaut.http.client.HttpClientRegistry<io.micronaut.http.client.HttpClient> clientRegistry, io.micronaut.http.client.HttpClientConfiguration defaultClientConfiguration) - Parameters:
beanContext- BeanContextclientRegistry- HTTP Client RegistrydefaultClientConfiguration- Default HTTP Client Configuration. Its settings are copied, but the client created from it never follows redirects.
-
-
Method Details
-
load
@SingleResult public org.reactivestreams.Publisher<String> load(@Nullable String providerName, @NonNull String url) throws io.micronaut.http.client.exceptions.HttpClientException Description copied from interface:JwksClientLoads remote Json Web Key Set content over http.- Specified by:
loadin interfaceJwksClient- Parameters:
providerName- The jwks provider nameurl- The URL for loading the remote JWK Set- Returns:
- The JWK Set response body content
- Throws:
io.micronaut.http.client.exceptions.HttpClientException
-
getClient
Retrieves an HTTP client for the given provider.- Parameters:
providerName- The provider name- Returns:
- An HTTP client to use to send the JWKS request
-
close
@PreDestroy public void close()Closes the HTTP clients this bean created.- Since:
- 5.5.2
-