UNPKG

@sigiljs-community/auth-plugin

Version:

Plugin for SigilJS framework that provides authentication with JWT-like tokens

25 lines (24 loc) 761 B
import { ClientRequest, Modifier } from '@sigiljs/sigil'; interface IAuthModifier { /** Refresh token or null if not presented */ refreshToken: string | null; /** Access token or null if not presented */ accessToken: string | null; /** True if access token presented, valid and not expired */ accessTokenValid: boolean; } /** * Authentication modifier that injects access and refresh * tokens from headers into request * * Automatically check if access token is valid */ export default class AuthModifier extends Modifier<IAuthModifier> { constructor(); onRequest(request: ClientRequest<any>): { refreshToken: string | null; accessToken: string | null; accessTokenValid: boolean; }; } export {};