@colearn/microservices-kit
Advanced tools
Comparing version 0.0.38 to 0.0.39
/// <reference types="node" /> | ||
import type { NextFunction, Response, Request } from 'express'; | ||
import { Params } from 'express-jwt'; | ||
export declare function extractToken(req: Request): string | undefined; | ||
export declare function extractBearerToken(req: Request): string | undefined; | ||
export declare function extractTokenFromCookie(req: Request, cookieName?: string): string | undefined; | ||
export declare function jwtMiddleware({ secret, algorithms, credentialsRequired, requestProperty, ...rest }: Params): (req: Request, res: Response, next: NextFunction) => Promise<void | NodeJS.Immediate>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.jwtMiddleware = exports.extractToken = void 0; | ||
exports.jwtMiddleware = exports.extractTokenFromCookie = exports.extractBearerToken = void 0; | ||
const express_jwt_1 = require("express-jwt"); | ||
@@ -19,2 +19,3 @@ const errors_1 = require("./errors"); | ||
} | ||
exports.extractBearerToken = extractBearerToken; | ||
function extractTokenFromCookie(req, cookieName) { | ||
@@ -26,6 +27,3 @@ if (!cookieName) { | ||
} | ||
function extractToken(req) { | ||
return extractBearerToken(req) || extractTokenFromCookie(req); | ||
} | ||
exports.extractToken = extractToken; | ||
exports.extractTokenFromCookie = extractTokenFromCookie; | ||
function jwtMiddleware({ secret, algorithms = ['HS256'], credentialsRequired = false, requestProperty = 'user', ...rest }) { | ||
@@ -32,0 +30,0 @@ if (!secret) { |
{ | ||
"name": "@colearn/microservices-kit", | ||
"version": "0.0.38", | ||
"version": "0.0.39", | ||
"description": "colearn microservice kit", | ||
@@ -5,0 +5,0 @@ "author": "Colearn", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55535
921