Class UmaPolicy


  • public class UmaPolicy
    extends Object
    Represents an UMA policy with operations to convert to and from underlying backend policies and JSON format.
    Since:
    13.0.0
    • Method Detail

      • idOf

        public static String idOf​(org.forgerock.json.JsonValue policy)
                           throws org.forgerock.json.resource.BadRequestException
        Parses the unique resource set id, that the UMA policy relates to, from the UMA policy JSON.
        Parameters:
        policy - The UMA policy in JSON format.
        Returns:
        The UMA policy ID.
        Throws:
        org.forgerock.json.resource.BadRequestException
      • valueOf

        public static UmaPolicy valueOf​(ResourceSetDescription resourceSet,
                                        org.forgerock.json.JsonValue policy)
                                 throws org.forgerock.json.resource.BadRequestException
        Parses the UMA policy JSON into a UmaPolicy instance.
        Parameters:
        resourceSet - The resource set the policy relates to.
        policy - The UMA policy in JSON format.
        Returns:
        A UmaPolicy instance.
        Throws:
        org.forgerock.json.resource.BadRequestException - If the UMA policy JSON is not valid.
      • fromUnderlyingPolicies

        public static UmaPolicy fromUnderlyingPolicies​(ResourceSetDescription resourceSet,
                                                       Collection<org.forgerock.json.resource.ResourceResponse> policies)
                                                throws org.forgerock.json.resource.BadRequestException
        Converts underlying backend policies into an UmaPolicy.
        Parameters:
        resourceSet - The resource set the policy relates to.
        policies - The collection of underlying backend policies.
        Returns:
        A UmaPolicy instance.
        Throws:
        org.forgerock.json.resource.BadRequestException - If the underlying policies do not underpin a valid UMA policy.
      • getId

        public String getId()
        Gets the ID of this UMA policy which is the unique resource set ID that this policy relates to.
        Returns:
        The ID.
      • getRevision

        public String getRevision()
        Gets the revision of this UMA policy.
        Returns:
        The revision.
      • asJson

        public org.forgerock.json.JsonValue asJson()
        Converts the UmaPolicy to JSON.
        Returns:
        The JSON representation of the UMA policy.
      • getScopes

        public Set<String> getScopes()
        Parses the unique set of scopes that are defined for all subject in this UMA policy.
        Returns:
        The set of defined scopes on the UMA policy.
      • asUnderlyingPolicies

        public Set<org.forgerock.json.JsonValue> asUnderlyingPolicies​(String policyOwnerName)
        Converts the UmaPolicy into its underlying backend policies in JSON format.
        Returns:
        The set of underlying backend policies that represent this UMA policy.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getSubjects

        public Set<String> getSubjects()
        Parses the unique set of subjects that have permissions defined in this UMA policy.
        Returns:
        The set of defined subjects on the UMA policy.
      • getResourceServerId

        public String getResourceServerId()
        Gets the Resource Server Id that the resource set was registered by.
        Returns:
        The Resource Server Id.