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 Details

    • getUserPrivilegeSummary

      PrivilegeSummary getUserPrivilegeSummary(@NonNull @NonNull User user, @NonNull @NonNull String serverId)
      Gets a PrivilegeSummary of user's consolidated authorities, restrictions, and restricted authorities.
      Parameters:
      user - User to get the PrivilegeSummary for
      serverId - id of the AuthorizationServer
      Returns:
      a PrivilegeSummary of user's authorities, restrictions, and restricted authorities
      See Also:
    • getRestrictionTargetsByRestrictionType

      Map<String,Set<String>> getRestrictionTargetsByRestrictionType(@NonNull @NonNull Set<Restriction> restrictions)
      Converts the Set of Restriction to a Map with the structure of: {restrictionType: [restrictionTargets]}.
      Parameters:
      restrictions - Set of Restriction
      Returns:
      a map with restriction type as key and restriction targets as value converted from the given set of restrictions