UNPKG

@nestjs-cognito/core

Version:
35 lines 1.37 kB
import type { CognitoJwtExtractor } from "../interfaces/cognito-jwt-extractor.interface"; /** * JWT extractor implementation that extracts tokens from HTTP-only cookies. * Useful for web applications that store JWT tokens in secure cookies instead of headers. * * @example * ```typescript * // Usage in module configuration * CognitoModule.register({ * jwtExtractor: new CookieJwtExtractor('access_token'), * // ... other options * }) * ``` */ export declare class CookieJwtExtractor implements CognitoJwtExtractor { private readonly cookieName; /** * Creates a new cookie-based JWT extractor. * @param cookieName - The name of the cookie containing the JWT token. Defaults to 'access_token' */ constructor(cookieName?: string); /** * Checks if the request has authentication information in the specified cookie. * @param request - The request object (must have cookies property) * @returns True if the cookie is present and not empty */ hasAuthenticationInfo(request: any): boolean; /** * Extracts the JWT token from the specified cookie. * @param request - The request object (must have cookies property) * @returns The JWT token string or null if not found */ getAuthorizationToken(request: any): string | null; } //# sourceMappingURL=cookie-jwt.extractor.d.ts.map