Class MappedJwtClaimSetConverter
- java.lang.Object
-
- org.springframework.security.oauth2.jwt.MappedJwtClaimSetConverter
-
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>>
public final class MappedJwtClaimSetConverter extends java.lang.Object implements org.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>>Converts a JWT claim set, claim by claim. Can be configured with custom converters by claim name.- Since:
- 5.1
- See Also:
ClaimTypeConverter
-
-
Constructor Summary
Constructors Constructor Description MappedJwtClaimSetConverter(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)Constructs aMappedJwtClaimSetConverterwith the provided arguments This will completely replace any set of default converters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>convert(java.util.Map<java.lang.String,java.lang.Object> claims)static MappedJwtClaimSetConverterwithDefaults(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)Construct aMappedJwtClaimSetConverter, overriding individual claim converters with the providedMapofConverters.
-
-
-
Constructor Detail
-
MappedJwtClaimSetConverter
public MappedJwtClaimSetConverter(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
Constructs aMappedJwtClaimSetConverterwith the provided arguments This will completely replace any set of default converters.- Parameters:
claimTypeConverters- TheMapof converters to use
-
-
Method Detail
-
withDefaults
public static MappedJwtClaimSetConverter withDefaults(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
Construct aMappedJwtClaimSetConverter, overriding individual claim converters with the providedMapofConverters. For example, the following would give an instance that is configured with only the default claim converters:MappedJwtClaimSetConverter.withDefaults(Collections.emptyMap());Or, the following would supply a custom converter for the subject, leaving the other defaults in place:MappedJwtClaimsSetConverter.withDefaults( Collections.singletonMap(JwtClaimNames.SUB, new UserDetailsServiceJwtSubjectConverter()));To completely replace the underlyingMapof converters, seeMappedJwtClaimSetConverter(Map).- Parameters:
claimTypeConverters-- Returns:
- An instance of
MappedJwtClaimSetConverterthat contains the converters provided, plus any defaults that were not overridden.
-
convert
public java.util.Map<java.lang.String,java.lang.Object> convert(java.util.Map<java.lang.String,java.lang.Object> claims)
- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>>
-
-