Class CognitoJwtVerifier<SpecificVerifyProperties, IssuerConfig, MultiIssuer>

Class representing a verifier for JWTs signed by Amazon Cognito

Type Parameters

Hierarchy (view full)

Accessors

  • get expectedIssuers(): string[]
  • Returns string[]

Methods

  • This method loads a JWKS that you provide, into the JWKS cache, so that it is available for JWT verification. Use this method to speed up the first JWT verification (when the JWKS would otherwise have to be downloaded from the JWKS uri), or to provide the JWKS in case the JwtVerifier does not have internet access to download the JWKS

    Parameters

    • Rest ...__namedParameters: MultiIssuer extends false
          ? [jwks: Jwks, userPoolId?: string]
          : [jwks: Jwks, userPoolId: string]

    Returns void

    void

  • Hydrate the JWKS cache for (all of) the configured issuer(s). This will fetch and cache the latest and greatest JWKS for concerned issuer(s).

    Returns Promise<void>

    void

  • Verify (asynchronously) an already decomposed JWT, that is signed using RS256 / RS384 / RS512.

    Parameters

    Returns Promise<JwtPayload>

    The payload of the JWT––if the JWT is valid, otherwise an error is thrown

  • Parse a User Pool ID, to extract the issuer and JWKS URI

    Parameters

    • userPoolId: string

      The User Pool ID

    Returns {
        issuer: string;
        jwksUri: string;
    }

    The issuer and JWKS URI for the User Pool

    • issuer: string
    • jwksUri: string