Class HashClaim

java.lang.Object
com.nimbusds.oauth2.sdk.id.Identifier
com.nimbusds.openid.connect.sdk.claims.HashClaim
All Implemented Interfaces:
Serializable, Comparable<Identifier>, net.minidev.json.JSONAware
Direct Known Subclasses:
AccessTokenHash, CodeHash, StateHash

public abstract class HashClaim extends Identifier
The base class for SHA-2 based claims.
See Also:
  • Constructor Details

    • 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 Details

    • getMessageDigestInstance

      @Deprecated 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.
    • getMessageDigestInstance

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

      @Deprecated 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 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.
    • computeValue

      public static String computeValue(Identifier identifier, com.nimbusds.jose.JWSAlgorithm alg, com.nimbusds.jose.jwk.Curve crv)
      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 JWS algorithm. Must not be null.
      crv - The JWK curve used with the JWS algorithm, null if not applicable.
      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.