UNPKG

loopback4-authentication

Version:

A loopback-next extension for authentication feature. Various Oauth strategies supported by this package.

31 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserAuthenticationMiddlewareProvider = void 0; const tslib_1 = require("tslib"); const core_1 = require("@loopback/core"); const rest_1 = require("@loopback/rest"); const keys_1 = require("../keys"); const middleware_groups_enum_1 = require("./middleware-groups.enum"); let UserAuthenticationMiddlewareProvider = class UserAuthenticationMiddlewareProvider { constructor(authenticateUser) { this.authenticateUser = authenticateUser; } value() { const middleware = async (ctx, next) => { await this.authenticateUser(ctx.request, ctx.response); return next(); }; return middleware; } }; exports.UserAuthenticationMiddlewareProvider = UserAuthenticationMiddlewareProvider; exports.UserAuthenticationMiddlewareProvider = UserAuthenticationMiddlewareProvider = tslib_1.__decorate([ (0, core_1.injectable)((0, rest_1.asMiddleware)({ group: middleware_groups_enum_1.AuthenticationMiddlewareGroups.USER, upstreamGroups: rest_1.RestMiddlewareGroups.PARSE_PARAMS, downstreamGroups: rest_1.RestMiddlewareGroups.INVOKE_METHOD, })), tslib_1.__param(0, (0, core_1.inject)(keys_1.AuthenticationBindings.USER_AUTH_ACTION)), tslib_1.__metadata("design:paramtypes", [Function]) ], UserAuthenticationMiddlewareProvider); //# sourceMappingURL=user-authentication.middleware.js.map