Class KeycloakRealmAuthoritiesConverter

java.lang.Object
io.quantics.multitenant.oauth2.config.AbstractJwtGrantedAuthoritiesConverter
io.quantics.multitenant.oauth2.config.KeycloakRealmAuthoritiesConverter
All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,​java.util.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 Summary

    Constructors
    Constructor Description
    KeycloakRealmAuthoritiesConverter()  
  • Method Summary

    Modifier and Type Method Description
    java.util.Collection<org.springframework.security.core.GrantedAuthority> convert​(org.springframework.security.oauth2.jwt.Jwt jwt)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeycloakRealmAuthoritiesConverter

      public KeycloakRealmAuthoritiesConverter()
  • Method Details

    • convert

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