Package io.jmix.oidc.claimsmapper
Class DefaultClaimsRolesMapper
java.lang.Object
io.jmix.oidc.claimsmapper.BaseClaimsRolesMapper
io.jmix.oidc.claimsmapper.DefaultClaimsRolesMapper
- All Implemented Interfaces:
ClaimsRolesMapper
Default
ClaimsRolesMapper
implementation that takes OidcUser
role names and transforms roles names to resource and row-level roles using role name prefixes.
Roles names are taken from a special claim. Claim name is taken from the rolesClaimName
property. The
default value is taken from the OidcProperties.DefaultClaimsRolesMapperConfig.getRolesClaimName()
and may be
changed using the corresponding application property.
Role names from the user attribute are mapped to the resource and row-level roles using resourceRolePrefix
and rowLevelRolePrefix
prefixes, e.g. if the resourceRolePrefix
is "resource$" then OIDC role with
the name "resource$system-full-access" will be mapped to Jmix role with the "system-full-access" code.
-
Field Summary
Fields inherited from class io.jmix.oidc.claimsmapper.BaseClaimsRolesMapper
resourceRoleRepository, rowLevelRoleRepository
-
Constructor Summary
ConstructorDescriptionDefaultClaimsRolesMapper
(ResourceRoleRepository resourceRoleRepository, RowLevelRoleRepository rowLevelRoleRepository) -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<String>
getResourceRolesCodes
(Map<String, Object> claims) protected Collection<String>
protected Collection<String>
getRowLevelRoleCodes
(Map<String, Object> claims) void
setResourceRolePrefix
(String resourceRolePrefix) void
setRolesClaimName
(String rolesClaimName) void
setRowLevelRolePrefix
(String rowLevelRolePrefix) Methods inherited from class io.jmix.oidc.claimsmapper.BaseClaimsRolesMapper
toResourceRoles, toRowLevelRoles
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.oidc.claimsmapper.ClaimsRolesMapper
toGrantedAuthorities
-
Field Details
-
rolesClaimName
-
resourceRolePrefix
-
rowLevelRolePrefix
-
-
Constructor Details
-
DefaultClaimsRolesMapper
public DefaultClaimsRolesMapper(ResourceRoleRepository resourceRoleRepository, RowLevelRoleRepository rowLevelRoleRepository)
-
-
Method Details
-
getResourceRolesCodes
- Overrides:
getResourceRolesCodes
in classBaseClaimsRolesMapper
-
getRowLevelRoleCodes
- Overrides:
getRowLevelRoleCodes
in classBaseClaimsRolesMapper
-
getRolesCodes
-
getRolesClaimName
-
setRolesClaimName
-
getResourceRolePrefix
-
setResourceRolePrefix
-
getRowLevelRolePrefix
-
setRowLevelRolePrefix
-