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
The base class for SHA-2 based claims.
- See Also:
-
Field Summary
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
computeValue
(Identifier identifier, com.nimbusds.jose.JWSAlgorithm alg) Deprecated.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.static MessageDigest
getMessageDigestInstance
(com.nimbusds.jose.JWSAlgorithm alg) Deprecated.UsegetMessageDigestInstance(JWSAlgorithm, Curve)
instead.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.Methods inherited from class com.nimbusds.oauth2.sdk.id.Identifier
compareTo, equals, getValue, hashCode, toJSONString, toString, toStringList
-
Constructor Details
-
HashClaim
Creates a new SHA-2 based claim with the specified value.- Parameters:
value
- The claim value. Must not benull
.
-
-
Method Details
-
getMessageDigestInstance
@Deprecated public static MessageDigest getMessageDigestInstance(com.nimbusds.jose.JWSAlgorithm alg) Deprecated.UsegetMessageDigestInstance(JWSAlgorithm, Curve)
instead.Gets the matching SHA-2 message digest for the specified JSON Web Signature (JWS) algorithm.- Parameters:
alg
- The JWS algorithm. Must not benull
.- 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 benull
.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) Deprecated.UsecomputeValue(Identifier, JWSAlgorithm, Curve)
instead.Computes the SHA-2 claim value for the specified identifier.- Parameters:
identifier
- The identifier, typically an authorisation code or an access token. Must not benull
.alg
- The reference JWS algorithm. Must not benull
.- 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 benull
.alg
- The reference JWS algorithm. Must not benull
.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.
-
computeValue(Identifier, JWSAlgorithm, Curve)
instead.