Class JwksSignatureConfigurationProperties

java.lang.Object
io.micronaut.security.token.jwt.signature.jwks.JwksSignatureConfigurationProperties
All Implemented Interfaces:
io.micronaut.core.naming.Named, JwksSignatureConfiguration

@EachProperty("micronaut.security.token.jwt.signatures.jwks") public class JwksSignatureConfigurationProperties extends Object implements JwksSignatureConfiguration
JSON Web Key Set (JWKS) Signature Configuration properties holder.
Since:
1.1.0
Author:
Sergio del Amo
  • Field Details

    • PREFIX

      public static final String PREFIX
      See Also:
    • DEFAULT_KEYTYPE

      @Deprecated(forRemoval=true, since="5.5.2") public static final com.nimbusds.jose.jwk.KeyType DEFAULT_KEYTYPE
      Deprecated, for removal: This API element is subject to removal in a future version.
      No longer used. Since 5.5.2 no key type is applied unless setKeyType(KeyType) is configured, so that keys of any type of the JWKS are matched.
      The default key type.
    • DEFAULT_CACHE_EXPIRATION

      public static final int DEFAULT_CACHE_EXPIRATION
      The default cache expiration.
      See Also:
  • Constructor Details

    • JwksSignatureConfigurationProperties

      public JwksSignatureConfigurationProperties(@Parameter String name)
  • Method Details

    • getName

      public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • getCacheExpiration

      @Deprecated(forRemoval=true, since="4.11.0") public @NonNull Integer getCacheExpiration()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Not used. JWKS is cached via Micronaut Cache. You need an implementation of Micronaut Cache and the cache configuration micronaut.caches.jwks.expire-after-write
      Specified by:
      getCacheExpiration in interface JwksSignatureConfiguration
      Returns:
      The number of seconds to cache the JWKS.
    • setCacheExpiration

      @Deprecated(forRemoval=true, since="4.11.0") public void setCacheExpiration(Integer cacheExpiration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Not used. JWKS is cached via Micronaut Cache. You need an implementation of Micronaut Cache and the cache configuration micronaut.caches.jwks.expire-after-write
      JWKS cache expiration. Default value 60 seconds.
      Parameters:
      cacheExpiration - The expiration
    • getUrl

      @NotNull public @NotNull @NonNull String getUrl()
      Description copied from interface: JwksSignatureConfiguration
      Json Web Key Set endpoint url.
      Specified by:
      getUrl in interface JwksSignatureConfiguration
      Returns:
      URL to the remote JSON Web Key Set.
    • setUrl

      public void setUrl(String url)
      Remote JSON Web Key set url. e.g. https://.../.well-known/jwks.json
      Parameters:
      url - Remote JSON Web Key set url.
    • getKeyType

      public @Nullable com.nimbusds.jose.jwk.KeyType getKeyType()
      Description copied from interface: JwksSignatureConfiguration
      Representation the KeyType for this JWKS signature configuration. KeyType is the kty parameter in a JSON Web Key (JWK). When a key type is returned, only keys of that type are used to verify token signatures; a token signed with a key of another type is not verified, even if that key is part of the JWKS.
      Specified by:
      getKeyType in interface JwksSignatureConfiguration
      Returns:
      Representation the KeyType for this JWKS signature configuration. KeyType is the kty parameter in a JSON Web Key (JWK). null if keys of any type are matched.
    • setKeyType

      public void setKeyType(@Nullable com.nimbusds.jose.jwk.KeyType keyType)
      Representation of the kty parameter in a JSON Web Key (JWK). When set, only keys of this type are used to verify token signatures; a token signed with a key of another type is rejected even if that key is part of the JWKS. Default value (null): keys of any type are matched.
      Parameters:
      keyType - Representation of the kty parameter in a JSON Web Key (JWK).
    • getIssuer

      public @Nullable String getIssuer()
      Description copied from interface: JwksSignatureConfiguration
      The issuer this JSON Web Key Set is bound to. When an issuer is set, a token is only verified with this key set if its iss claim matches the issuer, even if its signature validates against one of the keys. This prevents a key trusted for one identity provider from signing tokens that claim to be issued by another provider.
      Specified by:
      getIssuer in interface JwksSignatureConfiguration
      Returns:
      The issuer the key set is bound to, or null if tokens are verified regardless of their iss claim.
      Since:
      5.5.2
    • setIssuer

      public void setIssuer(@Nullable String issuer)
      Issuer the JSON Web Key Set is bound to. When set, only tokens whose iss claim matches this issuer are verified with this key set. Default value (null): tokens are verified regardless of their iss claim.
      Parameters:
      issuer - Issuer the JSON Web Key Set is bound to. e.g. https://idp.example.com/
      Since:
      5.5.2