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>>
ClaimTypeConverter
Constructor and Description |
---|
MappedJwtClaimSetConverter(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
Constructs a
MappedJwtClaimSetConverter with the provided arguments
This will completely replace any set of default converters. |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
convert(java.util.Map<java.lang.String,java.lang.Object> claims) |
static MappedJwtClaimSetConverter |
withDefaults(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
Construct a
MappedJwtClaimSetConverter , overriding individual claim
converters with the provided Map of Converter s. |
public MappedJwtClaimSetConverter(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
MappedJwtClaimSetConverter
with the provided arguments
This will completely replace any set of default converters.claimTypeConverters
- The Map
of converters to usepublic static MappedJwtClaimSetConverter withDefaults(java.util.Map<java.lang.String,org.springframework.core.convert.converter.Converter<java.lang.Object,?>> claimTypeConverters)
MappedJwtClaimSetConverter
, overriding individual claim
converters with the provided Map
of Converter
s.
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 underlying
Map
of converters, see MappedJwtClaimSetConverter(Map)
.claimTypeConverters
- MappedJwtClaimSetConverter
that contains the converters provided,
plus any defaults that were not overridden.public java.util.Map<java.lang.String,java.lang.Object> convert(java.util.Map<java.lang.String,java.lang.Object> claims)
convert
in interface org.springframework.core.convert.converter.Converter<java.util.Map<java.lang.String,java.lang.Object>,java.util.Map<java.lang.String,java.lang.Object>>