UNPKG

angular-auth-oidc-client

Version:
65 lines 2.88 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseSchema = parseSchema; const angular_utils_1 = require("../../utils/angular-utils"); const schema_1 = require("../schema"); const AUTH_CONFIG_MODULE = { moduleFileName: 'auth-config.module', moduleName: 'AuthConfigModule', filesFolder: 'auth-config-module' }; const AUTH_HTTP_CONFIG_MODULE = { moduleFileName: 'auth-http-config.module', moduleName: 'AuthHttpConfigModule', filesFolder: 'auth-http-config-module', }; const AUTH_CONFIG_STANDALONE = { fileName: 'auth.config', configName: 'authConfig', filesFolder: 'auth-config-standalone' }; const AUTH_HTTP_CONFIG_STANDALONE = { fileName: 'auth-http.config', configName: 'authHttpConfig', filesFolder: 'auth-http-config-standalone', }; function needsHttp(flowType) { return flowType === schema_1.FlowType.OidcCodeFlowPkceUsingIframeSilentRenewGettingConfigFromHttp; } function needsSilentRenewHtml(flowType) { const optionsWithSilentRenewHtml = [ schema_1.FlowType.OidcCodeFlowPkceUsingIframeSilentRenewGettingConfigFromHttp, schema_1.FlowType.OidcCodeFlowPkceAzureAdUsingIframeSilentRenew, schema_1.FlowType.OidcCodeFlowPkceUsingIframeSilentRenew, ]; return optionsWithSilentRenewHtml.includes(flowType); } function getModuleInfo(flowType) { if (needsHttp(flowType)) { return AUTH_HTTP_CONFIG_MODULE; } return AUTH_CONFIG_MODULE; } function getStandaloneInfo(flowType) { if (needsHttp(flowType)) { return AUTH_HTTP_CONFIG_STANDALONE; } return AUTH_CONFIG_STANDALONE; } function parseSchema(host, options) { return __awaiter(this, void 0, void 0, function* () { const { flowType } = options; const isStandalone = yield (0, angular_utils_1.isStandaloneSchematic)(host, options); return Object.assign(Object.assign({}, options), { moduleInfo: isStandalone ? undefined : getModuleInfo(flowType), standaloneInfo: isStandalone ? getStandaloneInfo(flowType) : undefined, isHttpOption: needsHttp(flowType), needsSilentRenewHtml: needsSilentRenewHtml(flowType) }); }); } //# sourceMappingURL=schema-parser.js.map