Class JsonPathJwtConverter
java.lang.Object
org.bremersee.spring.security.oauth2.server.resource.authentication.JsonPathJwtConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,org.springframework.security.authentication.AbstractAuthenticationToken>
public class JsonPathJwtConverter
extends Object
implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,org.springframework.security.authentication.AbstractAuthenticationToken>
The json path jwt converter.
- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionJsonPathJwtConverter(String nameJsonPath, String firstNameJsonPath, String lastNameJsonPath, String emailJsonPath, String rolesJsonPath, boolean rolesValueList, String rolesValueSeparator, org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper) Instantiates a new Json path jwt converter. -
Method Summary
Modifier and TypeMethodDescriptionconvert(org.springframework.security.oauth2.jwt.Jwt source) Gets authorities from list.Gets authorities from value.protected StringgetEmail(JsonPathJwtParser parser) Gets email.protected StringgetFirstName(JsonPathJwtParser parser) Gets first name.protected Collection<? extends org.springframework.security.core.GrantedAuthority> Gets granted authorities.protected StringgetLastName(JsonPathJwtParser parser) Gets last name.protected StringgetUsername(org.springframework.security.oauth2.jwt.Jwt source, JsonPathJwtParser parser) Gets username.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
JsonPathJwtConverter
public JsonPathJwtConverter(String nameJsonPath, String firstNameJsonPath, String lastNameJsonPath, String emailJsonPath, String rolesJsonPath, boolean rolesValueList, String rolesValueSeparator, org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper) Instantiates a new Json path jwt converter.- Parameters:
nameJsonPath- the name json pathfirstNameJsonPath- the first name json pathlastNameJsonPath- the last name json pathemailJsonPath- the email json pathrolesJsonPath- the roles json pathrolesValueList- the roles value listrolesValueSeparator- the roles value separatorauthoritiesMapper- the authorities mapper
-
-
Method Details
-
convert
@NonNull public NormalizedJwtAuthenticationToken convert(@NonNull org.springframework.security.oauth2.jwt.Jwt source) - Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,org.springframework.security.authentication.AbstractAuthenticationToken>
-
getGrantedAuthorities
protected Collection<? extends org.springframework.security.core.GrantedAuthority> getGrantedAuthorities(JsonPathJwtParser parser) Gets granted authorities.- Parameters:
parser- the parser- Returns:
- the granted authorities
-
getAuthoritiesFromList
Gets authorities from list.- Parameters:
parser- the parser- Returns:
- the authorities from list
-
getAuthoritiesFromValue
Gets authorities from value.- Parameters:
parser- the parser- Returns:
- the authorities from value
-
getUsername
protected String getUsername(org.springframework.security.oauth2.jwt.Jwt source, JsonPathJwtParser parser) Gets username.- Parameters:
source- the sourceparser- the parser- Returns:
- the username
-
getFirstName
Gets first name.- Parameters:
parser- the parser- Returns:
- the first name
-
getLastName
Gets last name.- Parameters:
parser- the parser- Returns:
- the last name
-
getEmail
Gets email.- Parameters:
parser- the parser- Returns:
- the email
-