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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.nimbusds.oauth2.sdk.id.Identifier
DEFAULT_BYTE_LENGTH, secureRandom
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
computeValue(Identifier identifier, com.nimbusds.jose.JWSAlgorithm alg)
Computes the SHA-2 claim value for the specified identifier.static MessageDigest
getMessageDigestInstance(com.nimbusds.jose.JWSAlgorithm alg)
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
-
-
-
-
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 benull
.- 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 benull
.alg
- The reference JSON Web Signature (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.
-
-