Class HttpClientJwksClient

java.lang.Object
io.micronaut.security.token.jwt.signature.jwks.HttpClientJwksClient
All Implemented Interfaces:
JwksClient

@Singleton @Requires(classes=io.micronaut.http.client.HttpClient.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.

Since:
4.5.0
Author:
Jeremy Grelle
  • Constructor Summary

    Constructors
    Constructor
    Description
    HttpClientJwksClient(io.micronaut.context.BeanContext beanContext, io.micronaut.http.client.HttpClientRegistry<io.micronaut.http.client.HttpClient> clientRegistry, io.micronaut.http.client.HttpClientConfiguration defaultClientConfiguration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected io.micronaut.http.client.HttpClient
    getClient(@Nullable String providerName)
    Retrieves an HTTP client for the given provider.
    org.reactivestreams.Publisher<String>
    load(@Nullable String providerName, @NonNull String url)
    Loads remote Json Web Key Set content over http.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - BeanContext
      clientRegistry - HTTP Client Registry
      defaultClientConfiguration - Default HTTP Client Configuration
  • Method Details

    • load

      @SingleResult public org.reactivestreams.Publisher<String> load(@Nullable @Nullable String providerName, @NonNull @NonNull String url) throws io.micronaut.http.client.exceptions.HttpClientException
      Description copied from interface: JwksClient
      Loads remote Json Web Key Set content over http.
      Specified by:
      load in interface JwksClient
      Parameters:
      providerName - The jwks provider name
      url - The URL for loading the remote JWK Set
      Returns:
      The JWK Set response body content
      Throws:
      io.micronaut.http.client.exceptions.HttpClientException
    • getClient

      protected io.micronaut.http.client.HttpClient getClient(@Nullable @Nullable String providerName)
      Retrieves an HTTP client for the given provider.
      Parameters:
      providerName - The provider name
      Returns:
      An HTTP client to use to send the JWKS request