@ThreadSafe public class PlainJWT extends PlainObject implements JWT
MIME_TYPE_COMPACT, MIME_TYPE_JS
Constructor and Description |
---|
PlainJWT(Base64URL firstPart,
Base64URL secondPart)
Creates a new unsecured (plain) JSON Web Token (JWT) with the
specified Base64URL-encoded parts.
|
PlainJWT(JWTClaimsSet claimsSet)
Creates a new unsecured (plain) JSON Web Token (JWT) with a default
PlainHeader and the specified claims
set. |
PlainJWT(PlainHeader header,
JWTClaimsSet claimsSet)
Creates a new unsecured (plain) JSON Web Token (JWT) with the
specified header and claims set.
|
Modifier and Type | Method and Description |
---|---|
JWTClaimsSet |
getJWTClaimsSet()
Gets the claims set of the JSON Web Token (JWT).
|
static PlainJWT |
parse(String s)
Parses an unsecured (plain) JSON Web Token (JWT) from the specified
string in compact format.
|
protected void |
setPayload(Payload payload)
Sets the payload of this JOSE object.
|
getHeader, serialize
getParsedParts, getParsedString, getPayload, setParsedParts, split
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHeader, getParsedParts, getParsedString, serialize
public PlainJWT(JWTClaimsSet claimsSet)
PlainHeader
and the specified claims
set.claimsSet
- The JWT claims set. Must not be null
.public PlainJWT(PlainHeader header, JWTClaimsSet claimsSet)
header
- The unsecured header. Must not be null
.claimsSet
- The JWT claims set. Must not be null
.public PlainJWT(Base64URL firstPart, Base64URL secondPart) throws ParseException
firstPart
- The first part, corresponding to the unsecured
header. Must not be null
.secondPart
- The second part, corresponding to the claims set
(payload). Must not be null
.ParseException
- If parsing of the serialised parts failed.public JWTClaimsSet getJWTClaimsSet() throws ParseException
JWT
getJWTClaimsSet
in interface JWT
null
if not available (for an
encrypted JWT that isn't decrypted).ParseException
- If the payload of the JWT doesn't represent a
valid JSON object and a JWT claims set.protected void setPayload(Payload payload)
JOSEObject
setPayload
in class JOSEObject
payload
- The payload, null
if not available (e.g. for
an encrypted JWE object).public static PlainJWT parse(String s) throws ParseException
s
- The string to parse. Must not be null
.ParseException
- If the string couldn't be parsed to a valid
unsecured JWT.Copyright © 2021 Connect2id Ltd.. All rights reserved.