Class HashClaim

    • Constructor Detail

      • HashClaim

        protected HashClaim​(String value)
        Creates a new SHA-2 based claim with the specified value.
        Parameters:
        value - The claim value. Must not be null.
    • Method Detail

      • getMessageDigestInstance

        public static MessageDigest getMessageDigestInstance​(com.nimbusds.jose.JWSAlgorithm alg)
        Gets the matching SHA-2 message digest for the specified JSON Web Signature (JWS) algorithm.
        Parameters:
        alg - The JWS algorithm. Must not be null.
        Returns:
        The SHA-2 message digest, null if the JWS algorithm or its corresponding SHA-2 message digest are not supported.
      • computeValue

        public static String computeValue​(Identifier identifier,
                                          com.nimbusds.jose.JWSAlgorithm alg)
        Computes the SHA-2 claim value for the specified identifier.
        Parameters:
        identifier - The identifier, typically an authorisation code or an access token. Must not be null.
        alg - The reference JSON Web Signature (JWS) algorithm. Must not be null.
        Returns:
        The matching (truncated to first half) SHA-2 claim value, or null if the JWS algorithm or its corresponding SHA-2 message digest are not supported.