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.
31 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecurityRequestHandler = void 0;
const enums_1 = require("../../types/enums");
class SecurityRequestHandler {
constructor(context, connection, { action, provider }) {
this.context = context;
this.connection = connection;
this.didRun = false;
this.provider = provider;
this.action = action;
}
async run() {
if (this.didRun) {
return;
}
this.didRun = true;
switch (this.action) {
case enums_1.SECURITY_ACTION.LOGIN:
await this.provider.login(this.context);
break;
case enums_1.SECURITY_ACTION.LOGOUT:
await this.provider.logout(this.context);
break;
default:
this.context.error.internal();
}
}
}
exports.SecurityRequestHandler = SecurityRequestHandler;
//# sourceMappingURL=SecurityRequestHandler.js.map