Package io.jmix.oidc.jwt
Class JmixJwtAuthenticationConverter
java.lang.Object
io.jmix.oidc.jwt.JmixJwtAuthenticationConverter
- All Implemented Interfaces:
- org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,- org.springframework.security.authentication.AbstractAuthenticationToken> 
public class JmixJwtAuthenticationConverter
extends Object
implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,org.springframework.security.authentication.AbstractAuthenticationToken> 
Converts 
Jwt into Authentication. We cannot use default JwtAuthenticationConverter shipped with Spring
 Security because Jmix requires an instance of UserDetails to be
 set into the SecurityContext. That's why the current converter constructs the JmixOidcUser and sets
 it as Authentication principal.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected OidcPropertiesprotected OidcUserMapperprotected String
- 
Constructor SummaryConstructorsConstructorDescriptionJmixJwtAuthenticationConverter(OidcUserMapper oidcUserMapper, OidcProperties oidcProperties) 
- 
Method SummaryModifier and TypeMethodDescriptionorg.springframework.security.authentication.AbstractAuthenticationTokenconvert(org.springframework.security.oauth2.jwt.Jwt jwt) voidsetUsernameClaimName(String usernameClaimName) Sets the username claim name.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.ConverterandThen
- 
Field Details- 
usernameClaimName
- 
oidcUserMapper
- 
oidcProperties
 
- 
- 
Constructor Details- 
JmixJwtAuthenticationConverter
 
- 
- 
Method Details- 
convertpublic org.springframework.security.authentication.AbstractAuthenticationToken convert(org.springframework.security.oauth2.jwt.Jwt jwt) - Specified by:
- convertin interface- org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,- org.springframework.security.authentication.AbstractAuthenticationToken> 
 
- 
setUsernameClaimNameSets the username claim name. Defaults toJwtClaimNames.SUB.- Parameters:
- usernameClaimName- The username claim name
 
 
-