Class KeycloakRealmAuthoritiesConverter

  • All Implemented Interfaces:
    org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​Collection<org.springframework.security.core.GrantedAuthority>>

    public final class KeycloakRealmAuthoritiesConverter
    extends AbstractJwtGrantedAuthoritiesConverter
    Converter for converting a Keycloak-issued Jwt into GrantedAuthorities. The converter uses the roles inside the realm_access claim for mapping to granted authorities. Each role is prefixed with ROLE_ for ensuring compatibility with the Spring framework.
    See Also:
    https://www.keycloak.org
    • Constructor Detail

      • KeycloakRealmAuthoritiesConverter

        public KeycloakRealmAuthoritiesConverter()
    • Method Detail

      • convert

        public Collection<org.springframework.security.core.GrantedAuthority> convert​(org.springframework.security.oauth2.jwt.Jwt jwt)