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 Details

    • usernameClaimName

      protected String usernameClaimName
    • oidcUserMapper

      protected OidcUserMapper oidcUserMapper
    • oidcProperties

      protected OidcProperties oidcProperties
  • Constructor Details

  • Method Details

    • convert

      public org.springframework.security.authentication.AbstractAuthenticationToken convert(org.springframework.security.oauth2.jwt.Jwt jwt)
      Specified by:
      convert in interface org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,org.springframework.security.authentication.AbstractAuthenticationToken>
    • setUsernameClaimName

      public void setUsernameClaimName(String usernameClaimName)
      Sets the username claim name. Defaults to JwtClaimNames.SUB.
      Parameters:
      usernameClaimName - The username claim name