Class CustomOidcIdTokenDecoderFactory

java.lang.Object
com.xebialabs.platform.sso.oidc.authentication.CustomOidcIdTokenDecoderFactory
All Implemented Interfaces:
org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration>

public class CustomOidcIdTokenDecoderFactory extends Object implements org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration>
This class is replica of OidcIdTokenDecoderFactory with support for custom rest operations. This should be removed once https://github.com/spring-projects/spring-security/issues/8882 is resolved
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    void
    setRestOperations(org.springframework.web.client.RestOperations restOperations)
    Sets the rest operations used to fetch keys for jwt

    Methods inherited from class java.lang.Object

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

    • CustomOidcIdTokenDecoderFactory

      public CustomOidcIdTokenDecoderFactory()
  • 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
    • setRestOperations

      public void setRestOperations(org.springframework.web.client.RestOperations restOperations)
      Sets the rest operations used to fetch keys for jwt
      Parameters:
      restOperations - the rest template