Class KeycloakRealmRoleConverter
java.lang.Object
com.example.vehicletaxsystem.config.KeycloakRealmRoleConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>>
public class KeycloakRealmRoleConverter
extends Object
implements org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>>
Converter for KeyCloak realm roles and users to be read by spring for authorisation and authentication purposes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCollection<org.springframework.security.core.GrantedAuthority>convert(org.springframework.security.oauth2.jwt.Jwt jwt) Converts JWT into recognisable collections of authority the use providing the JWT has.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
-
KeycloakRealmRoleConverter
public KeycloakRealmRoleConverter()
-
-
Method Details
-
convert
public Collection<org.springframework.security.core.GrantedAuthority> convert(org.springframework.security.oauth2.jwt.Jwt jwt) Converts JWT into recognisable collections of authority the use providing the JWT has.- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,Collection<org.springframework.security.core.GrantedAuthority>> - Parameters:
jwt- Javascript Web Token from the user making requests.- Returns:
- Collection of the authorities that the user has assigned.
-