UNPKG

zents

Version:

ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.

21 lines 737 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HeaderSecurityStrategy = void 0; class HeaderSecurityStrategy { hasToken(context) { return context.request.header.has('authorization'); } getToken(context) { const headerToken = context.request.header.get('authorization'); const splitted = headerToken.trim().split(' '); if (splitted.length < 2 || splitted[0].toLowerCase() !== 'bearer') { return false; } return splitted[1]; } setToken(context, token) { context.request.header.set('token', token); } } exports.HeaderSecurityStrategy = HeaderSecurityStrategy; //# sourceMappingURL=HeaderSecurityStrategy.js.map