Class ConfigurableOidcIdTokenDecoderFactory

java.lang.Object
net.optionfactory.spring.authentication.code.ConfigurableOidcIdTokenDecoderFactory
All Implemented Interfaces:
org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration>

public final class ConfigurableOidcIdTokenDecoderFactory extends Object implements org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration>
same as OidcIdTokenDecoderFactory, but so we can configure the clienthHttpRequestFactory used by NimbusJwtDecoder
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfigurableOidcIdTokenDecoderFactory(org.springframework.http.client.ClientHttpRequestFactory oauthHttpRequestFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.jwt.JwtDecoder
    createDecoder(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration)
     
    static Map<String,org.springframework.core.convert.converter.Converter<Object,?>>
    Returns the default Converter's used for type conversion of claim values for an OidcIdToken.
    void
    setClaimTypeConverterFactory(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.core.convert.converter.Converter<Map<String,Object>,Map<String,Object>>> claimTypeConverterFactory)
    Sets the factory that provides a Converter used for type conversion of claim values for an OidcIdToken.
    void
    setJwsAlgorithmResolver(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.jose.jws.JwsAlgorithm> jwsAlgorithmResolver)
    Sets the resolver that provides the expected JWS algorithm used for the signature or MAC on the ID Token.
    void
    setJwtValidatorFactory(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt>> jwtValidatorFactory)
    Sets the factory that provides an OAuth2TokenValidator, which is used by the JwtDecoder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigurableOidcIdTokenDecoderFactory

      public ConfigurableOidcIdTokenDecoderFactory(org.springframework.http.client.ClientHttpRequestFactory oauthHttpRequestFactory)
  • Method Details

    • createDefaultClaimTypeConverters

      public static Map<String,org.springframework.core.convert.converter.Converter<Object,?>> createDefaultClaimTypeConverters()
      Returns the default Converter's used for type conversion of claim values for an OidcIdToken.
      Returns:
      a Map of Converter's keyed by claim name
    • createDecoder

      public org.springframework.security.oauth2.jwt.JwtDecoder createDecoder(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration)
      Specified by:
      createDecoder in interface org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration>
    • setJwtValidatorFactory

      public void setJwtValidatorFactory(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.core.OAuth2TokenValidator<org.springframework.security.oauth2.jwt.Jwt>> jwtValidatorFactory)
      Sets the factory that provides an OAuth2TokenValidator, which is used by the JwtDecoder. The default composes JwtTimestampValidator and OidcIdTokenValidator.
      Parameters:
      jwtValidatorFactory - the factory that provides an OAuth2TokenValidator
    • setJwsAlgorithmResolver

      public void setJwsAlgorithmResolver(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.jose.jws.JwsAlgorithm> jwsAlgorithmResolver)
      Sets the resolver that provides the expected JWS algorithm used for the signature or MAC on the ID Token. The default resolves to RS256 for all clients.
      Parameters:
      jwsAlgorithmResolver - the resolver that provides the expected JWS algorithm for a specific client
    • setClaimTypeConverterFactory

      public void setClaimTypeConverterFactory(Function<org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.core.convert.converter.Converter<Map<String,Object>,Map<String,Object>>> claimTypeConverterFactory)
      Sets the factory that provides a Converter used for type conversion of claim values for an OidcIdToken. The default is ClaimTypeConverter for all clients.
      Parameters:
      claimTypeConverterFactory - the factory that provides a Converter used for type conversion of claim values for a specific client