UNPKG

@kinde-oss/kinde-node-express

Version:

Kinde SDK for traditional Node.js Express web apps that run on the server

33 lines (32 loc) 1.27 kB
import type { ExpressMiddleware } from '../utils.js'; import type { Request, Response, NextFunction } from 'express'; /** * Custom middleware fetches details for the authenticated user and attaches them * to the request object, available as `req.user` and having the following type * @type {UserType}. * * @param {Request} * @param {Response} res * @param {NextFunction} next * @returns {Promise<void>} */ export declare const getUser: (req: Request, res: Response, next: NextFunction) => Promise<void>; /** * Custom middleware determines if the user is authenticated or not if so proceeds * to next middleware otherwise redirects to `unAuthorisedUrl` with 403 staus. * * @param {Request} req * @param {Response} res * @param {NextFunction} next * @returns {Promise<void>} */ export declare const protectRoute: (req: Request, res: Response, next: NextFunction) => Promise<void>; /** * Custom JWT verifier as middleware, for verifying integrity of JWT bearer * tokens in authorization headers. * * @param {string} issuer - issuerBaseUrl * @param {Record<string, string>} * @returns {ExpressMiddleware<Promise<void>>} */ export declare const jwtVerify: (issuer: string, options: Record<string, string>) => ExpressMiddleware<Promise<void | Response>>;