-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic support for JWT standard claims and option for validating durin…
…g parsing.
- Loading branch information
Showing
2 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Represents the standard claims that may be included in a JWT. | ||
* See RFC 7519 (https://tools.ietf.org/html/rfc7519) for details. | ||
*/ | ||
interface StandardClaims { | ||
/** | ||
* Issuer: Identifies the principal that issued the JWT. | ||
*/ | ||
iss?: string; | ||
|
||
/** | ||
* Subject: Identifies the principal that is the subject of the JWT. | ||
*/ | ||
sub?: string; | ||
|
||
/** | ||
* Audience: Identifies the recipients that the JWT is intended for. | ||
* Can be a single string or an array of strings. | ||
*/ | ||
aud?: string | string[]; | ||
|
||
/** | ||
* Expiration Time: Identifies the expiration time on or after which the | ||
* JWT MUST NOT be accepted for processing. Represented as a NumericDate | ||
* value as defined in RFC 7519. | ||
*/ | ||
exp?: number; | ||
|
||
/** | ||
* Not Before Time: Identifies the time before which the JWT MUST NOT be | ||
* accepted for processing. Represented as a NumericDate value as defined in RFC 7519. | ||
*/ | ||
nbf?: number; | ||
|
||
/** | ||
* Issued At Time: Identifies the time at which the JWT was issued. | ||
* Represented as a NumericDate value as defined in RFC 7519. | ||
*/ | ||
iat?: number; | ||
|
||
/** | ||
* JWT ID: Provides a unique identifier for the JWT. | ||
*/ | ||
jti?: string; | ||
} | ||
|
||
/** | ||
* Represents the payload of a JWT. Includes optional standard claims and allows for the | ||
* addition of custom properties. | ||
*/ | ||
export interface JWTPayload extends StandardClaims { | ||
// deno-lint-ignore no-explicit-any | ||
[key: string]: any; // Allow additional custom properties | ||
} |