UNPKG

2.04 kBJavaScriptView Raw
1/*
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5import { __assign } from "tslib";
6import { Logger } from "./Logger";
7import { UrlUtils } from "./utils/UrlUtils";
8/**
9 * Defaults for the Configuration Options
10 */
11var FRAME_TIMEOUT = 6000;
12var OFFSET = 300;
13var NAVIGATE_FRAME_WAIT = 500;
14var DEFAULT_AUTH_OPTIONS = {
15 clientId: "",
16 authority: null,
17 validateAuthority: true,
18 authorityMetadata: "",
19 knownAuthorities: [],
20 redirectUri: function () { return UrlUtils.getCurrentUrl(); },
21 postLogoutRedirectUri: function () { return UrlUtils.getCurrentUrl(); },
22 navigateToLoginRequestUrl: true
23};
24var DEFAULT_CACHE_OPTIONS = {
25 cacheLocation: "sessionStorage",
26 storeAuthStateInCookie: false
27};
28var DEFAULT_SYSTEM_OPTIONS = {
29 logger: new Logger(null),
30 loadFrameTimeout: FRAME_TIMEOUT,
31 tokenRenewalOffsetSeconds: OFFSET,
32 navigateFrameWait: NAVIGATE_FRAME_WAIT
33};
34var DEFAULT_FRAMEWORK_OPTIONS = {
35 isAngular: false,
36 unprotectedResources: new Array(),
37 protectedResourceMap: new Map()
38};
39/**
40 * MSAL function that sets the default options when not explicitly configured from app developer
41 *
42 * @param TAuthOptions
43 * @param TCacheOptions
44 * @param TSystemOptions
45 * @param TFrameworkOptions
46 * @param TAuthorityDataOptions
47 *
48 * @returns TConfiguration object
49 */
50export function buildConfiguration(_a) {
51 var auth = _a.auth, _b = _a.cache, cache = _b === void 0 ? {} : _b, _c = _a.system, system = _c === void 0 ? {} : _c, _d = _a.framework, framework = _d === void 0 ? {} : _d;
52 var overlayedConfig = {
53 auth: __assign(__assign({}, DEFAULT_AUTH_OPTIONS), auth),
54 cache: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), cache),
55 system: __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), system),
56 framework: __assign(__assign({}, DEFAULT_FRAMEWORK_OPTIONS), framework)
57 };
58 return overlayedConfig;
59}
60//# sourceMappingURL=Configuration.js.map
\No newline at end of file