Package com.nimbusds.jwt
Class SignedJWT
- java.lang.Object
-
- com.nimbusds.jose.JOSEObject
-
- com.nimbusds.jose.JWSObject
-
- com.nimbusds.jwt.SignedJWT
-
- All Implemented Interfaces:
JWT,Serializable
@ThreadSafe public class SignedJWT extends JWSObject implements JWT
Signed JSON Web Token (JWT).- Version:
- 2021-02-22
- Author:
- Vladimir Dzhuvinov
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.nimbusds.jose.JWSObject
JWSObject.State
-
-
Field Summary
-
Fields inherited from class com.nimbusds.jose.JOSEObject
MIME_TYPE_COMPACT, MIME_TYPE_JS
-
-
Constructor Summary
Constructors Constructor Description SignedJWT(JWSHeader header, JWTClaimsSet claimsSet)Creates a new to-be-signed JSON Web Token (JWT) with the specified header and claims set.SignedJWT(Base64URL firstPart, Base64URL secondPart, Base64URL thirdPart)Creates a new signed JSON Web Token (JWT) with the specified serialised parts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JWTClaimsSetgetJWTClaimsSet()Gets the claims set of the JSON Web Token (JWT).static SignedJWTparse(String s)Parses a signed JSON Web Token (JWT) from the specified string in compact format.protected voidsetPayload(Payload payload)Sets the payload of this JOSE object.-
Methods inherited from class com.nimbusds.jose.JWSObject
getHeader, getSignature, getSigningInput, getState, parse, serialize, serialize, sign, verify
-
Methods inherited from class com.nimbusds.jose.JOSEObject
getParsedParts, getParsedString, getPayload, setParsedParts, split
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.nimbusds.jwt.JWT
getHeader, getParsedParts, getParsedString, serialize
-
-
-
-
Constructor Detail
-
SignedJWT
public SignedJWT(JWSHeader header, JWTClaimsSet claimsSet)
Creates a new to-be-signed JSON Web Token (JWT) with the specified header and claims set. The initial state will beunsigned.- Parameters:
header- The JWS header. Must not benull.claimsSet- The JWT claims set. Must not benull.
-
SignedJWT
public SignedJWT(Base64URL firstPart, Base64URL secondPart, Base64URL thirdPart) throws ParseException
Creates a new signed JSON Web Token (JWT) with the specified serialised parts. The state will besigned.- Parameters:
firstPart- The first part, corresponding to the JWS header. Must not benull.secondPart- The second part, corresponding to the claims set (payload). Must not benull.thirdPart- The third part, corresponding to the signature. Must not benull.- Throws:
ParseException- If parsing of the serialised parts failed.
-
-
Method Detail
-
getJWTClaimsSet
public JWTClaimsSet getJWTClaimsSet() throws ParseException
Description copied from interface:JWTGets the claims set of the JSON Web Token (JWT).- Specified by:
getJWTClaimsSetin interfaceJWT- Returns:
- The claims set,
nullif not available (for an encrypted JWT that isn't decrypted). - Throws:
ParseException- If the payload of the JWT doesn't represent a valid JSON object and a JWT claims set.
-
setPayload
protected void setPayload(Payload payload)
Description copied from class:JOSEObjectSets the payload of this JOSE object.- Overrides:
setPayloadin classJOSEObject- Parameters:
payload- The payload,nullif not available (e.g. for an encrypted JWE object).
-
parse
public static SignedJWT parse(String s) throws ParseException
Parses a signed JSON Web Token (JWT) from the specified string in compact format.- Parameters:
s- The string to parse. Must not benull.- Returns:
- The signed JWT.
- Throws:
ParseException- If the string couldn't be parsed to a valid signed JWT.
-
-