Package | Description |
---|---|
io.jsonwebtoken |
Modifier and Type | Method and Description |
---|---|
JwtBuilder |
JwtBuilder.addClaims(Map<String,?> claims)
|
JwtBuilder |
JwtBuilder.b64Url(Encoder<OutputStream,OutputStream> encoder)
Perform Base64Url encoding during
compaction with the specified OutputStream Encoder. |
JwtBuilder |
JwtBuilder.base64UrlEncodeWith(Encoder<byte[],String> base64UrlEncoder)
Deprecated.
since 0.12.0 in favor of
b64Url(Encoder) . |
static JwtBuilder |
Jwts.builder()
Returns a new
JwtBuilder instance that can be configured and then used to create JWT compact serialized
strings. |
JwtBuilder |
JwtBuilder.claim(String name,
Object value)
Sets a JWT claim, overwriting any existing claim with the same name.
|
JwtBuilder |
JwtBuilder.claims(Map<String,?> claims)
Adds all given name/value pairs to the JSON Claims in the payload, overwriting any existing claims
with the same names.
|
JwtBuilder |
JwtBuilder.compressWith(CompressionAlgorithm alg)
Compresses the JWT payload using the specified
CompressionAlgorithm . |
JwtBuilder |
JwtBuilder.content(byte[] content)
Sets the JWT payload to be the specified content byte array.
|
JwtBuilder |
JwtBuilder.content(byte[] content,
String cty)
Sets the JWT payload to be the specified byte array, and also sets the
contentType header value to a compact cty IANA Media Type
identifier to indicate the data format of the byte array. |
JwtBuilder |
JwtBuilder.content(InputStream in)
Sets the JWT payload to be the bytes in the specified content stream.
|
JwtBuilder |
JwtBuilder.content(InputStream content,
String cty)
Sets the JWT payload to be the specified content byte stream and also sets the
contentType header value to a compact cty IANA Media Type
identifier to indicate the data format of the byte array. |
JwtBuilder |
JwtBuilder.content(String content)
Sets the JWT payload to be the specified string's UTF-8 bytes.
|
JwtBuilder |
JwtBuilder.content(String content,
String cty)
Sets the JWT payload to be the specified String's UTF-8 bytes, and also sets the
contentType header value to a compact cty IANA Media Type
identifier to indicate the data format of the resulting byte array. |
JwtBuilder |
JwtBuilder.encodePayload(boolean b64)
Enables RFC 7797: JSON Web Signature (JWS)
Unencoded Payload Option if
false , or standard JWT/JWS/JWE payload encoding otherwise. |
<K extends Key> |
JwtBuilder.encryptWith(K key,
KeyAlgorithm<? super K,?> keyAlg,
AeadAlgorithm enc)
Encrypts the constructed JWT using the specified
enc algorithm with the symmetric key produced by the
keyAlg when invoked with the given key , producing a JWE. |
JwtBuilder |
JwtBuilder.encryptWith(SecretKey key,
AeadAlgorithm enc)
Encrypts the constructed JWT with the specified symmetric
key using the provided enc ryption
algorithm, producing a JWE. |
JwtBuilder |
JwtBuilder.expiration(Date exp)
Sets the JWT Claims
exp (expiration) claim. |
JwtBuilder |
JwtBuilder.id(String jti)
Sets the JWT Claims
jti (JWT ID) claim. |
JwtBuilder |
JwtBuilder.issuedAt(Date iat)
Sets the JWT Claims
iat (issued at) claim. |
JwtBuilder |
JwtBuilder.issuer(String iss)
Sets the JWT Claims
iss (issuer) claim. |
JwtBuilder |
JwtBuilder.json(Serializer<Map<String,?>> serializer)
Perform Map-to-JSON serialization with the specified Serializer.
|
JwtBuilder |
JwtBuilder.notBefore(Date nbf)
Sets the JWT Claims
nbf (not before) claim. |
JwtBuilder |
JwtBuilder.provider(Provider provider)
Sets the JCA Provider to use during cryptographic signing or encryption operations, or
null if the
JCA subsystem preferred provider should be used. |
JwtBuilder |
JwtBuilder.random(SecureRandom secureRandom)
Sets the
SecureRandom to use during cryptographic signing or encryption operations, or null if
a default SecureRandom should be used. |
JwtBuilder |
JwtBuilder.serializeToJsonWith(Serializer<Map<String,?>> serializer)
Deprecated.
since 0.12.0 in favor of
json(Serializer) |
JwtBuilder |
JwtBuilder.setClaims(Map<String,?> claims)
Deprecated.
since 0.12.0 in favor of using the
claims() builder. |
JwtBuilder |
JwtBuilder.setHeader(Map<String,?> map)
|
JwtBuilder |
JwtBuilder.setHeaderParam(String name,
Object value)
Deprecated.
since 0.12.0 in favor of
.
This method will be removed before the 1.0 release. |
JwtBuilder |
JwtBuilder.setHeaderParams(Map<String,?> params)
|
JwtBuilder |
JwtBuilder.setPayload(String payload)
Deprecated.
since 0.12.0 in favor of
content(String)
because both Claims and Content are technically 'payloads', so this method name is misleading. This method will
be removed before the 1.0 release. |
JwtBuilder |
JwtBuilder.signWith(Key key)
Signs the constructed JWT with the specified key using the key's recommended signature algorithm
as defined below, producing a JWS.
|
JwtBuilder |
JwtBuilder.signWith(Key key,
SignatureAlgorithm alg)
Deprecated.
since 0.12.0 to use the more flexible
signWith(Key, SecureDigestAlgorithm) . |
<K extends Key> |
JwtBuilder.signWith(K key,
SecureDigestAlgorithm<? super K,?> alg)
Signs the constructed JWT with the specified key using the specified algorithm, producing a JWS.
|
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
byte[] secretKey)
Deprecated.
as of 0.10.0: use
Keys .hmacShaKeyFor(bytes) to
obtain the Key and then invoke signWith(Key) or
signWith(Key, SecureDigestAlgorithm) .
This method will be removed in the 1.0 release. |
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
Key key)
Deprecated.
since 0.10.0. Use
signWith(Key, SecureDigestAlgorithm) instead.
This method will be removed before the 1.0 release. |
JwtBuilder |
JwtBuilder.signWith(SignatureAlgorithm alg,
String base64EncodedSecretKey)
Deprecated.
as of 0.10.0: use
signWith(Key) or signWith(Key, SignatureAlgorithm) instead. This
method will be removed in the 1.0 release. |
JwtBuilder |
JwtBuilder.subject(String sub)
Sets the JWT Claims
sub (subject) claim. |
Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.