Package io.jmix.oidc.claimsmapper
Class BaseClaimsRolesMapper
java.lang.Object
io.jmix.oidc.claimsmapper.BaseClaimsRolesMapper
- All Implemented Interfaces:
ClaimsRolesMapper
- Direct Known Subclasses:
DefaultClaimsRolesMapper
ClaimsRolesMapper that can be used as super-class for your own ClaimsRolesMapper implementations. The
child classes must override the getResourceRolesCodes(Map) or/and getRowLevelRoleCodes(Map)
methods. The behavior for finding roles with given codes and transforming them into a collection of GrantedAuthority is already implemented in the current class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResourceRoleRepositoryprotected RoleGrantedAuthorityUtilsprotected RowLevelRoleRepository -
Constructor Summary
ConstructorsConstructorDescriptionBaseClaimsRolesMapper(ResourceRoleRepository resourceRoleRepository, RowLevelRoleRepository rowLevelRoleRepository, RoleGrantedAuthorityUtils roleGrantedAuthorityUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<String>getResourceRolesCodes(Map<String, Object> claims) protected Collection<String>getRowLevelRoleCodes(Map<String, Object> claims) Collection<? extends org.springframework.security.core.GrantedAuthority>toGrantedAuthorities(Map<String, Object> claims) Transforms collection of roles returned bytoResourceRoles(Map)andtoRowLevelRoles(Map)into a collection ofGrantedAuthority.toResourceRoles(Map<String, Object> claims) toRowLevelRoles(Map<String, Object> claims)
-
Field Details
-
rowLevelRoleRepository
-
resourceRoleRepository
-
roleGrantedAuthorityUtils
-
-
Constructor Details
-
BaseClaimsRolesMapper
public BaseClaimsRolesMapper(ResourceRoleRepository resourceRoleRepository, RowLevelRoleRepository rowLevelRoleRepository, RoleGrantedAuthorityUtils roleGrantedAuthorityUtils)
-
-
Method Details
-
toResourceRoles
- Specified by:
toResourceRolesin interfaceClaimsRolesMapper
-
toRowLevelRoles
- Specified by:
toRowLevelRolesin interfaceClaimsRolesMapper
-
getResourceRolesCodes
-
getRowLevelRoleCodes
-
toGrantedAuthorities
public Collection<? extends org.springframework.security.core.GrantedAuthority> toGrantedAuthorities(Map<String, Object> claims) Transforms collection of roles returned bytoResourceRoles(Map)andtoRowLevelRoles(Map)into a collection ofGrantedAuthority.- Specified by:
toGrantedAuthoritiesin interfaceClaimsRolesMapper- Parameters:
claims- pieces of information about the user returned by the OpenID Provider- Returns:
- a collection of granted authorities that contain information about resource and row-level roles available to the user
-