Class ClaimsConstraint

    • Constructor Detail

      • ClaimsConstraint

        public ClaimsConstraint()
    • Method Detail

      • exists

        public boolean exists()
        Description copied from interface: Constraint
        Check if the key that represents the constraint exists. It does not matter whether the value of the key is null or not.

        For example, exists() method of an instance that represents given_name in the JSON below will return true.

         {
           "verified_claims": {
             "claims": {
               "given_name": null
             }
           }
         }
         
        Specified by:
        exists in interface Constraint
        Returns:
        true if the key that represents the constraint exists.
      • setExists

        public void setExists​(boolean exists)
        Set the existence of the constraint.
        Parameters:
        exists - true to indicate that the constraint exists.
      • isNull

        public boolean isNull()
        Description copied from interface: Constraint
        Check if the value of the constraint is null.

        For example, isNull() method of an instance that represents given_name in the JSON below will return true.

         {
           "verified_claims": {
             "claims": {
               "given_name": null
             }
           }
         }
         
        But, the method returns false in the following case.
         {
           "verified_claims": {
             "claims": {
               "given_name": {
               }
             }
           }
         }
         
        Specified by:
        isNull in interface Constraint
        Returns:
        true if the value of the constraint is null.
      • setNull

        public void setNull​(boolean isNull)
        Set the boolean flag that indicates that the value of the constraint is null.
        Parameters:
        isNull - true to indicate that the value of the constraint is null.
      • putClaim

        public ClaimsConstraint putClaim​(String claimName,
                                         VerifiedClaimConstraint constraint)
        Put a claim constraint to this object.

        This method internally calls put(String, VerifiedClaimConstraint) method to register the given pair of claim name and constraint and then returns this object.

        Parameters:
        claimName - The claim name.
        constraint - The constraint for the claim.
        Returns:
        this object.
        Since:
        2.65
      • extract

        public static ClaimsConstraint extract​(Map<?,​?> map,
                                               String key)
                                        throws ConstraintException
        Create a ClaimsConstraint instance from an object in the given map.
        Parameters:
        map - A map that may contain "claims".
        key - The key that identifies the object in the map. In normal cases, the key is "claims".
        Returns:
        A ClaimsConstraint instance that represents "claims". Even if the map does not contain the given key, an instance of ClaimsConstraint is returned.
        Throws:
        ConstraintException - The structure of the map does not conform to the specification (OpenID Connect for Identity Assurance 1.0).
      • toMap

        public Map<String,​Object> toMap()
        Create a Map instance that represents this object in the way conforming to the structure defined in 5. Requesting Verified Claims of OpenID Connect for Identity Assurance 1.0.
        Returns:
        A Map instance that represents this object. If exists() returns false or isNull() returns true, this method returns null.
      • toJson

        public String toJson()
        Convert this object into JSON in the way conforming to the structure defined in 5. Requesting Verified Claims of OpenID Connect for Identity Assurance 1.0.

        This method is an alias of toJson(false).

        Returns:
        JSON that represents this object. If toMap() returns null, this method returns "null" (a String instance which consists of 'n', 'u', 'l' and 'l').
      • toJson

        public String toJson​(boolean pretty)
        Convert this object into JSON in the way conforming to the structure defined in 5. Requesting Verified Claims of OpenID Connect for Identity Assurance 1.0.
        Parameters:
        pretty - true to make the output more human-readable.
        Returns:
        JSON that represents this object. If toMap() returns null, this method returns "null" (a String instance which consists of 'n', 'u', 'l' and 'l').