Returns an audience builder. Add audience values with add(aud), then call and() to return to this builder.
Sets an arbitrary claim (a.k.a. body) param, if a parameter has already been set for that key then this method will override it.
NOTE: If you pass a Java.Time.Date value, this library will convert that date value into the number of seconds since epoch
the key in the claim segment to write to
the value to assign
Generates the final JWT with the configuration parameters and key signatures as set.
Returns a header builder. Add header params with add(key, value), then call and() to return to this builder.
Sets the standard "jti" claim.
the value to assign
Sets the standard "iss" claim.
the value to assign
Sets the value for standard "aud" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("aud", "your value here");
the value to assign
Sets the value for standard "jti" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("jti", "your value here");
the value to assign
Sets the value for standard "iat" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("iat", "your value here");
NOTE: While it may seem confusing to pass a Java.Time.Date object, the library automatically converts that value into a number representing that date value as the number of seconds since epoch
the value to assign
Sets the value for standard "iss" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("iss", "your value here"); @param iss the value to assign @deprecated since jjwt 0.12; use issuer(iss)`.
Sets the value for standard "nbf" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("nbf", "your value here");
the value to assign
Sets the value for standard "sub" parameter in the JWT's claim segment (Also known as the Body).
If this property has already been set, then this method will override it.
This is the same as calling claim("sub", "your value here");
the value to assign
set the key with which you are going to sign this token
const pKey = B.crypto.createPrivateKeyFromPKCS8("RSA", privKey); const jwtBuilder = B.crypto.jwts.Jwts.builder(); const fullJsonWebToken = jwtBuilder .subject("user-1") .claim("key","value") .signWith(pKey) .compact(); // the compact method converts it to a string
NOTE: The library sets the header parameter "alg" from the key: RS256 / RS384 / RS512
for 2048 / 3072 / 4096-bit RSA keys.
@param
Sets the standard "sub" claim.
the value to assign
See Java.Crypto.Jwts