jwt_claim()
is a wrapper around jose::jwt_claim()
that creates a JWT
claim set with a few extra default values. jwt_encode_sig()
and
jwt_encode_hmac()
are thin wrappers around jose::jwt_encode_sig()
and
jose::jwt_encode_hmac()
that exist primarily to make specification
in other functions a little simpler.
jwt_claim(
iss = NULL,
sub = NULL,
aud = NULL,
exp = unix_time() + 5L * 60L,
nbf = unix_time(),
iat = unix_time(),
jti = NULL,
...
)jwt_encode_sig(claim, key, size = 256, header = list())
jwt_encode_hmac(claim, secret, size = 256, header = list())
An S3 list with class jwt_claim
.
Issuer claim. Identifies the principal that issued the JWT.
Subject claim. Identifies the principal that is the subject of the JWT (i.e. the entity that the claims apply to).
Audience claim. Identifies the recipients that the JWT is intended. Each principle intended to process the JWT must be identified with a unique value.
Expiration claim. Identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. Defaults to 5 minutes.
Not before claim. Identifies the time before which the JWT MUST NOT be accepted for processing. Defaults to current time.
Issued at claim. Identifies the time at which the JWT was issued. Defaults to current time.
JWT ID claim. Provides a unique identifier for the JWT. If omitted, uses a random 32-byte sequence encoded with base64url.
Any additional claims to include in the claim set.
Claim set produced by jwt_claim()
.
RSA or EC private key either specified as a path to a file, a connection, or a string (PEM/SSH format), or a raw vector (DER format).
Size, in bits, of sha2 signature, i.e. 256, 384 or 512. Only for HMAC/RSA, not applicable for ECDSA keys.
A named list giving additional fields to include in the JWT header.
String or raw vector with a secret passphrase.
claim <- jwt_claim()
str(claim)
Run the code above in your browser using DataLab