1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | return new (P || (P = Promise))(function (resolve, reject) {
|
4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
7 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8 | });
|
9 | };
|
10 | Object.defineProperty(exports, "__esModule", { value: true });
|
11 | const config_1 = require("./config");
|
12 | const jwt_1 = require("./auth/jwt");
|
13 | const api_1 = require("./swagger/api");
|
14 | const config_2 = require("./swagger/config");
|
15 |
|
16 |
|
17 |
|
18 | function registerAuth(app, config, params, jwtIgnoreSwaggerUrl) {
|
19 | return __awaiter(this, void 0, void 0, function* () {
|
20 |
|
21 | config = config_1.normalizeAuth(config);
|
22 |
|
23 | jwt_1.registerJwtInternal(app, config.jwt, (!jwtIgnoreSwaggerUrl || !config.swagger.baseUrl) ? params.jwtIgnoreUrls : !params.jwtIgnoreUrls ? [config.swagger.baseUrl] : params.jwtIgnoreUrls.concat([config.swagger.baseUrl]));
|
24 |
|
25 | yield api_1.registerSwaggerApiInternal(app, config, params.swaggerBaseDir, config.swagger.outputDirs);
|
26 |
|
27 | return config_2.registerSwaggerConfigInternal(app, config, params.swaggerBaseDir);
|
28 | });
|
29 | }
|
30 | exports.registerAuth = registerAuth;
|
31 |
|
\ | No newline at end of file |