Interface PrivilegeService
- All Known Implementing Classes:
DefaultPrivilegeService
public interface PrivilegeService
A service that contains various utility functions related to
Restriction,
RestrictedRole, and RestrictedPermission.
These functions are most useful for consolidation purposes to obtain user's
flat permissions, flat roles
restrictions, restricted roles,
restricted permissions,
AuthorizationServer.getDefaultUserPermissions(), and
AuthorizationServer.getDefaultUserRoles() for building JWT claims.
-
Method Summary
Modifier and TypeMethodDescriptiongetRestrictionTargetsByRestrictionType(@NonNull Set<Restriction> restrictions) Converts the Set ofRestrictionto a Map with the structure of: {restrictionType: [restrictionTargets]}.getUserPrivilegeSummary(@NonNull User user, @NonNull String serverId) Gets aPrivilegeSummaryof user's consolidated authorities, restrictions, and restricted authorities.
-
Method Details
-
getUserPrivilegeSummary
PrivilegeSummary getUserPrivilegeSummary(@NonNull @NonNull User user, @NonNull @NonNull String serverId) Gets aPrivilegeSummaryof user's consolidated authorities, restrictions, and restricted authorities.- Parameters:
user-Userto get thePrivilegeSummaryforserverId- id of theAuthorizationServer- Returns:
- a
PrivilegeSummaryof user's authorities, restrictions, and restricted authorities - See Also:
-
getRestrictionTargetsByRestrictionType
Map<String,Set<String>> getRestrictionTargetsByRestrictionType(@NonNull @NonNull Set<Restriction> restrictions) Converts the Set ofRestrictionto a Map with the structure of: {restrictionType: [restrictionTargets]}.- Parameters:
restrictions-SetofRestriction- Returns:
- a map with restriction type as key and restriction targets as value converted from the given set of restrictions
-