diff --git a/changelog.md b/changelog.md index c9394034fb..fea71733f8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -# 0.1.8 +# 0.1.9 ### New Features * Fixed bug to use acquireTokenRedirect to call your own APIS. https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/333 diff --git a/dist/msal.js b/dist/msal.js index 89cddfacd0..d68c9b4c0d 100644 --- a/dist/msal.js +++ b/dist/msal.js @@ -1,4 +1,4 @@ -/*! msal v0.1.8 2018-07-23 */ +/*! msal v0.1.9 2018-07-27 */ 'use strict'; (function webpackUniversalModuleDefinition(root, factory) { @@ -315,7 +315,7 @@ var Utils = /** @class */ (function () { return hex; }; Utils.getLibraryVersion = function () { - return "0.1.8"; + return "0.1.9"; }; /* * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d @@ -669,9 +669,12 @@ and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ -var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; function __extends(d, b) { extendStatics(d, b); @@ -679,12 +682,15 @@ function __extends(d, b) { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } -var __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; } - return t; + return __assign.apply(this, arguments); } function __rest(s, e) { diff --git a/dist/msal.js.map b/dist/msal.js.map index b7b79ad1d1..ff4796ca45 100644 --- a/dist/msal.js.map +++ b/dist/msal.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 69c9743edfd0c24a95f0","webpack:///./src/Utils.ts","webpack:///./src/Authority.ts","webpack:///./node_modules/tslib/tslib.es6.js","webpack:///./src/Constants.ts","webpack:///./src/Logger.ts","webpack:///./src/ErrorMessage.ts","webpack:///./src/RequestInfo.ts","webpack:///./src/User.ts","webpack:///./src/AadAuthority.ts","webpack:///./src/XHRClient.ts","webpack:///./src/index.ts","webpack:///./src/UserAgentApplication.ts","webpack:///./src/AccessTokenKey.ts","webpack:///./src/AccessTokenValue.ts","webpack:///./src/AuthenticationRequestParameters.ts","webpack:///./src/ClientInfo.ts","webpack:///./src/IdToken.ts","webpack:///./src/Storage.ts","webpack:///./src/AccessTokenCacheItem.ts","webpack:///./src/AuthorityFactory.ts","webpack:///./src/B2cAuthority.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;AC7DA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAKH;;GAEG;AACH;IAAA;IA2XA,CAAC;IA1XQ,oBAAc,GAArB,UAAsB,EAAQ,EAAE,EAAQ;QACvC,IAAI,CAAC,EAAE,IAAI,CAAC,EA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AmB,CAAC,IAAI,CAAC,+BAA+B,CAAC,eAAe,CAAC,EAAE;YAClF,OAAO,aAAa,CAAC;SACtB;QAED,OAAO,IAAI,OAAO,CAAS,UAAC,OAAO,EAAE,MAAM;YACzC,aAAM,CAAC,2BAAY,CAAC,8BAA8B,CAAC;QAAnD,CAAmD,CAAC,CAAC;IACzD,CAAC;IACH,mBAAC;AAAD,CAAC,CAnCiC,2BAAY,GAmC7C;AAnCY,oCAAY","file":"msal.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 69c9743edfd0c24a95f0","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { IUri } from \"./IUri\";\r\nimport { User } from \"./User\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Utils {\r\n static compareObjects(u1: User, u2: User): boolean {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static expiresIn(expires: string): number {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n }\r\n\r\n static now(): number {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n }\r\n\r\n static isEmpty(str: string): boolean {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n }\r\n\r\n static extractIdToken(encodedIdToken: string): any {\r\n // id token will be decoded to get the username\r\n const decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n const base64IdToken = decodedToken.JWSPayload;\r\n const base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n } catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n static base64EncodeStringUrlSafe(input: string): string {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n }\r\n\r\n static base64DecodeStringUrlSafe(base64IdToken: string): string {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n }\r\n\r\n static encode(input: string): string {\r\n const keyStr: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n let output = \"\";\r\n let chr1: number, chr2: number, chr3: number, enc1: number, enc2: number, enc3: number, enc4: number;\r\n var i = 0;\r\n\r\n input = this.utf8Encode(input);\r\n\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n } else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n }\r\n\r\n static utf8Encode(input: string): string {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n\r\n return utftext;\r\n }\r\n\r\n static decode(base64IdToken: string): string {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n let h1: number, h2: number, h3: number, h4: number, bits: number, c1: number, c2: number, c3: number, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n }\r\n\r\n static decodeJwt(jwtToken: string): any {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n const idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n const matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n const crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n }\r\n\r\n static deserialize(query: string): any {\r\n let match: Array; // Regex for replacing addition symbol with a space\r\n const pl = /\\+/g;\r\n const search = /([^&=]+)=([^&]*)/g;\r\n const decode = (s: string) => decodeURIComponent(s.replace(pl, \" \"));\r\n const obj: {} = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n }\r\n\r\n static isIntersectingScopes(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (let i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static containsScope(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every((value: any): boolean => cachedScopes.indexOf(value.toString().toLowerCase()) >= 0);\r\n }\r\n\r\n static convertToLowerCase(scopes: Array): Array {\r\n return scopes.map(scope => scope.toLowerCase());\r\n }\r\n\r\n static removeElement(scopes: Array, scope: string): Array {\r\n return scopes.filter(value => value !== scope);\r\n }\r\n\r\n static decimalToHex(num: number): string {\r\n var hex: string = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n }\r\n\r\n static getLibraryVersion(): string {\r\n return \"0.1.8\";\r\n }\r\n\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n static replaceFirstPath(href: string, tenantId: string): string {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n }\r\n\r\n static createNewGuid(): string {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n\r\n const cryptoObj: Crypto = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n const buffer: Uint8Array = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n const guidHolder: string = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n const hex: string = \"0123456789abcdef\";\r\n let r: number = 0;\r\n let guidResponse: string = \"\";\r\n for (let i: number = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n } else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n } else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n }\r\n\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n static GetUrlComponents(url: string): IUri {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n\r\n var match = url.match(regEx);\r\n\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n\r\n let urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n\r\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n }\r\n\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n static CanonicalizeUri(url: string): string {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n\r\n return url;\r\n }\r\n\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n static endsWith(url: string, suffix: string): boolean {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Utils.ts","import { IUri } from \"./IUri\";\r\nimport { Utils } from \"./Utils\";\r\nimport { ITenantDiscoveryResponse } from \"./ITenantDiscoveryResponse\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport enum AuthorityType {\r\n Aad,\r\n Adfs,\r\n B2C\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport abstract class Authority {\r\n constructor(authority: string, validateAuthority: boolean) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n\r\n this.validateAsUri();\r\n }\r\n\r\n public abstract get AuthorityType(): AuthorityType;\r\n\r\n public IsValidationEnabled: boolean;\r\n\r\n public get Tenant(): string {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n }\r\n\r\n private tenantDiscoveryResponse: ITenantDiscoveryResponse;\r\n\r\n public get AuthorizationEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get EndSessionEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get SelfSignedJwtAudience(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n private validateResolved() {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n }\r\n\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n public get CanonicalAuthority(): string {\r\n return this.canonicalAuthority;\r\n }\r\n\r\n public set CanonicalAuthority(url: string) {\r\n this.canonicalAuthority = Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n }\r\n\r\n private canonicalAuthority: string;\r\n private canonicalAuthorityUrlComponents: IUri;\r\n\r\n public get CanonicalAuthorityUrlComponents(): IUri {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n\r\n return this.canonicalAuthorityUrlComponents;\r\n }\r\n\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n protected get DefaultOpenIdConfigurationEndpoint(): string {\r\n return `${this.CanonicalAuthority}v2.0/.well-known/openid-configuration`;\r\n }\r\n\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n private validateAsUri() {\r\n let components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n } catch (e) {\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage.authorityUriInsecure;\r\n }\r\n\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage.authorityUriInvalidPath;\r\n }\r\n }\r\n\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n private DiscoverEndpoints(openIdConfigurationEndpoint: string): Promise {\r\n let client = new XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then((response: any) => {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n public ResolveEndpointsAsync(): Promise {\r\n let openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(openIdConfigurationEndpointResponse => {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then((tenantDiscoveryResponse: ITenantDiscoveryResponse) => {\r\n this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return this;\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public abstract GetOpenIdConfigurationEndpointAsync(): Promise;\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Authority.ts","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/tslib/tslib.es6.js\n// module id = 2\n// module chunks = 0 1","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Constants {\r\n static get errorDescription(): string { return \"error_description\"; }\r\n static get error(): string { return \"error\"; }\r\n static get scope(): string { return \"scope\"; }\r\n static get acquireTokenUser(): string { return \"msal.acquireTokenUser\"; }\r\n static get clientInfo(): string { return \"client_info\"; }\r\n static get clientId(): string { return \"clientId\"; }\r\n static get authority(): string { return \"msal.authority\"; }\r\n static get idToken(): string { return \"id_token\"; }\r\n static get accessToken(): string { return \"access_token\"; }\r\n static get expiresIn(): string { return \"expires_in\"; }\r\n static get sessionState(): string { return \"session_state\"; }\r\n static get msalClientInfo(): string { return \"msal.client.info\"; }\r\n static get msalError(): string { return \"msal.error\"; }\r\n static get msalErrorDescription(): string { return \"msal.error.description\"; }\r\n static get msalSessionState(): string { return \"msal.session.state\"; }\r\n static get tokenKeys(): string { return \"msal.token.keys\"; }\r\n static get accessTokenKey(): string { return \"msal.access.token.key\"; }\r\n static get expirationKey(): string { return \"msal.expiration.key\"; }\r\n static get stateLogin(): string { return \"msal.state.login\"; }\r\n static get stateAcquireToken(): string { return \"msal.state.acquireToken\"; }\r\n static get stateRenew(): string { return \"msal.state.renew\"; }\r\n static get nonceIdToken(): string { return \"msal.nonce.idtoken\"; }\r\n static get userName(): string { return \"msal.username\"; }\r\n static get idTokenKey(): string { return \"msal.idtoken\"; }\r\n static get loginRequest(): string { return \"msal.login.request\"; }\r\n static get loginError(): string { return \"msal.login.error\"; }\r\n static get renewStatus(): string { return \"msal.token.renew.status\"; }\r\n static get msal(): string { return \"msal\"; }\r\n static get resourceDelimeter(): string { return \"|\"; }\r\n static get tokenRenewStatusCancelled(): string { return \"Canceled\"; }\r\n static get tokenRenewStatusCompleted(): string { return \"Completed\"; }\r\n static get tokenRenewStatusInProgress(): string { return \"In Progress\"; }\r\n private static _popUpWidth: number = 483;\r\n static get popUpWidth(): number { return this._popUpWidth; }\r\n static set popUpWidth(width: number) {\r\n this._popUpWidth = width;\r\n }\r\n private static _popUpHeight: number = 600;\r\n static get popUpHeight(): number { return this._popUpHeight; }\r\n static set popUpHeight(height: number) {\r\n this._popUpHeight = height;\r\n }\r\n static get login(): string { return \"LOGIN\"; }\r\n static get renewToken(): string { return \"RENEW_TOKEN\"; }\r\n static get unknown(): string { return \"UNKNOWN\"; }\r\n static get urlHash(): string { return \"msal.urlHash\"; }\r\n static get angularLoginRequest(): string { return \"msal.angular.login.request\"; }\r\n static get userIdentifier(): string { return \"userIdentifier\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorCodes {\r\n static get loginProgressError(): string { return \"login_progress_error\"; }\r\n static get acquireTokenProgressError(): string { return \"acquiretoken_progress_error\"; }\r\n static get inputScopesError(): string { return \"input_scopes_error\"; }\r\n static get endpointResolutionError(): string { return \"endpoints_resolution_error\"; }\r\n static get popUpWindowError(): string { return \"popup_window_error\"; }\r\n static get userLoginError(): string { return \"user_login_error\"; }\r\n static get userCancelledError(): string { return \"user_cancelled\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorDescription {\r\n static get loginProgressError(): string { return \"Login is in progress\"; }\r\n static get acquireTokenProgressError(): string { return \"Acquire token is in progress\"; }\r\n static get inputScopesError(): string { return \"Invalid value of input scopes provided\"; }\r\n static get endpointResolutionError(): string { return \"Endpoints cannot be resolved\"; }\r\n static get popUpWindowError(): string { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; }\r\n static get userLoginError(): string { return \"User login is required\"; }\r\n static get userCancelledError(): string { return \"User closed the popup window window and cancelled the flow\"; }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport interface ILoggerCallback {\r\n (level: LogLevel, message: string, containsPii: boolean): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Error,\r\n Warning,\r\n Info,\r\n Verbose\r\n}\r\n\r\nexport class Logger {// Singleton Class\r\n\r\n /*\r\n * @hidden\r\n */\r\n private static _instance: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _correlationId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _level: LogLevel = LogLevel.Info;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _piiLoggingEnabled: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _localCallback: ILoggerCallback;\r\n\r\n constructor(localCallback: ILoggerCallback,\r\n options:\r\n {\r\n correlationId?: string,\r\n level?: LogLevel,\r\n piiLoggingEnabled?: boolean,\r\n } = {}) {\r\n const {\r\n correlationId = \"\",\r\n level = LogLevel.Info,\r\n piiLoggingEnabled = false\r\n } = options;\r\n\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n private logMessage(logLevel: LogLevel, logMessage: string, containsPii: boolean): void {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log: string;\r\n if (!Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n executeCallback(level: LogLevel, message: string, containsPii: boolean) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n error(message: string): void {\r\n this.logMessage(LogLevel.Error, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n errorPii(message: string): void {\r\n this.logMessage(LogLevel.Error, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warning(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warningPii(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n info(message: string): void {\r\n this.logMessage(LogLevel.Info, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n infoPii(message: string): void {\r\n this.logMessage(LogLevel.Info, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbose(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbosePii(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Logger.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorMessage {\r\n static get authorityUriInvalidPath(): string { return \"AuthorityUriInvalidPath\"; }\r\n static get authorityUriInsecure(): string { return \"AuthorityUriInsecure\"; }\r\n static get invalidAuthorityType(): string { return \"InvalidAuthorityType\"; }\r\n static get unsupportedAuthorityValidation(): string { return \"UnsupportedAuthorityValidation\"; }\r\n static get b2cAuthorityUriInvalidPath(): string { return \"B2cAuthorityUriInvalidPath\"; }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ErrorMessage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class TokenResponse {\r\n valid: boolean;\r\n parameters: Object;\r\n stateMatch: boolean;\r\n stateResponse: string;\r\n requestType: string;\r\n\r\n constructor() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/RequestInfo.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport class User {\r\n\r\n displayableId: string;\r\n name: string;\r\n identityProvider: string;\r\n userIdentifier: string;\r\n idToken: Object\r\n\r\n /*\r\n * @hidden\r\n */\r\n constructor(displayableId: string, name: string, identityProvider: string, userIdentifier: string, idToken:Object) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n static createUser(idToken: IdToken, clientInfo: ClientInfo, authority: string): User {\r\n let uid: string;\r\n let utid: string;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n\r\n const userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n }\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/User.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class AadAuthority extends Authority {\r\n private static readonly AadInstanceDiscoveryEndpoint: string = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n\r\n private get AadInstanceDiscoveryEndpointUrl(): string {\r\n return `${AadAuthority.AadInstanceDiscoveryEndpoint}?api-version=1.0&authorization_endpoint=${this.CanonicalAuthority}oauth2/v2.0/authorize`;\r\n }\r\n\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.Aad;\r\n }\r\n\r\n private static readonly TrustedHostList: any = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise: Promise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n let host: string = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n\r\n let client: XhrClient = new XhrClient();\r\n\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then((response) => {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n public IsInTrustedHostList(host: string): boolean {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AadAuthority.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nexport class XhrClient {\r\n public sendRequestAsync(url: string, method: string, enableCaching?: boolean): Promise {\r\n return new Promise((resolve, reject) => {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n\r\n xhr.onload = (ev) => {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n } catch (e) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n resolve(jsonResponse);\r\n };\r\n\r\n xhr.onerror = (ev) => {\r\n reject(xhr.status);\r\n };\r\n\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n }\r\n\r\n protected handleError(responseText: string): any {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n } else {\r\n throw responseText;\r\n }\r\n } catch (e) {\r\n return responseText;\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/XHRClient.ts","export { UserAgentApplication } from \"./UserAgentApplication\";\r\nexport { Logger } from \"./Logger\";\r\nexport { LogLevel } from \"./Logger\";\r\nexport { User } from \"./User\";\r\nexport { Constants } from \"./Constants\";\r\nexport { TokenResponse} from \"./RequestInfo\";\r\nexport {Authority} from \"./Authority\";\r\nexport {CacheResult} from \"./UserAgentApplication\";\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\nimport { AuthenticationRequestParameters } from \"./AuthenticationRequestParameters\";\r\nimport { Authority } from \"./Authority\";\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { Constants, ErrorCodes, ErrorDescription } from \"./Constants\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Logger } from \"./Logger\";\r\nimport { Storage } from \"./Storage\";\r\nimport { TokenResponse } from \"./RequestInfo\";\r\nimport { User } from \"./User\";\r\nimport { Utils } from \"./Utils\";\r\nimport { AuthorityFactory } from \"./AuthorityFactory\";\r\n\r\ndeclare global {\r\n interface Window {\r\n msal: Object;\r\n CustomEvent: CustomEvent;\r\n Event: Event;\r\n activeRenewals: {};\r\n renewStates: Array;\r\n callBackMappedToRenewStates : {};\r\n callBacksMappedToRenewStates: {};\r\n openedWindows: Array;\r\n requestType: string;\r\n }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nlet ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport interface CacheResult {\r\n errorDesc: string;\r\n token: string;\r\n error: string;\r\n}\r\n\r\n/*\r\n * A type alias of for a tokenReceivedCallback function.\r\n * @param tokenReceivedCallback.errorDesc error description returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.token token returned from STS if token request is successful.\r\n * @param tokenReceivedCallback.error error code returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.tokenType tokenType returned from the STS if API call is successful. Possible values are: id_token OR access_token.\r\n */\r\nexport type tokenReceivedCallback = (errorDesc: string, token: string, error: string, tokenType: string) => void;\r\nconst resolveTokenOnlyIfOutOfIframe = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\r\n const tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function (...args: any[]) {\r\n return this.isInIframe()\r\n ? new Promise(() => { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nexport class UserAgentApplication {\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocation: string;\r\n\r\n /*\r\n * Used to get the cache location\r\n */\r\n get cacheLocation(): string {\r\n return this._cacheLocation;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _logger: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _loginInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _acquireTokenInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _clockSkew = 300;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _cacheStorage: Storage;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _tokenReceivedCallback: tokenReceivedCallback = null;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _user: User;\r\n\r\n /*\r\n * Client ID assigned to your app by Azure Active Directory.\r\n */\r\n clientId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected authorityInstance: Authority;\r\n\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n public set authority(val) {\r\n this.authorityInstance = AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n }\r\n\r\n /*\r\n * Used to get the authority.\r\n */\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n /*\r\n * Used to turn authority validation on/off.\r\n * When set to true (default), MSAL will compare the application\"s authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.\r\n */\r\n validateAuthority: boolean;\r\n\r\n /*\r\n * The redirect URI of the application, this should be same as the value in the application registration portal.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _redirectUri: string;\r\n\r\n /*\r\n * Used to redirect the user to this location after logout.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _postLogoutredirectUri: string;\r\n\r\n loadFrameTimeout: number;\r\n\r\n protected _navigateToLoginRequestUrl: boolean;\r\n\r\n private _isAngular: boolean = false;\r\n\r\n private _endpoints: Map>;\r\n\r\n private _anonymousEndpoints: Array;\r\n\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n constructor(\r\n clientId: string,\r\n authority: string | null,\r\n tokenReceivedCallback: tokenReceivedCallback,\r\n options:\r\n {\r\n validateAuthority?: boolean,\r\n cacheLocation?: string,\r\n redirectUri?: string,\r\n postLogoutRedirectUri?: string,\r\n logger?: Logger,\r\n loadFrameTimeout?: number,\r\n navigateToLoginRequestUrl?: boolean,\r\n isAngular?: boolean,\r\n anonymousEndpoints?: Array\r\n endPoints?:Map>\r\n } = {}) {\r\n const {\r\n validateAuthority = true,\r\n cacheLocation = \"sessionStorage\",\r\n redirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n postLogoutRedirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n logger = new Logger(null),\r\n loadFrameTimeout = 6000,\r\n navigateToLoginRequestUrl = true,\r\n isAngular = false,\r\n anonymousEndpoints = new Array(),\r\n endPoints = new Map>(),\r\n } = options;\r\n\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n\r\n this._cacheStorage = new Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = { };\r\n window.callBacksMappedToRenewStates = { };\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private processCallBack(hash: string): void {\r\n this._logger.info('Processing the callback from redirect response');\r\n const requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n const token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n const errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n const error = requestInfo.parameters[Constants.error];\r\n var tokenType: string;\r\n\r\n if (requestInfo.parameters[Constants.accessToken]) {\r\n tokenType = Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n this._cacheStorage.removeItem(Constants.urlHash);\r\n\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n }\r\n\r\n \r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n loginRedirect(scopes?: Array, extraQueryParameters?: string): void {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.loginProgressError, null, ErrorCodes.loginProgressError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n this._loginInProgress = true;\r\n \r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n var loginStartPage = this._cacheStorage.getItem(Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants.angularLoginRequest, \"\")\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, loginStartPage);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n this.promptUser(urlNavigate);\r\n });\r\n }\r\n\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n loginPopup(scopes: Array, extraQueryParameters?: string): Promise {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise((resolve, reject) => {\r\n if (this._loginInProgress) {\r\n reject(ErrorCodes.loginProgressError + \"|\" + ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n\r\n scopes = this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [this.clientId];\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n \r\n this._loginInProgress = true;\r\n\r\n this.authorityInstance.ResolveEndpointsAsync().then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, window.location.href);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.login;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n }\r\n\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n private promptUser(urlNavigate: string) {\r\n if (urlNavigate && !Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n } else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n }\r\n\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n private openWindow(urlNavigate: string, title: string, interval: number, instance: this, resolve?: Function, reject?: Function): Window {\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(ErrorCodes.popUpWindowError + \":\" + ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(ErrorCodes.popUpWindowError + \"|\" + ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(() => {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpClosed', ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(\"Closing popup window\");\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n },\r\n interval);\r\n\r\n return popupWindow;\r\n }\r\n\r\n private broadcast(eventName: string, data: string) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n }\r\n\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n logout(): void {\r\n this.clearCache();\r\n this._user = null;\r\n let logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n\r\n const urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n }\r\n\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected clearCache(): void {\r\n window.renewStates = [];\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n }\r\n\r\n clearCacheForScope(accessToken: string) {\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++){\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n }\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n const winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n const left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n const top = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n\r\n const popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n\r\n return popupWindow;\r\n } catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n private validateInputScope(scopes: Array): string {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n private filterScopes(scopes: Array): Array {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n\r\n return scopes;\r\n }\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n private registerCallback(expectedState: string, scope: string, resolve: Function, reject: Function): void {\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n (errorDesc: string, token: string, error: string, tokenType: string) => {\r\n window.activeRenewals[scope] = null;\r\n for (let i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n } catch (e) {\r\n this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n }\r\n\r\n\r\nprotected getCachedTokenInternal(scopes : Array , user: User): CacheResult\r\n{\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = this.authorityInstance?this.authorityInstance: AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n return this.getCachedToken(authenticationRequest, user);\r\n}\r\n\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n private getCachedToken(authenticationRequest: AuthenticationRequestParameters, user: User): CacheResult {\r\n let accessTokenCacheItem: AccessTokenCacheItem = null;\r\n const scopes = authenticationRequest.scopes;\r\n const tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier:null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n\r\n const filteredItems: Array = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n const authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n\r\n if (accessTokenCacheItem != null) {\r\n const expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n const offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n } else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n getAllUsers(): Array {\r\n const users: Array = [];\r\n const accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const idToken = new IdToken(accessTokenCacheItems[i].value.idToken);\r\n const clientInfo = new ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n const user = User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n\r\n return this.getUniqueUsers(users);\r\n }\r\n\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueUsers(users: Array): Array {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n\r\n const flags: Array = [];\r\n const uniqueUsers: Array = [];\r\n for (let index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n\r\n return uniqueUsers;\r\n }\r\n\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueAuthority(accessTokenCacheItems: Array, property: string): Array {\r\n const authorityList: Array = [];\r\n const flags: Array = [];\r\n accessTokenCacheItems.forEach(element => {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n }\r\n\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n private addHintParameters(urlNavigate: string, user: User): string {\r\n const userObject = user ? user : this.getUser();\r\n const decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n const uid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n const utid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n\r\n if (!Utils.isEmpty(uid) && !Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n } else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n\r\n return urlNavigate;\r\n }\r\n\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n private urlContainsQueryStringParameter(name: string, url: string): boolean {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n const regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n }\r\n\r\n /*\r\n * Used to obtain an access_token by redirecting the user to the authorization endpoint.\r\n * To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://{instance}/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://{instance}/tfp/<tenant>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n */\r\n acquireTokenRedirect(scopes: Array): void;\r\n acquireTokenRedirect(scopes: Array, authority: string): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User, extraQueryParameters: string): void;\r\n acquireTokenRedirect(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): void {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.userLoginError, null, ErrorCodes.userLoginError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n this._cacheStorage.setItem(Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Used to acquire an access token for a new user using interactive authentication via a popup Window.\r\n * To request an id_token, pass the clientId as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\".\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n acquireTokenPopup(scopes: Array): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User, extraQueryParameters: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n reject(ErrorCodes.acquireTokenProgressError + \"|\" + ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \"|\" + ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n @resolveTokenOnlyIfOutOfIframe\r\n acquireTokenSilent(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n } else {\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n const cacheResult = this.getCachedToken(authenticationRequest, userObject);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n this._logger.info(\"Token is already in cache for scope:\" + scope);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n this._logger.verbose(\"Token is not in cache for scope:\" + scope);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(() => {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope]) {\r\n this._logger.verbose(\"Renew token for scope: \" + scope + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n this.registerCallback(window.activeRenewals[scope], scope, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n this._logger.verbose(\"renewing idToken\");\r\n this.renewIdToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n } else {\r\n this._logger.verbose(\"renewing accesstoken\");\r\n this.renewToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n }\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadIframeTimeout(urlNavigate: string, frameName: string, scope: string): void {\r\n //set iframe session to pending\r\n const expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(() => {\r\n if (this._cacheStorage.getItem(Constants.renewStatus + expectedState) === Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n this._logger.verbose(\"Loading frame has timed out after: \" + (this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants.accessToken);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n }\r\n\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadFrame(urlNavigate: string, frameName: string): void {\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(() => {\r\n var frameHandle = this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n },\r\n 500);\r\n }\r\n\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n private addAdalFrame(iframeId: string): HTMLIFrameElement {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n let adalFrame = document.getElementById(iframeId) as HTMLIFrameElement;\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n const ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = (document.getElementsByTagName(\"body\")[0].appendChild(ifr) as HTMLIFrameElement);\r\n } else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n\r\n return adalFrame;\r\n }\r\n\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n const frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n }\r\n\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewIdToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n const frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n }\r\n\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n getUser(): User {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n\r\n // frame is used to get idToken\r\n const rawIdToken = this._cacheStorage.getItem(Constants.idTokenKey);\r\n const rawClientInfo = this._cacheStorage.getItem(Constants.msalClientInfo);\r\n if (!Utils.isEmpty(rawIdToken) && !Utils.isEmpty(rawClientInfo)) {\r\n const idToken = new IdToken(rawIdToken);\r\n const clientInfo = new ClientInfo(rawClientInfo);\r\n this._user = User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private handleAuthenticationResponse(hash: string): void {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n\r\n var self = null;\r\n var isPopup: boolean = false;\r\n var isWindowOpenerMsal = false;\r\n\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n } catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n\r\n const requestInfo = self.getRequestInfo(hash);//if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n let token: string = null, tokenReceivedCallback: (errorDesc: string, token: string, error: string, tokenType: string) => void = null, tokenType: string, saveToken:boolean = true;\r\n \r\n self._logger.info(\"Returned from redirect url\");\r\n \r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n\r\n }\r\n\r\n self.saveTokenFromHash(requestInfo);\r\n\r\n if ((requestInfo.requestType === Constants.renewToken) && window.parent) {\r\n if (window.parent!==window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n } else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n\r\n token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.accessToken;\r\n } else if (requestInfo.requestType === Constants.login) {\r\n token = requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n var errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants.error];\r\n \r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n private saveAccessToken(authority: string, tokenResponse: TokenResponse, user: User, clientInfo: string, idToken: IdToken): void {\r\n let scope: string;\r\n let clientObj: ClientInfo = new ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n const consentedScopes = scope.split(\" \");\r\n const accessTokenCacheItems =\r\n this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n const cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.accessToken], idToken.rawIdToken, Utils.expiresIn(tokenResponse.parameters[Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n } else {\r\n scope = this.clientId;\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.idToken], tokenResponse.parameters[Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n }\r\n\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected saveTokenFromHash(tokenResponse: TokenResponse): void {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n var scope: string = \"\";\r\n var authorityKey: string = \"\";\r\n var acquireTokenUserKey: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, tokenResponse.parameters[Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants.loginError, tokenResponse.parameters[Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants.error]);\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n if (tokenResponse.requestType === Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userKey + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n } else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants.msalSessionState, tokenResponse.parameters[Constants.sessionState]);\r\n }\r\n \r\n var idToken: IdToken;\r\n var clientInfo: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n let user: User;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n } else {\r\n idToken = new IdToken(this._cacheStorage.getItem(Constants.idTokenKey));\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n }\r\n\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let acquireTokenUser: User;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\r\n \"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n } else {\r\n this._logger.warning(\r\n \"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n this._user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n } else {\r\n this._cacheStorage.setItem(Constants.idTokenKey, tokenResponse.parameters[Constants.idToken]);\r\n this._cacheStorage.setItem(Constants.msalClientInfo, clientInfo);\r\n\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants.idToken];\r\n this._cacheStorage.setItem(Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants.idToken]);\r\n }\r\n }\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants.renewStatus + tokenResponse.stateResponse, Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n }\r\n\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n isCallback(hash: string): boolean {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n return (\r\n parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)\r\n\r\n );\r\n }\r\n\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private getHash(hash: string): string {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n } else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n\r\n return hash;\r\n }\r\n\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected getRequestInfo(hash: string): TokenResponse {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n const tokenResponse = new TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n let stateResponse: string;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n } else {\r\n return tokenResponse;\r\n }\r\n\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n } else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n const statesInParentContext = window.renewStates;\r\n for (let i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n }\r\n\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n private getScopeFromState(state: string): string {\r\n if (state) {\r\n const splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n private isInIframe() {\r\n return window.parent !== window;\r\n }\r\n\r\n loginInProgress(): boolean {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n }\r\n\r\n private getHostFromUri(uri: string): string {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n }\r\n \r\n getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._endpoints.size > 0) {\r\n for (let key of Array.from(this._endpoints.keys())) {\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n }\r\n\r\n //These APIS are exposed for msalAngular wrapper only\r\n protected setloginInProgress(loginInProgress : boolean) {\r\n this._loginInProgress = loginInProgress;\r\n }\r\n\r\n protected getAcquireTokenInProgress(): boolean\r\n {\r\n return this._acquireTokenInProgress;\r\n }\r\n\r\n protected setAcquireTokenInProgress(acquireTokenInProgress : boolean) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n }\r\n\r\n protected getLogger()\r\n {\r\n return this._logger;\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/UserAgentApplication.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenKey {\r\n\r\n authority: string;\r\n clientId: string;\r\n userIdentifier: string;\r\n scopes: string;\r\n\r\n constructor(authority: string, clientId: string, scopes: string, uid: string, utid: string) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenKey.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenValue {\r\n\r\n accessToken: string;\r\n idToken: string;\r\n expiresIn: string;\r\n clientInfo: string;\r\n\r\n constructor(accessToken: string, idToken: string, expiresIn: string, clientInfo: string) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenValue.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority } from \"./Authority\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AuthenticationRequestParameters {\r\n authorityInstance: Authority;\r\n clientId: string;\r\n nonce: string;\r\n state: string;\r\n correlationId: string;\r\n xClientVer: string;\r\n xClientSku: string;\r\n scopes: Array;\r\n responseType: string;\r\n promptValue: string;\r\n extraQueryParameters: string;\r\n loginHint: string;\r\n domainHint: string;\r\n redirectUri: string;\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n constructor(authority: Authority, clientId: string, scope: Array, responseType: string, redirectUri: string) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils.createNewGuid();\r\n this.state = Utils.createNewGuid();\r\n this.nonce = Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils.getLibraryVersion();\r\n }\r\n\r\n createNavigateUrl(scopes: Array): string {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n\r\n const str: Array = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(`x-client-SKU=${this.xClientSku}`);\r\n str.push(`x-client-Ver=${this.xClientVer}`);\r\n\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n let authEndpoint: string = this.authorityInstance.AuthorizationEndpoint;\r\n\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n } else {\r\n authEndpoint += \"&\";\r\n }\r\n\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n translateclientIdUsedInScope(scopes: Array): void {\r\n const clientIdIndex: number = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n }\r\n\r\n parseScope(scopes: Array): string {\r\n let scopeList: string = \"\";\r\n if (scopes) {\r\n for (let i: number = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n\r\n return scopeList;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationRequestParameters.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ClientInfo {\r\n\r\n private _uid: string;\r\n get uid(): string {\r\n return this._uid ? this._uid : \"\";\r\n }\r\n\r\n set uid(uid: string) {\r\n this._uid = uid;\r\n }\r\n\r\n private _utid: string;\r\n get utid(): string {\r\n return this._utid ? this._utid : \"\";\r\n }\r\n\r\n set utid(utid: string) {\r\n this._utid = utid;\r\n }\r\n\r\n constructor(rawClientInfo: string) {\r\n if (!rawClientInfo || Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n const clientInfo: ClientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ClientInfo.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class IdToken {\r\n\r\n issuer: string;\r\n objectId: string;\r\n subject: string;\r\n tenantId: string;\r\n version: string;\r\n preferredName: string;\r\n name: string;\r\n homeObjectId: string;\r\n nonce: string;\r\n expiration: string;\r\n rawIdToken: string;\r\n decodedIdToken: Object\r\n\r\n constructor(rawIdToken: string) {\r\n if (Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/IdToken.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Constants } from \"./Constants\";\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Storage {// Singleton\r\n\r\n private static _instance: Storage;\r\n private _localStorageSupported: boolean;\r\n private _sessionStorageSupported: boolean;\r\n private _cacheLocation: string;\r\n\r\n constructor(cacheLocation: string) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n\r\n return Storage._instance;\r\n }\r\n\r\n // add value to storage\r\n setItem(key: string, value: string): void {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string): string {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // remove value from storage\r\n removeItem(key: string): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // clear storage (remove all items from it)\r\n clear(): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n getAllAccessTokens(clientId: string, userIdentifier: string): Array {\r\n const results: Array = [];\r\n let accessTokenCacheItem: AccessTokenCacheItem;\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n let value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n\r\n return results;\r\n }\r\n\r\n removeAcquireTokenEntries(authorityKey: string, acquireTokenUserKey: string): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey!= \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n resetCacheItems(): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.msal) !== -1) {\r\n this.setItem(key,\"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Storage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenCacheItem {\r\n\r\n key: AccessTokenKey;\r\n value: AccessTokenValue;\r\n\r\n constructor(key: AccessTokenKey, value: AccessTokenValue) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenCacheItem.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nimport { Utils } from \"./Utils\";\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { B2cAuthority } from \"./B2cAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\n\r\nexport class AuthorityFactory {\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n private static DetectAuthorityFromUrl(authorityUrl: string): AuthorityType {\r\n authorityUrl = Utils.CanonicalizeUri(authorityUrl);\r\n let components = Utils.GetUrlComponents(authorityUrl);\r\n let pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return AuthorityType.B2C;\r\n case \"adfs\":\r\n return AuthorityType.Adfs;\r\n default:\r\n return AuthorityType.Aad;\r\n }\r\n }\r\n\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n public static CreateInstance(authorityUrl: string, validateAuthority: boolean): Authority {\r\n let type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case AuthorityType.B2C:\r\n return new B2cAuthority(authorityUrl, validateAuthority);\r\n case AuthorityType.Aad:\r\n return new AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthorityFactory.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class B2cAuthority extends AadAuthority {\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n let urlComponents = Utils.GetUrlComponents(authority);\r\n\r\n let pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n\r\n this.CanonicalAuthority = `https://${urlComponents.HostNameAndPort}/${pathSegments[0]}/${pathSegments[1]}/${pathSegments[2]}/`;\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.B2C;\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n reject(ErrorMessage.unsupportedAuthorityValidation));\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/B2cAuthority.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap ae24f8fce33e1fd2db85","webpack:///./src/Utils.ts","webpack:///./src/Authority.ts","webpack:///./node_modules/tslib/tslib.es6.js","webpack:///./src/Constants.ts","webpack:///./src/Logger.ts","webpack:///./src/ErrorMessage.ts","webpack:///./src/RequestInfo.ts","webpack:///./src/User.ts","webpack:///./src/AadAuthority.ts","webpack:///./src/XHRClient.ts","webpack:///./src/index.ts","webpack:///./src/UserAgentApplication.ts","webpack:///./src/AccessTokenKey.ts","webpack:///./src/AccessTokenValue.ts","webpack:///./src/AuthenticationRequestParameters.ts","webpack:///./src/ClientInfo.ts","webpack:///./src/IdToken.ts","webpack:///./src/Storage.ts","webpack:///./src/AccessTokenCacheItem.ts","webpack:///./src/AuthorityFactory.ts","webpack:///./src/B2cAuthority.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;AC7DA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAKH;;GAEG;AACH;IAAA;IA2XA,CAAC;IA1XQ,oBAAc,GAArB,UAAsB,EAAQ,EAAE,EAAQ;QACvC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE;YACT,OAAO,KAAK,CAAC;SAChB;QACH,IAAI,EAAE,CAAC,cAAc,IAAI,EAAE,CAAC,cAAc,EAAE;YAC1C,IAAI,EAAE,CAAC,cAAc,KAAK,EAAE,CAAC,cAAc,EAAE;gBAC3C,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,eAAS,GAAhB,UAAiB,OAAe;QAC9B,0JAA0J;QACzJ,IAAI,CAAC,OAAO,EAAE;YACV,OAAO,GAAG,MAAM,CAAC;SACnB;QACH,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,C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;IAC5C,sBAAmB,SAAiB,EAAE,iBAA0B;QAAhE,YACE,kBAAM,SAAS,EAAE,iBAAiB,CAAC,SASpC;QARC,IAAI,aAAa,GAAG,aAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAEtD,IAAI,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;QAC9C,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YACzB,MAAM,2BAAY,CAAC,0BAA0B,CAAC;SACjD;QAED,KAAI,CAAC,kBAAkB,GAAG,aAAW,aAAa,CAAC,eAAe,SAAI,YAAY,CAAC,CAAC,CAAC,SAAI,YAAY,CAAC,CAAC,CAAC,SAAI,YAAY,CAAC,CAAC,CAAC,MAAG,CAAC;;IACjI,CAAC;IAED,sBAAW,uCAAa;aAAxB;YACE,OAAO,yBAAa,CAAC,GAAG,CAAC;QAC3B,CAAC;;;OAAA;IAED;;OAEG;IACI,0DAAmC,GAA1C;QAAA,iBAcC;QAbC,IAAI,aAAa,GAAG,IAAI,OAAO,CAAS,UAAC,OAAO,EAAE,MAAM;YACtD,cAAO,CAAC,KAAI,CAAC,kCAAkC,CAAC;QAAhD,CAAgD,CAAC,CAAC;QAEpD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC7B,OAAO,aAAa,CAAC;SACtB;QAED,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,+BAA+B,CAAC,eAAe,CAAC,EAAE;YAClF,OAAO,aAAa,CAAC;SACtB;QAED,OAAO,IAAI,OAAO,CAAS,UAAC,OAAO,EAAE,MAAM;YACzC,aAAM,CAAC,2BAAY,CAAC,8BAA8B,CAAC;QAAnD,CAAmD,CAAC,CAAC;IACzD,CAAC;IACH,mBAAC;AAAD,CAAC,CAnCiC,2BAAY,GAmC7C;AAnCY,oCAAY","file":"msal.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ae24f8fce33e1fd2db85","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { IUri } from \"./IUri\";\r\nimport { User } from \"./User\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Utils {\r\n static compareObjects(u1: User, u2: User): boolean {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static expiresIn(expires: string): number {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n }\r\n\r\n static now(): number {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n }\r\n\r\n static isEmpty(str: string): boolean {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n }\r\n\r\n static extractIdToken(encodedIdToken: string): any {\r\n // id token will be decoded to get the username\r\n const decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n const base64IdToken = decodedToken.JWSPayload;\r\n const base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n } catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n static base64EncodeStringUrlSafe(input: string): string {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n }\r\n\r\n static base64DecodeStringUrlSafe(base64IdToken: string): string {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n }\r\n\r\n static encode(input: string): string {\r\n const keyStr: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n let output = \"\";\r\n let chr1: number, chr2: number, chr3: number, enc1: number, enc2: number, enc3: number, enc4: number;\r\n var i = 0;\r\n\r\n input = this.utf8Encode(input);\r\n\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n } else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n }\r\n\r\n static utf8Encode(input: string): string {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n\r\n return utftext;\r\n }\r\n\r\n static decode(base64IdToken: string): string {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n let h1: number, h2: number, h3: number, h4: number, bits: number, c1: number, c2: number, c3: number, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n }\r\n\r\n static decodeJwt(jwtToken: string): any {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n const idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n const matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n const crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n }\r\n\r\n static deserialize(query: string): any {\r\n let match: Array; // Regex for replacing addition symbol with a space\r\n const pl = /\\+/g;\r\n const search = /([^&=]+)=([^&]*)/g;\r\n const decode = (s: string) => decodeURIComponent(s.replace(pl, \" \"));\r\n const obj: {} = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n }\r\n\r\n static isIntersectingScopes(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (let i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static containsScope(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every((value: any): boolean => cachedScopes.indexOf(value.toString().toLowerCase()) >= 0);\r\n }\r\n\r\n static convertToLowerCase(scopes: Array): Array {\r\n return scopes.map(scope => scope.toLowerCase());\r\n }\r\n\r\n static removeElement(scopes: Array, scope: string): Array {\r\n return scopes.filter(value => value !== scope);\r\n }\r\n\r\n static decimalToHex(num: number): string {\r\n var hex: string = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n }\r\n\r\n static getLibraryVersion(): string {\r\n return \"0.1.9\";\r\n }\r\n\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n static replaceFirstPath(href: string, tenantId: string): string {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n }\r\n\r\n static createNewGuid(): string {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n\r\n const cryptoObj: Crypto = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n const buffer: Uint8Array = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n const guidHolder: string = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n const hex: string = \"0123456789abcdef\";\r\n let r: number = 0;\r\n let guidResponse: string = \"\";\r\n for (let i: number = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n } else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n } else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n }\r\n\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n static GetUrlComponents(url: string): IUri {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n\r\n var match = url.match(regEx);\r\n\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n\r\n let urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n\r\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n }\r\n\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n static CanonicalizeUri(url: string): string {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n\r\n return url;\r\n }\r\n\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n static endsWith(url: string, suffix: string): boolean {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Utils.ts","import { IUri } from \"./IUri\";\r\nimport { Utils } from \"./Utils\";\r\nimport { ITenantDiscoveryResponse } from \"./ITenantDiscoveryResponse\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport enum AuthorityType {\r\n Aad,\r\n Adfs,\r\n B2C\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport abstract class Authority {\r\n constructor(authority: string, validateAuthority: boolean) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n\r\n this.validateAsUri();\r\n }\r\n\r\n public abstract get AuthorityType(): AuthorityType;\r\n\r\n public IsValidationEnabled: boolean;\r\n\r\n public get Tenant(): string {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n }\r\n\r\n private tenantDiscoveryResponse: ITenantDiscoveryResponse;\r\n\r\n public get AuthorizationEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get EndSessionEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get SelfSignedJwtAudience(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n private validateResolved() {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n }\r\n\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n public get CanonicalAuthority(): string {\r\n return this.canonicalAuthority;\r\n }\r\n\r\n public set CanonicalAuthority(url: string) {\r\n this.canonicalAuthority = Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n }\r\n\r\n private canonicalAuthority: string;\r\n private canonicalAuthorityUrlComponents: IUri;\r\n\r\n public get CanonicalAuthorityUrlComponents(): IUri {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n\r\n return this.canonicalAuthorityUrlComponents;\r\n }\r\n\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n protected get DefaultOpenIdConfigurationEndpoint(): string {\r\n return `${this.CanonicalAuthority}v2.0/.well-known/openid-configuration`;\r\n }\r\n\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n private validateAsUri() {\r\n let components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n } catch (e) {\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage.authorityUriInsecure;\r\n }\r\n\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage.authorityUriInvalidPath;\r\n }\r\n }\r\n\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n private DiscoverEndpoints(openIdConfigurationEndpoint: string): Promise {\r\n let client = new XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then((response: any) => {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n public ResolveEndpointsAsync(): Promise {\r\n let openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(openIdConfigurationEndpointResponse => {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then((tenantDiscoveryResponse: ITenantDiscoveryResponse) => {\r\n this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return this;\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public abstract GetOpenIdConfigurationEndpointAsync(): Promise;\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Authority.ts","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/tslib/tslib.es6.js\n// module id = 2\n// module chunks = 0 1","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Constants {\r\n static get errorDescription(): string { return \"error_description\"; }\r\n static get error(): string { return \"error\"; }\r\n static get scope(): string { return \"scope\"; }\r\n static get acquireTokenUser(): string { return \"msal.acquireTokenUser\"; }\r\n static get clientInfo(): string { return \"client_info\"; }\r\n static get clientId(): string { return \"clientId\"; }\r\n static get authority(): string { return \"msal.authority\"; }\r\n static get idToken(): string { return \"id_token\"; }\r\n static get accessToken(): string { return \"access_token\"; }\r\n static get expiresIn(): string { return \"expires_in\"; }\r\n static get sessionState(): string { return \"session_state\"; }\r\n static get msalClientInfo(): string { return \"msal.client.info\"; }\r\n static get msalError(): string { return \"msal.error\"; }\r\n static get msalErrorDescription(): string { return \"msal.error.description\"; }\r\n static get msalSessionState(): string { return \"msal.session.state\"; }\r\n static get tokenKeys(): string { return \"msal.token.keys\"; }\r\n static get accessTokenKey(): string { return \"msal.access.token.key\"; }\r\n static get expirationKey(): string { return \"msal.expiration.key\"; }\r\n static get stateLogin(): string { return \"msal.state.login\"; }\r\n static get stateAcquireToken(): string { return \"msal.state.acquireToken\"; }\r\n static get stateRenew(): string { return \"msal.state.renew\"; }\r\n static get nonceIdToken(): string { return \"msal.nonce.idtoken\"; }\r\n static get userName(): string { return \"msal.username\"; }\r\n static get idTokenKey(): string { return \"msal.idtoken\"; }\r\n static get loginRequest(): string { return \"msal.login.request\"; }\r\n static get loginError(): string { return \"msal.login.error\"; }\r\n static get renewStatus(): string { return \"msal.token.renew.status\"; }\r\n static get msal(): string { return \"msal\"; }\r\n static get resourceDelimeter(): string { return \"|\"; }\r\n static get tokenRenewStatusCancelled(): string { return \"Canceled\"; }\r\n static get tokenRenewStatusCompleted(): string { return \"Completed\"; }\r\n static get tokenRenewStatusInProgress(): string { return \"In Progress\"; }\r\n private static _popUpWidth: number = 483;\r\n static get popUpWidth(): number { return this._popUpWidth; }\r\n static set popUpWidth(width: number) {\r\n this._popUpWidth = width;\r\n }\r\n private static _popUpHeight: number = 600;\r\n static get popUpHeight(): number { return this._popUpHeight; }\r\n static set popUpHeight(height: number) {\r\n this._popUpHeight = height;\r\n }\r\n static get login(): string { return \"LOGIN\"; }\r\n static get renewToken(): string { return \"RENEW_TOKEN\"; }\r\n static get unknown(): string { return \"UNKNOWN\"; }\r\n static get urlHash(): string { return \"msal.urlHash\"; }\r\n static get angularLoginRequest(): string { return \"msal.angular.login.request\"; }\r\n static get userIdentifier(): string { return \"userIdentifier\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorCodes {\r\n static get loginProgressError(): string { return \"login_progress_error\"; }\r\n static get acquireTokenProgressError(): string { return \"acquiretoken_progress_error\"; }\r\n static get inputScopesError(): string { return \"input_scopes_error\"; }\r\n static get endpointResolutionError(): string { return \"endpoints_resolution_error\"; }\r\n static get popUpWindowError(): string { return \"popup_window_error\"; }\r\n static get userLoginError(): string { return \"user_login_error\"; }\r\n static get userCancelledError(): string { return \"user_cancelled\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorDescription {\r\n static get loginProgressError(): string { return \"Login is in progress\"; }\r\n static get acquireTokenProgressError(): string { return \"Acquire token is in progress\"; }\r\n static get inputScopesError(): string { return \"Invalid value of input scopes provided\"; }\r\n static get endpointResolutionError(): string { return \"Endpoints cannot be resolved\"; }\r\n static get popUpWindowError(): string { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; }\r\n static get userLoginError(): string { return \"User login is required\"; }\r\n static get userCancelledError(): string { return \"User closed the popup window window and cancelled the flow\"; }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport interface ILoggerCallback {\r\n (level: LogLevel, message: string, containsPii: boolean): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Error,\r\n Warning,\r\n Info,\r\n Verbose\r\n}\r\n\r\nexport class Logger {// Singleton Class\r\n\r\n /*\r\n * @hidden\r\n */\r\n private static _instance: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _correlationId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _level: LogLevel = LogLevel.Info;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _piiLoggingEnabled: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _localCallback: ILoggerCallback;\r\n\r\n constructor(localCallback: ILoggerCallback,\r\n options:\r\n {\r\n correlationId?: string,\r\n level?: LogLevel,\r\n piiLoggingEnabled?: boolean,\r\n } = {}) {\r\n const {\r\n correlationId = \"\",\r\n level = LogLevel.Info,\r\n piiLoggingEnabled = false\r\n } = options;\r\n\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n private logMessage(logLevel: LogLevel, logMessage: string, containsPii: boolean): void {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log: string;\r\n if (!Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n executeCallback(level: LogLevel, message: string, containsPii: boolean) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n error(message: string): void {\r\n this.logMessage(LogLevel.Error, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n errorPii(message: string): void {\r\n this.logMessage(LogLevel.Error, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warning(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warningPii(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n info(message: string): void {\r\n this.logMessage(LogLevel.Info, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n infoPii(message: string): void {\r\n this.logMessage(LogLevel.Info, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbose(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbosePii(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Logger.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorMessage {\r\n static get authorityUriInvalidPath(): string { return \"AuthorityUriInvalidPath\"; }\r\n static get authorityUriInsecure(): string { return \"AuthorityUriInsecure\"; }\r\n static get invalidAuthorityType(): string { return \"InvalidAuthorityType\"; }\r\n static get unsupportedAuthorityValidation(): string { return \"UnsupportedAuthorityValidation\"; }\r\n static get b2cAuthorityUriInvalidPath(): string { return \"B2cAuthorityUriInvalidPath\"; }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ErrorMessage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class TokenResponse {\r\n valid: boolean;\r\n parameters: Object;\r\n stateMatch: boolean;\r\n stateResponse: string;\r\n requestType: string;\r\n\r\n constructor() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/RequestInfo.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport class User {\r\n\r\n displayableId: string;\r\n name: string;\r\n identityProvider: string;\r\n userIdentifier: string;\r\n idToken: Object\r\n\r\n /*\r\n * @hidden\r\n */\r\n constructor(displayableId: string, name: string, identityProvider: string, userIdentifier: string, idToken:Object) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n static createUser(idToken: IdToken, clientInfo: ClientInfo, authority: string): User {\r\n let uid: string;\r\n let utid: string;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n\r\n const userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n }\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/User.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class AadAuthority extends Authority {\r\n private static readonly AadInstanceDiscoveryEndpoint: string = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n\r\n private get AadInstanceDiscoveryEndpointUrl(): string {\r\n return `${AadAuthority.AadInstanceDiscoveryEndpoint}?api-version=1.0&authorization_endpoint=${this.CanonicalAuthority}oauth2/v2.0/authorize`;\r\n }\r\n\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.Aad;\r\n }\r\n\r\n private static readonly TrustedHostList: any = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise: Promise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n let host: string = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n\r\n let client: XhrClient = new XhrClient();\r\n\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then((response) => {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n public IsInTrustedHostList(host: string): boolean {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AadAuthority.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nexport class XhrClient {\r\n public sendRequestAsync(url: string, method: string, enableCaching?: boolean): Promise {\r\n return new Promise((resolve, reject) => {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n\r\n xhr.onload = (ev) => {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n } catch (e) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n resolve(jsonResponse);\r\n };\r\n\r\n xhr.onerror = (ev) => {\r\n reject(xhr.status);\r\n };\r\n\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n }\r\n\r\n protected handleError(responseText: string): any {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n } else {\r\n throw responseText;\r\n }\r\n } catch (e) {\r\n return responseText;\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/XHRClient.ts","export { UserAgentApplication } from \"./UserAgentApplication\";\r\nexport { Logger } from \"./Logger\";\r\nexport { LogLevel } from \"./Logger\";\r\nexport { User } from \"./User\";\r\nexport { Constants } from \"./Constants\";\r\nexport { TokenResponse} from \"./RequestInfo\";\r\nexport {Authority} from \"./Authority\";\r\nexport {CacheResult} from \"./UserAgentApplication\";\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\nimport { AuthenticationRequestParameters } from \"./AuthenticationRequestParameters\";\r\nimport { Authority } from \"./Authority\";\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { Constants, ErrorCodes, ErrorDescription } from \"./Constants\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Logger } from \"./Logger\";\r\nimport { Storage } from \"./Storage\";\r\nimport { TokenResponse } from \"./RequestInfo\";\r\nimport { User } from \"./User\";\r\nimport { Utils } from \"./Utils\";\r\nimport { AuthorityFactory } from \"./AuthorityFactory\";\r\n\r\ndeclare global {\r\n interface Window {\r\n msal: Object;\r\n CustomEvent: CustomEvent;\r\n Event: Event;\r\n activeRenewals: {};\r\n renewStates: Array;\r\n callBackMappedToRenewStates : {};\r\n callBacksMappedToRenewStates: {};\r\n openedWindows: Array;\r\n requestType: string;\r\n }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nlet ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport interface CacheResult {\r\n errorDesc: string;\r\n token: string;\r\n error: string;\r\n}\r\n\r\n/*\r\n * A type alias of for a tokenReceivedCallback function.\r\n * @param tokenReceivedCallback.errorDesc error description returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.token token returned from STS if token request is successful.\r\n * @param tokenReceivedCallback.error error code returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.tokenType tokenType returned from the STS if API call is successful. Possible values are: id_token OR access_token.\r\n */\r\nexport type tokenReceivedCallback = (errorDesc: string, token: string, error: string, tokenType: string) => void;\r\nconst resolveTokenOnlyIfOutOfIframe = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\r\n const tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function (...args: any[]) {\r\n return this.isInIframe()\r\n ? new Promise(() => { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nexport class UserAgentApplication {\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocation: string;\r\n\r\n /*\r\n * Used to get the cache location\r\n */\r\n get cacheLocation(): string {\r\n return this._cacheLocation;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _logger: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _loginInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _acquireTokenInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _clockSkew = 300;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _cacheStorage: Storage;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _tokenReceivedCallback: tokenReceivedCallback = null;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _user: User;\r\n\r\n /*\r\n * Client ID assigned to your app by Azure Active Directory.\r\n */\r\n clientId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected authorityInstance: Authority;\r\n\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n public set authority(val) {\r\n this.authorityInstance = AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n }\r\n\r\n /*\r\n * Used to get the authority.\r\n */\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n /*\r\n * Used to turn authority validation on/off.\r\n * When set to true (default), MSAL will compare the application\"s authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.\r\n */\r\n validateAuthority: boolean;\r\n\r\n /*\r\n * The redirect URI of the application, this should be same as the value in the application registration portal.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _redirectUri: string;\r\n\r\n /*\r\n * Used to redirect the user to this location after logout.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _postLogoutredirectUri: string;\r\n\r\n loadFrameTimeout: number;\r\n\r\n protected _navigateToLoginRequestUrl: boolean;\r\n\r\n private _isAngular: boolean = false;\r\n\r\n private _endpoints: Map>;\r\n\r\n private _anonymousEndpoints: Array;\r\n\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n constructor(\r\n clientId: string,\r\n authority: string | null,\r\n tokenReceivedCallback: tokenReceivedCallback,\r\n options:\r\n {\r\n validateAuthority?: boolean,\r\n cacheLocation?: string,\r\n redirectUri?: string,\r\n postLogoutRedirectUri?: string,\r\n logger?: Logger,\r\n loadFrameTimeout?: number,\r\n navigateToLoginRequestUrl?: boolean,\r\n isAngular?: boolean,\r\n anonymousEndpoints?: Array\r\n endPoints?:Map>\r\n } = {}) {\r\n const {\r\n validateAuthority = true,\r\n cacheLocation = \"sessionStorage\",\r\n redirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n postLogoutRedirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n logger = new Logger(null),\r\n loadFrameTimeout = 6000,\r\n navigateToLoginRequestUrl = true,\r\n isAngular = false,\r\n anonymousEndpoints = new Array(),\r\n endPoints = new Map>(),\r\n } = options;\r\n\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n\r\n this._cacheStorage = new Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = { };\r\n window.callBacksMappedToRenewStates = { };\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private processCallBack(hash: string): void {\r\n this._logger.info('Processing the callback from redirect response');\r\n const requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n const token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n const errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n const error = requestInfo.parameters[Constants.error];\r\n var tokenType: string;\r\n\r\n if (requestInfo.parameters[Constants.accessToken]) {\r\n tokenType = Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n this._cacheStorage.removeItem(Constants.urlHash);\r\n\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n }\r\n\r\n \r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n loginRedirect(scopes?: Array, extraQueryParameters?: string): void {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.loginProgressError, null, ErrorCodes.loginProgressError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n this._loginInProgress = true;\r\n \r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n var loginStartPage = this._cacheStorage.getItem(Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants.angularLoginRequest, \"\")\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, loginStartPage);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n this.promptUser(urlNavigate);\r\n });\r\n }\r\n\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n loginPopup(scopes: Array, extraQueryParameters?: string): Promise {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise((resolve, reject) => {\r\n if (this._loginInProgress) {\r\n reject(ErrorCodes.loginProgressError + \"|\" + ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n\r\n scopes = this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [this.clientId];\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n \r\n this._loginInProgress = true;\r\n\r\n this.authorityInstance.ResolveEndpointsAsync().then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, window.location.href);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.login;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n }\r\n\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n private promptUser(urlNavigate: string) {\r\n if (urlNavigate && !Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n } else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n }\r\n\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n private openWindow(urlNavigate: string, title: string, interval: number, instance: this, resolve?: Function, reject?: Function): Window {\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(ErrorCodes.popUpWindowError + \":\" + ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(ErrorCodes.popUpWindowError + \"|\" + ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(() => {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpClosed', ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(\"Closing popup window\");\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n },\r\n interval);\r\n\r\n return popupWindow;\r\n }\r\n\r\n private broadcast(eventName: string, data: string) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n }\r\n\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n logout(): void {\r\n this.clearCache();\r\n this._user = null;\r\n let logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n\r\n const urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n }\r\n\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected clearCache(): void {\r\n window.renewStates = [];\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n }\r\n\r\n clearCacheForScope(accessToken: string) {\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++){\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n }\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n const winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n const left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n const top = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n\r\n const popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n\r\n return popupWindow;\r\n } catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n private validateInputScope(scopes: Array): string {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n private filterScopes(scopes: Array): Array {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n\r\n return scopes;\r\n }\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n private registerCallback(expectedState: string, scope: string, resolve: Function, reject: Function): void {\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n (errorDesc: string, token: string, error: string, tokenType: string) => {\r\n window.activeRenewals[scope] = null;\r\n for (let i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n } catch (e) {\r\n this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n }\r\n\r\n\r\nprotected getCachedTokenInternal(scopes : Array , user: User): CacheResult\r\n{\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = this.authorityInstance?this.authorityInstance: AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n return this.getCachedToken(authenticationRequest, user);\r\n}\r\n\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n private getCachedToken(authenticationRequest: AuthenticationRequestParameters, user: User): CacheResult {\r\n let accessTokenCacheItem: AccessTokenCacheItem = null;\r\n const scopes = authenticationRequest.scopes;\r\n const tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier:null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n\r\n const filteredItems: Array = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n const authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n\r\n if (accessTokenCacheItem != null) {\r\n const expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n const offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n } else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n getAllUsers(): Array {\r\n const users: Array = [];\r\n const accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const idToken = new IdToken(accessTokenCacheItems[i].value.idToken);\r\n const clientInfo = new ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n const user = User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n\r\n return this.getUniqueUsers(users);\r\n }\r\n\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueUsers(users: Array): Array {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n\r\n const flags: Array = [];\r\n const uniqueUsers: Array = [];\r\n for (let index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n\r\n return uniqueUsers;\r\n }\r\n\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueAuthority(accessTokenCacheItems: Array, property: string): Array {\r\n const authorityList: Array = [];\r\n const flags: Array = [];\r\n accessTokenCacheItems.forEach(element => {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n }\r\n\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n private addHintParameters(urlNavigate: string, user: User): string {\r\n const userObject = user ? user : this.getUser();\r\n const decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n const uid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n const utid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n\r\n if (!Utils.isEmpty(uid) && !Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n } else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n\r\n return urlNavigate;\r\n }\r\n\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n private urlContainsQueryStringParameter(name: string, url: string): boolean {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n const regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n }\r\n\r\n /*\r\n * Used to obtain an access_token by redirecting the user to the authorization endpoint.\r\n * To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://{instance}/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://{instance}/tfp/<tenant>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n */\r\n acquireTokenRedirect(scopes: Array): void;\r\n acquireTokenRedirect(scopes: Array, authority: string): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User, extraQueryParameters: string): void;\r\n acquireTokenRedirect(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): void {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.userLoginError, null, ErrorCodes.userLoginError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n this._cacheStorage.setItem(Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Used to acquire an access token for a new user using interactive authentication via a popup Window.\r\n * To request an id_token, pass the clientId as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\".\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n acquireTokenPopup(scopes: Array): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User, extraQueryParameters: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n reject(ErrorCodes.acquireTokenProgressError + \"|\" + ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \"|\" + ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n @resolveTokenOnlyIfOutOfIframe\r\n acquireTokenSilent(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n } else {\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n const cacheResult = this.getCachedToken(authenticationRequest, userObject);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n this._logger.info(\"Token is already in cache for scope:\" + scope);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n this._logger.verbose(\"Token is not in cache for scope:\" + scope);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(() => {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope]) {\r\n this._logger.verbose(\"Renew token for scope: \" + scope + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n this.registerCallback(window.activeRenewals[scope], scope, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n this._logger.verbose(\"renewing idToken\");\r\n this.renewIdToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n } else {\r\n this._logger.verbose(\"renewing accesstoken\");\r\n this.renewToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n }\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadIframeTimeout(urlNavigate: string, frameName: string, scope: string): void {\r\n //set iframe session to pending\r\n const expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(() => {\r\n if (this._cacheStorage.getItem(Constants.renewStatus + expectedState) === Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n this._logger.verbose(\"Loading frame has timed out after: \" + (this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants.accessToken);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n }\r\n\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadFrame(urlNavigate: string, frameName: string): void {\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(() => {\r\n var frameHandle = this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n },\r\n 500);\r\n }\r\n\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n private addAdalFrame(iframeId: string): HTMLIFrameElement {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n let adalFrame = document.getElementById(iframeId) as HTMLIFrameElement;\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n const ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = (document.getElementsByTagName(\"body\")[0].appendChild(ifr) as HTMLIFrameElement);\r\n } else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n\r\n return adalFrame;\r\n }\r\n\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n const frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n }\r\n\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewIdToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n const frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n }\r\n\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n getUser(): User {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n\r\n // frame is used to get idToken\r\n const rawIdToken = this._cacheStorage.getItem(Constants.idTokenKey);\r\n const rawClientInfo = this._cacheStorage.getItem(Constants.msalClientInfo);\r\n if (!Utils.isEmpty(rawIdToken) && !Utils.isEmpty(rawClientInfo)) {\r\n const idToken = new IdToken(rawIdToken);\r\n const clientInfo = new ClientInfo(rawClientInfo);\r\n this._user = User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private handleAuthenticationResponse(hash: string): void {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n\r\n var self = null;\r\n var isPopup: boolean = false;\r\n var isWindowOpenerMsal = false;\r\n\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n } catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n\r\n const requestInfo = self.getRequestInfo(hash);//if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n let token: string = null, tokenReceivedCallback: (errorDesc: string, token: string, error: string, tokenType: string) => void = null, tokenType: string, saveToken:boolean = true;\r\n \r\n self._logger.info(\"Returned from redirect url\");\r\n \r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n\r\n }\r\n\r\n self.saveTokenFromHash(requestInfo);\r\n\r\n if ((requestInfo.requestType === Constants.renewToken) && window.parent) {\r\n if (window.parent!==window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n } else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n\r\n token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.accessToken;\r\n } else if (requestInfo.requestType === Constants.login) {\r\n token = requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n var errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants.error];\r\n \r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n private saveAccessToken(authority: string, tokenResponse: TokenResponse, user: User, clientInfo: string, idToken: IdToken): void {\r\n let scope: string;\r\n let clientObj: ClientInfo = new ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n const consentedScopes = scope.split(\" \");\r\n const accessTokenCacheItems =\r\n this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n const cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.accessToken], idToken.rawIdToken, Utils.expiresIn(tokenResponse.parameters[Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n } else {\r\n scope = this.clientId;\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.idToken], tokenResponse.parameters[Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n }\r\n\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected saveTokenFromHash(tokenResponse: TokenResponse): void {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n var scope: string = \"\";\r\n var authorityKey: string = \"\";\r\n var acquireTokenUserKey: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, tokenResponse.parameters[Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants.loginError, tokenResponse.parameters[Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants.error]);\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n if (tokenResponse.requestType === Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userKey + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n } else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants.msalSessionState, tokenResponse.parameters[Constants.sessionState]);\r\n }\r\n \r\n var idToken: IdToken;\r\n var clientInfo: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n let user: User;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n } else {\r\n idToken = new IdToken(this._cacheStorage.getItem(Constants.idTokenKey));\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n }\r\n\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let acquireTokenUser: User;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\r\n \"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n } else {\r\n this._logger.warning(\r\n \"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n this._user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n } else {\r\n this._cacheStorage.setItem(Constants.idTokenKey, tokenResponse.parameters[Constants.idToken]);\r\n this._cacheStorage.setItem(Constants.msalClientInfo, clientInfo);\r\n\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants.idToken];\r\n this._cacheStorage.setItem(Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants.idToken]);\r\n }\r\n }\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants.renewStatus + tokenResponse.stateResponse, Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n }\r\n\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n isCallback(hash: string): boolean {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n return (\r\n parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)\r\n\r\n );\r\n }\r\n\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private getHash(hash: string): string {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n } else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n\r\n return hash;\r\n }\r\n\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected getRequestInfo(hash: string): TokenResponse {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n const tokenResponse = new TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n let stateResponse: string;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n } else {\r\n return tokenResponse;\r\n }\r\n\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n } else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n const statesInParentContext = window.renewStates;\r\n for (let i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n }\r\n\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n private getScopeFromState(state: string): string {\r\n if (state) {\r\n const splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n private isInIframe() {\r\n return window.parent !== window;\r\n }\r\n\r\n loginInProgress(): boolean {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n }\r\n\r\n private getHostFromUri(uri: string): string {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n }\r\n \r\n getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._endpoints.size > 0) {\r\n for (let key of Array.from(this._endpoints.keys())) {\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n }\r\n\r\n //These APIS are exposed for msalAngular wrapper only\r\n protected setloginInProgress(loginInProgress : boolean) {\r\n this._loginInProgress = loginInProgress;\r\n }\r\n\r\n protected getAcquireTokenInProgress(): boolean\r\n {\r\n return this._acquireTokenInProgress;\r\n }\r\n\r\n protected setAcquireTokenInProgress(acquireTokenInProgress : boolean) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n }\r\n\r\n protected getLogger()\r\n {\r\n return this._logger;\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/UserAgentApplication.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenKey {\r\n\r\n authority: string;\r\n clientId: string;\r\n userIdentifier: string;\r\n scopes: string;\r\n\r\n constructor(authority: string, clientId: string, scopes: string, uid: string, utid: string) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenKey.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenValue {\r\n\r\n accessToken: string;\r\n idToken: string;\r\n expiresIn: string;\r\n clientInfo: string;\r\n\r\n constructor(accessToken: string, idToken: string, expiresIn: string, clientInfo: string) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenValue.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority } from \"./Authority\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AuthenticationRequestParameters {\r\n authorityInstance: Authority;\r\n clientId: string;\r\n nonce: string;\r\n state: string;\r\n correlationId: string;\r\n xClientVer: string;\r\n xClientSku: string;\r\n scopes: Array;\r\n responseType: string;\r\n promptValue: string;\r\n extraQueryParameters: string;\r\n loginHint: string;\r\n domainHint: string;\r\n redirectUri: string;\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n constructor(authority: Authority, clientId: string, scope: Array, responseType: string, redirectUri: string) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils.createNewGuid();\r\n this.state = Utils.createNewGuid();\r\n this.nonce = Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils.getLibraryVersion();\r\n }\r\n\r\n createNavigateUrl(scopes: Array): string {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n\r\n const str: Array = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(`x-client-SKU=${this.xClientSku}`);\r\n str.push(`x-client-Ver=${this.xClientVer}`);\r\n\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n let authEndpoint: string = this.authorityInstance.AuthorizationEndpoint;\r\n\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n } else {\r\n authEndpoint += \"&\";\r\n }\r\n\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n translateclientIdUsedInScope(scopes: Array): void {\r\n const clientIdIndex: number = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n }\r\n\r\n parseScope(scopes: Array): string {\r\n let scopeList: string = \"\";\r\n if (scopes) {\r\n for (let i: number = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n\r\n return scopeList;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationRequestParameters.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ClientInfo {\r\n\r\n private _uid: string;\r\n get uid(): string {\r\n return this._uid ? this._uid : \"\";\r\n }\r\n\r\n set uid(uid: string) {\r\n this._uid = uid;\r\n }\r\n\r\n private _utid: string;\r\n get utid(): string {\r\n return this._utid ? this._utid : \"\";\r\n }\r\n\r\n set utid(utid: string) {\r\n this._utid = utid;\r\n }\r\n\r\n constructor(rawClientInfo: string) {\r\n if (!rawClientInfo || Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n const clientInfo: ClientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ClientInfo.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class IdToken {\r\n\r\n issuer: string;\r\n objectId: string;\r\n subject: string;\r\n tenantId: string;\r\n version: string;\r\n preferredName: string;\r\n name: string;\r\n homeObjectId: string;\r\n nonce: string;\r\n expiration: string;\r\n rawIdToken: string;\r\n decodedIdToken: Object\r\n\r\n constructor(rawIdToken: string) {\r\n if (Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/IdToken.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Constants } from \"./Constants\";\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Storage {// Singleton\r\n\r\n private static _instance: Storage;\r\n private _localStorageSupported: boolean;\r\n private _sessionStorageSupported: boolean;\r\n private _cacheLocation: string;\r\n\r\n constructor(cacheLocation: string) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n\r\n return Storage._instance;\r\n }\r\n\r\n // add value to storage\r\n setItem(key: string, value: string): void {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string): string {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // remove value from storage\r\n removeItem(key: string): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // clear storage (remove all items from it)\r\n clear(): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n getAllAccessTokens(clientId: string, userIdentifier: string): Array {\r\n const results: Array = [];\r\n let accessTokenCacheItem: AccessTokenCacheItem;\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n let value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n\r\n return results;\r\n }\r\n\r\n removeAcquireTokenEntries(authorityKey: string, acquireTokenUserKey: string): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey!= \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n resetCacheItems(): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.msal) !== -1) {\r\n this.setItem(key,\"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Storage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenCacheItem {\r\n\r\n key: AccessTokenKey;\r\n value: AccessTokenValue;\r\n\r\n constructor(key: AccessTokenKey, value: AccessTokenValue) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenCacheItem.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nimport { Utils } from \"./Utils\";\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { B2cAuthority } from \"./B2cAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\n\r\nexport class AuthorityFactory {\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n private static DetectAuthorityFromUrl(authorityUrl: string): AuthorityType {\r\n authorityUrl = Utils.CanonicalizeUri(authorityUrl);\r\n let components = Utils.GetUrlComponents(authorityUrl);\r\n let pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return AuthorityType.B2C;\r\n case \"adfs\":\r\n return AuthorityType.Adfs;\r\n default:\r\n return AuthorityType.Aad;\r\n }\r\n }\r\n\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n public static CreateInstance(authorityUrl: string, validateAuthority: boolean): Authority {\r\n let type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case AuthorityType.B2C:\r\n return new B2cAuthority(authorityUrl, validateAuthority);\r\n case AuthorityType.Aad:\r\n return new AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthorityFactory.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class B2cAuthority extends AadAuthority {\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n let urlComponents = Utils.GetUrlComponents(authority);\r\n\r\n let pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n\r\n this.CanonicalAuthority = `https://${urlComponents.HostNameAndPort}/${pathSegments[0]}/${pathSegments[1]}/${pathSegments[2]}/`;\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.B2C;\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n reject(ErrorMessage.unsupportedAuthorityValidation));\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/B2cAuthority.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/msal.min.js b/dist/msal.min.js index c018e6fe2a..3efb3cc4b3 100644 --- a/dist/msal.min.js +++ b/dist/msal.min.js @@ -1,7 +1,7 @@ -/*! msal v0.1.8 2018-07-23 */ +/*! msal v0.1.9 2018-07-27 */ 'use strict'; -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Msal",[],t):"object"==typeof exports?exports.Msal=t():e.Msal=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.compareObjects=function(e,t){return!(!e||!t)&&!(!e.userIdentifier||!t.userIdentifier||e.userIdentifier!==t.userIdentifier)},e.expiresIn=function(e){return e||(e="3599"),this.now()+parseInt(e,10)},e.now=function(){return Math.round((new Date).getTime()/1e3)},e.isEmpty=function(e){return void 0===e||!e||0===e.length},e.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var n=t.JWSPayload,r=this.base64DecodeStringUrlSafe(n);return r?JSON.parse(r):null}catch(e){}return null},e.base64EncodeStringUrlSafe=function(e){return window.btoa?window.btoa(e):this.encode(e)},e.base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(encodeURIComponent(window.atob(e))):decodeURIComponent(encodeURIComponent(this.decode(e)))},e.encode=function(e){var t,n,r,o,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",l=0;for(e=this.utf8Encode(e);l>2,i=(3&t)<<4|n>>4,s=(15&n)<<2|r>>6,a=63&r,isNaN(n)?s=a=64:isNaN(r)&&(a=64),u=u+c.charAt(o)+c.charAt(i)+c.charAt(s)+c.charAt(a);return u.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},e.utf8Encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},e.decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=String(e).replace(/=+$/,"");var n=e.length;if(n%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var r,o,i,s,a,c,u,l,d="",p=0;p>16&255,u=a>>8&255,d+=String.fromCharCode(c,u);break}if(p+1===n-1){a=r<<18|o<<12,c=a>>16&255,d+=String.fromCharCode(c);break}a=r<<18|o<<12|i<<6|s,c=a>>16&255,u=a>>8&255,l=255&a,d+=String.fromCharCode(c,u,l)}return d},e.decodeJwt=function(e){if(this.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,n=t.exec(e);return!n||n.length<4?null:{header:n[1],JWSPayload:n[2],JWSSig:n[3]}},e.deserialize=function(e){var t,n=/\+/g,r=/([^&=]+)=([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(n," "))},i={};for(t=r.exec(e);t;)i[o(t[1])]=o(t[2]),t=r.exec(e);return i},e.isIntersectingScopes=function(e,t){e=this.convertToLowerCase(e);for(var n=0;n-1)return!0;return!1},e.containsScope=function(e,t){return e=this.convertToLowerCase(e),t.every(function(t){return e.indexOf(t.toString().toLowerCase())>=0})},e.convertToLowerCase=function(e){return e.map(function(e){return e.toLowerCase()})},e.removeElement=function(e,t){return e.filter(function(e){return e!==t})},e.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},e.getLibraryVersion=function(){return"0.1.8"},e.replaceFirstPath=function(t,n){if(t.match(/^(https?\:)\/\/(([^:\/?#] *)(?:\:([0-9]+))?)([\/]{0,1}[^?#] *)(\?[^#] *|)(#. *|)$/)){var r=e.GetUrlComponents(t),o=r.PathSegments;o.shift(),(o[0]&&"common"===o[0]||"organizations"===o[0])&&(o[0]=n,t=r.Protocol+"//"+r.HostNameAndPort+"/"+o.join("/"))}return t},e.createNewGuid=function(){var t=window.crypto;if(t&&t.getRandomValues){var n=new Uint8Array(16);return t.getRandomValues(n),n[6]|=64,n[6]&=79,n[8]|=128,n[8]&=191,e.decimalToHex(n[0])+e.decimalToHex(n[1])+e.decimalToHex(n[2])+e.decimalToHex(n[3])+"-"+e.decimalToHex(n[4])+e.decimalToHex(n[5])+"-"+e.decimalToHex(n[6])+e.decimalToHex(n[7])+"-"+e.decimalToHex(n[8])+e.decimalToHex(n[9])+"-"+e.decimalToHex(n[10])+e.decimalToHex(n[11])+e.decimalToHex(n[12])+e.decimalToHex(n[13])+e.decimalToHex(n[14])+e.decimalToHex(n[15])}for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",i=0,s="",a=0;a<36;a++)"-"!==r[a]&&"4"!==r[a]&&(i=16*Math.random()|0),"x"===r[a]?s+=o[i]:"y"===r[a]?(i&=3,i|=8,s+=o[i]):s+=r[a];return s},e.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=e.match(t);if(!n||n.length<6)throw"Valid url required";var r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5]},o=r.AbsolutePath.split("/");return o=o.filter(function(e){return e&&e.length>0}),r.PathSegments=o,r},e.CanonicalizeUri=function(t){return t&&(t=t.toLowerCase()),t&&!e.endsWith(t,"/")&&(t+="/"),t},e.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},e}();t.Utils=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(5),i=n(9);!function(e){e[e.Aad=0]="Aad",e[e.Adfs=1]="Adfs",e[e.B2C=2]="B2C"}(t.AuthorityType||(t.AuthorityType={}));var s=function(){function e(e,t){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri()}return Object.defineProperty(e.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),e.prototype.validateResolved=function(){if(!this.tenantDiscoveryResponse)throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(e.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=r.Utils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=r.Utils.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.CanonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),e.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(e){throw o.ErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw o.ErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw o.ErrorMessage.authorityUriInvalidPath},e.prototype.DiscoverEndpoints=function(e){return(new i.XhrClient).sendRequestAsync(e,"GET",!0).then(function(e){return{AuthorizationEndpoint:e.authorization_endpoint,EndSessionEndpoint:e.end_session_endpoint,Issuer:e.issuer}})},e.prototype.ResolveEndpointsAsync=function(){var e=this,t="";return this.GetOpenIdConfigurationEndpointAsync().then(function(n){return t=n,e.DiscoverEndpoints(t)}).then(function(t){return e.tenantDiscoveryResponse=t,e})},e}();t.Authority=s},function(e,t,n){"use strict";function r(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function s(e,t){return function(n,r){t(n,r,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})}function u(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(s=2&n[0]?i.return:n[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,n[1])).done)return s;switch(i=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,i=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(s=c.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function h(){for(var e=[],t=0;t1||o(e,t)})})}function o(e,t){try{i(l[e](t))}catch(e){c(d[0][3],e)}}function i(e){e.value instanceof f?Promise.resolve(e.value.v).then(s,a):c(d[0][2],e)}function s(e){o("next",e)}function a(e){o("throw",e)}function c(e,t){e(t),d.shift(),d.length&&o(d[0][0],d[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,l=n.apply(e,t||[]),d=[];return u={},r("next"),r("throw"),r("return"),u[Symbol.asyncIterator]=function(){return this},u}function m(e){function t(t,o){n[t]=e[t]?function(n){return(r=!r)?{value:f(e[t](n)),done:"return"===t}:o?o(n):n}:o}var n,r;return n={},t("next"),t("throw",function(e){throw e}),t("return"),n[Symbol.iterator]=function(){return this},n}function y(e){function t(t){r[t]=e[t]&&function(r){return new Promise(function(o,i){r=e[t](r),n(o,i,r.done,r.value)})}}function n(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=e[Symbol.asyncIterator];return o?o.call(e):(e="function"==typeof d?d(e):e[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r)}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function v(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function _(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.__extends=r,n.d(t,"__assign",function(){return I}),t.__rest=o,t.__decorate=i,t.__param=s,t.__metadata=a,t.__awaiter=c,t.__generator=u,t.__exportStar=l,t.__values=d,t.__read=p,t.__spread=h,t.__await=f,t.__asyncGenerator=g,t.__asyncDelegator=m,t.__asyncValues=y,t.__makeTemplateObject=w,t.__importStar=v,t.__importDefault=_;/*! ***************************************************************************** +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Msal",[],t):"object"==typeof exports?exports.Msal=t():e.Msal=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.compareObjects=function(e,t){return!(!e||!t)&&!(!e.userIdentifier||!t.userIdentifier||e.userIdentifier!==t.userIdentifier)},e.expiresIn=function(e){return e||(e="3599"),this.now()+parseInt(e,10)},e.now=function(){return Math.round((new Date).getTime()/1e3)},e.isEmpty=function(e){return void 0===e||!e||0===e.length},e.extractIdToken=function(e){var t=this.decodeJwt(e);if(!t)return null;try{var n=t.JWSPayload,r=this.base64DecodeStringUrlSafe(n);return r?JSON.parse(r):null}catch(e){}return null},e.base64EncodeStringUrlSafe=function(e){return window.btoa?window.btoa(e):this.encode(e)},e.base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(encodeURIComponent(window.atob(e))):decodeURIComponent(encodeURIComponent(this.decode(e)))},e.encode=function(e){var t,n,r,o,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",l=0;for(e=this.utf8Encode(e);l>2,i=(3&t)<<4|n>>4,s=(15&n)<<2|r>>6,a=63&r,isNaN(n)?s=a=64:isNaN(r)&&(a=64),u=u+c.charAt(o)+c.charAt(i)+c.charAt(s)+c.charAt(a);return u.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},e.utf8Encode=function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(63&r|128))}return t},e.decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=String(e).replace(/=+$/,"");var n=e.length;if(n%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var r,o,i,s,a,c,u,l,d="",p=0;p>16&255,u=a>>8&255,d+=String.fromCharCode(c,u);break}if(p+1===n-1){a=r<<18|o<<12,c=a>>16&255,d+=String.fromCharCode(c);break}a=r<<18|o<<12|i<<6|s,c=a>>16&255,u=a>>8&255,l=255&a,d+=String.fromCharCode(c,u,l)}return d},e.decodeJwt=function(e){if(this.isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,n=t.exec(e);return!n||n.length<4?null:{header:n[1],JWSPayload:n[2],JWSSig:n[3]}},e.deserialize=function(e){var t,n=/\+/g,r=/([^&=]+)=([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(n," "))},i={};for(t=r.exec(e);t;)i[o(t[1])]=o(t[2]),t=r.exec(e);return i},e.isIntersectingScopes=function(e,t){e=this.convertToLowerCase(e);for(var n=0;n-1)return!0;return!1},e.containsScope=function(e,t){return e=this.convertToLowerCase(e),t.every(function(t){return e.indexOf(t.toString().toLowerCase())>=0})},e.convertToLowerCase=function(e){return e.map(function(e){return e.toLowerCase()})},e.removeElement=function(e,t){return e.filter(function(e){return e!==t})},e.decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},e.getLibraryVersion=function(){return"0.1.9"},e.replaceFirstPath=function(t,n){if(t.match(/^(https?\:)\/\/(([^:\/?#] *)(?:\:([0-9]+))?)([\/]{0,1}[^?#] *)(\?[^#] *|)(#. *|)$/)){var r=e.GetUrlComponents(t),o=r.PathSegments;o.shift(),(o[0]&&"common"===o[0]||"organizations"===o[0])&&(o[0]=n,t=r.Protocol+"//"+r.HostNameAndPort+"/"+o.join("/"))}return t},e.createNewGuid=function(){var t=window.crypto;if(t&&t.getRandomValues){var n=new Uint8Array(16);return t.getRandomValues(n),n[6]|=64,n[6]&=79,n[8]|=128,n[8]&=191,e.decimalToHex(n[0])+e.decimalToHex(n[1])+e.decimalToHex(n[2])+e.decimalToHex(n[3])+"-"+e.decimalToHex(n[4])+e.decimalToHex(n[5])+"-"+e.decimalToHex(n[6])+e.decimalToHex(n[7])+"-"+e.decimalToHex(n[8])+e.decimalToHex(n[9])+"-"+e.decimalToHex(n[10])+e.decimalToHex(n[11])+e.decimalToHex(n[12])+e.decimalToHex(n[13])+e.decimalToHex(n[14])+e.decimalToHex(n[15])}for(var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",o="0123456789abcdef",i=0,s="",a=0;a<36;a++)"-"!==r[a]&&"4"!==r[a]&&(i=16*Math.random()|0),"x"===r[a]?s+=o[i]:"y"===r[a]?(i&=3,i|=8,s+=o[i]):s+=r[a];return s},e.GetUrlComponents=function(e){if(!e)throw"Url required";var t=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=e.match(t);if(!n||n.length<6)throw"Valid url required";var r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5]},o=r.AbsolutePath.split("/");return o=o.filter(function(e){return e&&e.length>0}),r.PathSegments=o,r},e.CanonicalizeUri=function(t){return t&&(t=t.toLowerCase()),t&&!e.endsWith(t,"/")&&(t+="/"),t},e.endsWith=function(e,t){return!(!e||!t)&&-1!==e.indexOf(t,e.length-t.length)},e}();t.Utils=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(5),i=n(9);!function(e){e[e.Aad=0]="Aad",e[e.Adfs=1]="Adfs",e[e.B2C=2]="B2C"}(t.AuthorityType||(t.AuthorityType={}));var s=function(){function e(e,t){this.IsValidationEnabled=t,this.CanonicalAuthority=e,this.validateAsUri()}return Object.defineProperty(e.prototype,"Tenant",{get:function(){return this.CanonicalAuthorityUrlComponents.PathSegments[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"AuthorizationEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.AuthorizationEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"EndSessionEndpoint",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.EndSessionEndpoint.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"SelfSignedJwtAudience",{get:function(){return this.validateResolved(),this.tenantDiscoveryResponse.Issuer.replace("{tenant}",this.Tenant)},enumerable:!0,configurable:!0}),e.prototype.validateResolved=function(){if(!this.tenantDiscoveryResponse)throw"Please call ResolveEndpointsAsync first"},Object.defineProperty(e.prototype,"CanonicalAuthority",{get:function(){return this.canonicalAuthority},set:function(e){this.canonicalAuthority=r.Utils.CanonicalizeUri(e),this.canonicalAuthorityUrlComponents=null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CanonicalAuthorityUrlComponents",{get:function(){return this.canonicalAuthorityUrlComponents||(this.canonicalAuthorityUrlComponents=r.Utils.GetUrlComponents(this.CanonicalAuthority)),this.canonicalAuthorityUrlComponents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DefaultOpenIdConfigurationEndpoint",{get:function(){return this.CanonicalAuthority+"v2.0/.well-known/openid-configuration"},enumerable:!0,configurable:!0}),e.prototype.validateAsUri=function(){var e;try{e=this.CanonicalAuthorityUrlComponents}catch(e){throw o.ErrorMessage.invalidAuthorityType}if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw o.ErrorMessage.authorityUriInsecure;if(!e.PathSegments||e.PathSegments.length<1)throw o.ErrorMessage.authorityUriInvalidPath},e.prototype.DiscoverEndpoints=function(e){return(new i.XhrClient).sendRequestAsync(e,"GET",!0).then(function(e){return{AuthorizationEndpoint:e.authorization_endpoint,EndSessionEndpoint:e.end_session_endpoint,Issuer:e.issuer}})},e.prototype.ResolveEndpointsAsync=function(){var e=this,t="";return this.GetOpenIdConfigurationEndpointAsync().then(function(n){return t=n,e.DiscoverEndpoints(t)}).then(function(t){return e.tenantDiscoveryResponse=t,e})},e}();t.Authority=s},function(e,t,n){"use strict";function r(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function s(e,t){return function(n,r){t(n,r,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})}function u(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(s=2&n[0]?i.return:n[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,n[1])).done)return s;switch(i=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return c.label++,{value:n[1],done:!1};case 5:c.label++,i=n[1],n=[0];continue;case 7:n=c.ops.pop(),c.trys.pop();continue;default:if(s=c.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){c=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function h(){for(var e=[],t=0;t1||o(e,t)})})}function o(e,t){try{i(l[e](t))}catch(e){c(d[0][3],e)}}function i(e){e.value instanceof f?Promise.resolve(e.value.v).then(s,a):c(d[0][2],e)}function s(e){o("next",e)}function a(e){o("throw",e)}function c(e,t){e(t),d.shift(),d.length&&o(d[0][0],d[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,l=n.apply(e,t||[]),d=[];return u={},r("next"),r("throw"),r("return"),u[Symbol.asyncIterator]=function(){return this},u}function m(e){function t(t,o){n[t]=e[t]?function(n){return(r=!r)?{value:f(e[t](n)),done:"return"===t}:o?o(n):n}:o}var n,r;return n={},t("next"),t("throw",function(e){throw e}),t("return"),n[Symbol.iterator]=function(){return this},n}function y(e){function t(t){r[t]=e[t]&&function(r){return new Promise(function(o,i){r=e[t](r),n(o,i,r.done,r.value)})}}function n(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=e[Symbol.asyncIterator];return o?o.call(e):(e="function"==typeof d?d(e):e[Symbol.iterator](),r={},t("next"),t("throw"),t("return"),r[Symbol.asyncIterator]=function(){return this},r)}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function v(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function _(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.__extends=r,n.d(t,"__assign",function(){return I}),t.__rest=o,t.__decorate=i,t.__param=s,t.__metadata=a,t.__awaiter=c,t.__generator=u,t.__exportStar=l,t.__values=d,t.__read=p,t.__spread=h,t.__await=f,t.__asyncGenerator=g,t.__asyncDelegator=m,t.__asyncValues=y,t.__makeTemplateObject=w,t.__importStar=v,t.__importDefault=_;/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the @@ -15,5 +15,5 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},I=Object.assign||function(e){for(var t,n=1,r=arguments.length;nthis._level||!this._piiLoggingEnabled&&n)){var i,s=(new Date).toUTCString();i=o.Utils.isEmpty(this._correlationId)?s+":"+o.Utils.getLibraryVersion()+"-"+r[e]+" "+t:s+":"+this._correlationId+"-"+o.Utils.getLibraryVersion()+"-"+r[e]+" "+t,this.executeCallback(e,i,n)}},e.prototype.executeCallback=function(e,t,n){this._localCallback&&this._localCallback(e,t,n)},e.prototype.error=function(e){this.logMessage(r.Error,e,!1)},e.prototype.errorPii=function(e){this.logMessage(r.Error,e,!0)},e.prototype.warning=function(e){this.logMessage(r.Warning,e,!1)},e.prototype.warningPii=function(e){this.logMessage(r.Warning,e,!0)},e.prototype.info=function(e){this.logMessage(r.Info,e,!1)},e.prototype.infoPii=function(e){this.logMessage(r.Info,e,!0)},e.prototype.verbose=function(e){this.logMessage(r.Verbose,e,!1)},e.prototype.verbosePii=function(e){this.logMessage(r.Verbose,e,!0)},e}();t.Logger=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e,"authorityUriInvalidPath",{get:function(){return"AuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"authorityUriInsecure",{get:function(){return"AuthorityUriInsecure"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"invalidAuthorityType",{get:function(){return"InvalidAuthorityType"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unsupportedAuthorityValidation",{get:function(){return"UnsupportedAuthorityValidation"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"b2cAuthorityUriInvalidPath",{get:function(){return"B2cAuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),e}();t.ErrorMessage=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.valid=!1,this.parameters={},this.stateMatch=!1,this.stateResponse="",this.requestType="unknown"}return e}();t.TokenResponse=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,r,o){this.displayableId=e,this.name=t,this.identityProvider=n,this.userIdentifier=r,this.idToken=o}return e.createUser=function(t,n,o){var i,s;n?(i=n.uid,s=n.utid):(i="",s="");var a=r.Utils.base64EncodeStringUrlSafe(i)+"."+r.Utils.base64EncodeStringUrlSafe(s);return new e(t.preferredName,t.name,t.issuer,a,t.decodedIdToken)},e}();t.User=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(1),i=n(9),s=function(e){function t(t,n){return e.call(this,t,n)||this}return r.__extends(t,e),Object.defineProperty(t.prototype,"AadInstanceDiscoveryEndpointUrl",{get:function(){return t.AadInstanceDiscoveryEndpoint+"?api-version=1.0&authorization_endpoint="+this.CanonicalAuthority+"oauth2/v2.0/authorize"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return o.AuthorityType.Aad},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,n){return t(e.DefaultOpenIdConfigurationEndpoint)});if(!this.IsValidationEnabled)return t;var n=this.CanonicalAuthorityUrlComponents.HostNameAndPort;return this.IsInTrustedHostList(n)?t:(new i.XhrClient).sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl,"GET",!0).then(function(e){return e.tenant_discovery_endpoint})},t.prototype.IsInTrustedHostList=function(e){return t.TrustedHostList[e.toLowerCase()]},t.AadInstanceDiscoveryEndpoint="https://login.microsoftonline.com/common/discovery/instance",t.TrustedHostList={"login.windows.net":"login.windows.net","login.chinacloudapi.cn":"login.chinacloudapi.cn","login.cloudgovapi.us":"login.cloudgovapi.us","login.microsoftonline.com":"login.microsoftonline.com","login.microsoftonline.de":"login.microsoftonline.de","login.microsoftonline.us":"login.microsoftonline.us"},t}(o.Authority);t.AadAuthority=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.sendRequestAsync=function(e,t,n){var r=this;return new Promise(function(n,o){var i=new XMLHttpRequest;if(i.open(t,e,!0),i.onload=function(e){(i.status<200||i.status>=300)&&o(r.handleError(i.responseText));try{var t=JSON.parse(i.responseText)}catch(e){o(r.handleError(i.responseText))}n(t)},i.onerror=function(e){o(i.status)},"GET"!==t)throw"not implemented";i.send()})},e.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch(t){return e}},e}();t.XhrClient=r},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12);t.UserAgentApplication=r.UserAgentApplication;var o=n(4);t.Logger=o.Logger;var i=n(4);t.LogLevel=i.LogLevel;var s=n(7);t.User=s.User;var a=n(3);t.Constants=a.Constants;var c=n(6);t.TokenResponse=c.TokenResponse;var u=n(1);t.Authority=u.Authority},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(13),i=n(14),s=n(15),a=n(16),c=n(3),u=n(17),l=n(4),d=n(18),p=n(6),h=n(7),f=n(0),g=n(20),m={id_token:"id_token",token:"token",id_token_token:"id_token token"},y=function(e,t,n){var r=n.value;return n.value=function(){for(var e=[],t=0;t-1&&e.length>1?"ClientId can only be provided as a single scope":""},e.prototype.filterScopes=function(e){return e=e.filter(function(e){return"openid"!==e}),e=e.filter(function(e){return"profile"!==e})},e.prototype.registerCallback=function(e,t,n,r){var o=this;window.activeRenewals[t]=e,window.callBacksMappedToRenewStates[e]||(window.callBacksMappedToRenewStates[e]=[]),window.callBacksMappedToRenewStates[e].push({resolve:n,reject:r}),window.callBackMappedToRenewStates[e]||(window.callBackMappedToRenewStates[e]=function(n,r,i,s){window.activeRenewals[t]=null;for(var a=0;a-1?new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token,this._redirectUri):new s.AuthenticationRequestParameters(o,this.clientId,e,m.token,this._redirectUri):new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token_token,this._redirectUri),this.getCachedToken(r,t)}},e.prototype.getCachedToken=function(e,t){var n=null,r=e.scopes,o=this._cacheStorage.getAllAccessTokens(this.clientId,t?t.userIdentifier:null);if(0===o.length)return null;var i=[];if(e.authority){for(var s=0;s1)return{errorDesc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority",token:null,error:"multiple_matching_tokens_detected"};var u=this.getUniqueAuthority(o,"authority");if(u.length>1)return{errorDesc:"Multiple authorities found in the cache. Pass authority in the API overload.",token:null,error:"multiple_matching_tokens_detected"};e.authorityInstance=g.AuthorityFactory.CreateInstance(u[0],this.validateAuthority)}}if(null!=n){var l=Number(n.value.expiresIn),d=this._clockSkew||300;return l&&l>f.Utils.now()+d?{errorDesc:null,token:n.value.accessToken,error:null}:(this._cacheStorage.removeItem(JSON.stringify(i[0].key)),null)}return null},e.prototype.getAllUsers=function(){for(var e=[],t=this._cacheStorage.getAllAccessTokens(c.Constants.clientId,c.Constants.userIdentifier),n=0;n-1?new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(l,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token_token,o._redirectUri),o._cacheStorage.setItem(c.Constants.nonceIdToken,u.nonce);var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+a.userIdentifier+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(a));var n=c.Constants.authority+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(n))&&o._cacheStorage.setItem(n,l.CanonicalAuthority),r&&(u.extraQueryParameters=r);var i=u.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";(i=o.addHintParameters(i,a))&&(o._cacheStorage.setItem(c.Constants.stateAcquireToken,u.state),window.location.replace(i))})}},e.prototype.acquireTokenPopup=function(e,t,n,r){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);u&&!f.Utils.isEmpty(u)&&a(c.ErrorCodes.inputScopesError+"|"+u),e&&(e=o.filterScopes(e));var l=n||o.getUser();if(o._acquireTokenInProgress)return void a(c.ErrorCodes.acquireTokenProgressError+"|"+c.ErrorDescription.acquireTokenProgressError);var d=e.join(" ").toLowerCase();if(!l)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);o._acquireTokenInProgress=!0;var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance,y=o.openWindow("about:blank","_blank",1,o,i,a);y&&h.ResolveEndpointsAsync().then(function(){p=f.Utils.compareObjects(l,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri),o._cacheStorage.setItem(c.Constants.nonceIdToken,p.nonce),p.state=p.state;var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+l.userIdentifier+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(l));var n=c.Constants.authority+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(n))&&o._cacheStorage.setItem(n,h.CanonicalAuthority),r&&(p.extraQueryParameters=r);var u=p.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";u=o.addHintParameters(u,l),window.renewStates.push(p.state),window.requestType=c.Constants.renewToken,o.registerCallback(p.state,d,i,a),y&&(y.location.href=u)},function(){o._logger.info(c.ErrorCodes.endpointResolutionError+":"+c.ErrorDescription.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalError,c.ErrorCodes.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalErrorDescription,c.ErrorDescription.endpointResolutionError),a&&a(c.ErrorCodes.endpointResolutionError+"|"+c.ErrorDescription.endpointResolutionError),y&&y.close()}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})})},e.prototype.acquireTokenSilent=function(e,t,n,r){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);if(!u||f.Utils.isEmpty(u)){e&&(e=o.filterScopes(e));var l=e.join(" ").toLowerCase(),d=n||o.getUser();if(!d)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance;p=f.Utils.compareObjects(d,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri);var y=o.getCachedToken(p,d);if(y){if(y.token)return o._logger.info("Token is already in cache for scope:"+l),void i(y.token);if(y.errorDesc||y.error)return o._logger.infoPii(y.errorDesc+":"+y.error),void a(y.errorDesc+"|"+y.error)}else o._logger.verbose("Token is not in cache for scope:"+l);return h.ResolveEndpointsAsync().then(function(){window.activeRenewals[l]?(o._logger.verbose("Renew token for scope: "+l+" is in progress. Registering callback"),o.registerCallback(window.activeRenewals[l],l,i,a)):e&&e.indexOf(o.clientId)>-1&&1===e.length?(o._logger.verbose("renewing idToken"),o.renewIdToken(e,i,a,d,p,r)):(o._logger.verbose("renewing accesstoken"),o.renewToken(e,i,a,d,p,r))}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})}a(c.ErrorCodes.inputScopesError+"|"+u)})},e.prototype.loadIframeTimeout=function(e,t,n){var r=this,o=window.activeRenewals[n];this._logger.verbose("Set loading state to pending for: "+n+":"+o),this._cacheStorage.setItem(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusInProgress),this.loadFrame(e,t),setTimeout(function(){r._cacheStorage.getItem(c.Constants.renewStatus+o)===c.Constants.tokenRenewStatusInProgress&&(r._logger.verbose("Loading frame has timed out after: "+r.loadFrameTimeout/1e3+" seconds for scope "+n+":"+o),o&&window.callBackMappedToRenewStates[o]&&window.callBackMappedToRenewStates[o]("Token renewal operation failed due to timeout",null,"Token Renewal Failed",c.Constants.accessToken),r._cacheStorage.setItem(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusCancelled))},this.loadFrameTimeout)},e.prototype.loadFrame=function(e,t){var n=this;this._logger.info("LoadFrame: "+t);var r=t;setTimeout(function(){var o=n.addAdalFrame(r);""!==o.src&&"about:blank"!==o.src||(o.src=e,n._logger.infoPii("Frame Name : "+t+" Navigated to: "+e))},500)},e.prototype.addAdalFrame=function(e){if(void 0===e)return null;this._logger.info("Add msal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&-1===window.navigator.userAgent.indexOf("MSIE 5.0")){var n=document.createElement("iframe");n.setAttribute("id",e),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",t=document.getElementsByTagName("body")[0].appendChild(n)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeend",'');window.frames&&window.frames[e]&&(t=window.frames[e])}return t},e.prototype.renewToken=function(e,t,n,r,o,i){var s=e.join(" ").toLowerCase();this._logger.verbose("renewToken is called for scope:"+s);var a=this.addAdalFrame("msalRenewFrame"+s);i&&(o.extraQueryParameters=i);var u=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+r.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,JSON.stringify(r));var l=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(l))&&this._cacheStorage.setItem(l,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew token Expected state: "+o.state);var d=o.createNavigateUrl(e)+"&prompt=none";d=this.addHintParameters(d,r),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,s,t,n),this._logger.infoPii("Navigate to:"+d),a.src="about:blank",this.loadIframeTimeout(d,"msalRenewFrame"+s,s)},e.prototype.renewIdToken=function(e,t,n,r,o,i){e.join(" ").toLowerCase();this._logger.info("renewidToken is called");var s=this.addAdalFrame("msalIdTokenFrame");i&&(o.extraQueryParameters=i);var a=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+r.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(a))&&this._cacheStorage.setItem(a,JSON.stringify(r));var u=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew Idtoken Expected state: "+o.state);var l=o.createNavigateUrl(e)+"&prompt=none";l=this.addHintParameters(l,r),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,this.clientId,t,n),this._logger.infoPii("Navigate to:"+l),s.src="about:blank",this.loadIframeTimeout(l,"msalIdTokenFrame",this.clientId)},e.prototype.getUser=function(){if(this._user)return this._user;var e=this._cacheStorage.getItem(c.Constants.idTokenKey),t=this._cacheStorage.getItem(c.Constants.msalClientInfo);if(!f.Utils.isEmpty(e)&&!f.Utils.isEmpty(t)){var n=new u.IdToken(e),r=new a.ClientInfo(t);return this._user=h.User.createUser(n,r,this.authority),this._user}return null},e.prototype.handleAuthenticationResponse=function(e){null==e&&(e=window.location.hash);var t=null,n=!1,r=!1;try{r=window.opener&&window.opener.msal&&window.opener.msal!==window.msal}catch(e){r=!1}r?(t=window.opener.msal,n=!0):window.parent&&window.parent.msal&&(t=window.parent.msal);var o,i=t.getRequestInfo(e),s=null,a=null;if(t._logger.info("Returned from redirect url"),window.parent!==window&&window.parent.msal)a=window.parent.callBackMappedToRenewStates[i.stateResponse];else if(r)a=window.opener.callBackMappedToRenewStates[i.stateResponse];else{if(t._navigateToLoginRequestUrl)return a=null,t._cacheStorage.setItem(c.Constants.urlHash,e),!1,void(window.parent!==window||n||(window.location.href=t._cacheStorage.getItem(c.Constants.loginRequest)));a=t._tokenReceivedCallback,window.location.hash=""}t.saveTokenFromHash(i),i.requestType===c.Constants.renewToken&&window.parent?(window.parent!==window?t._logger.verbose("Window is in iframe, acquiring token silently"):t._logger.verbose("acquiring token interactive in progress"),s=i.parameters[c.Constants.accessToken]||i.parameters[c.Constants.idToken],o=c.Constants.accessToken):i.requestType===c.Constants.login&&(s=i.parameters[c.Constants.idToken],o=c.Constants.idToken);var u=i.parameters[c.Constants.errorDescription],l=i.parameters[c.Constants.error];try{a&&a.call(t,u,s,l,o)}catch(e){t._logger.error("Error occurred in token received callback function: "+e)}if(r)for(var d=0;d-1){this._logger.info("Fragment has id token"),this._loginInProgress=!1,i=new u.IdToken(e.parameters[c.Constants.idToken]),e.parameters.hasOwnProperty(c.Constants.clientInfo)?s=e.parameters[c.Constants.clientInfo]:this._logger.warning("ClientInfo not received in the response from AAD"),n=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse;var d=void 0;f.Utils.isEmpty(this._cacheStorage.getItem(n))||(d=this._cacheStorage.getItem(n),d=f.Utils.replaceFirstPath(d,i.tenantId)),this._user=h.User.createUser(i,new a.ClientInfo(s),d),i&&i.nonce?i.nonce!==this._cacheStorage.getItem(c.Constants.nonceIdToken)?(this._user=null,this._cacheStorage.setItem(c.Constants.loginError,"Nonce Mismatch. Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce),this._logger.error("Nonce Mismatch.Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce)):(this._cacheStorage.setItem(c.Constants.idTokenKey,e.parameters[c.Constants.idToken]),this._cacheStorage.setItem(c.Constants.msalClientInfo,s),this.saveAccessToken(d,e,this._user,s,i)):(n=e.stateResponse,r=e.stateResponse,this._logger.error("Invalid id_token received in the response"),e.parameters.error="invalid idToken",e.parameters.error_description="Invalid idToken. idToken: "+e.parameters[c.Constants.idToken],this._cacheStorage.setItem(c.Constants.msalError,"invalid idToken"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid idToken. idToken: "+e.parameters[c.Constants.idToken]))}}else n=e.stateResponse,r=e.stateResponse,this._logger.error("State Mismatch.Expected State: "+this._cacheStorage.getItem(c.Constants.stateLogin)+",Actual State: "+e.stateResponse),e.parameters.error="Invalid_state",e.parameters.error_description="Invalid_state. state: "+e.stateResponse,this._cacheStorage.setItem(c.Constants.msalError,"Invalid_state"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid_state. state: "+e.stateResponse);this._cacheStorage.setItem(c.Constants.renewStatus+e.stateResponse,c.Constants.tokenRenewStatusCompleted),this._cacheStorage.removeAcquireTokenEntries(n,r)},e.prototype.isCallback=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e);return t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken)},e.prototype.getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},e.prototype.getRequestInfo=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e),n=new p.TokenResponse;if(t&&(n.parameters=t,t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken))){n.valid=!0;var r=void 0;if(!t.hasOwnProperty("state"))return n;if(r=t.state,n.stateResponse=r,r===this._cacheStorage.getItem(c.Constants.stateLogin))return n.requestType=c.Constants.login,n.stateMatch=!0,n;if(r===this._cacheStorage.getItem(c.Constants.stateAcquireToken))return n.requestType=c.Constants.renewToken,n.stateMatch=!0,n;if(!n.stateMatch){n.requestType=window.requestType;for(var o=window.renewStates,i=0;i-1&&t+10)for(var t=0;t-1)return null;if(this._endpoints.size>0)for(var n=0,r=Array.from(this._endpoints.keys());n-1)return this._endpoints.get(o)}return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this.getHostFromUri(e)===this.getHostFromUri(this._redirectUri)?new Array(this.clientId):null:new Array(this.clientId)},e.prototype.setloginInProgress=function(e){this._loginInProgress=e},e.prototype.getAcquireTokenInProgress=function(){return this._acquireTokenInProgress},e.prototype.setAcquireTokenInProgress=function(e){this._acquireTokenInProgress=e},e.prototype.getLogger=function(){return this._logger},r.__decorate([y],e.prototype,"acquireTokenSilent",null),e}();t.UserAgentApplication=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,o,i){this.authority=e,this.clientId=t,this.scopes=n,this.userIdentifier=r.Utils.base64EncodeStringUrlSafe(o)+"."+r.Utils.base64EncodeStringUrlSafe(i)}return e}();t.AccessTokenKey=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r){this.accessToken=e,this.idToken=t,this.expiresIn=n,this.clientInfo=r}return e}();t.AccessTokenValue=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,o,i){this.authorityInstance=e,this.clientId=t,this.scopes=n,this.responseType=o,this.redirectUri=i,this.correlationId=r.Utils.createNewGuid(),this.state=r.Utils.createNewGuid(),this.nonce=r.Utils.createNewGuid(),this.xClientSku="MSAL.JS",this.xClientVer=r.Utils.getLibraryVersion()}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},enumerable:!0,configurable:!0}),e.prototype.createNavigateUrl=function(e){e||(e=[this.clientId]),-1===e.indexOf(this.clientId)&&e.push(this.clientId);var t=[];t.push("response_type="+this.responseType),this.translateclientIdUsedInScope(e),t.push("scope="+encodeURIComponent(this.parseScope(e))),t.push("client_id="+encodeURIComponent(this.clientId)),t.push("redirect_uri="+encodeURIComponent(this.redirectUri)),t.push("state="+encodeURIComponent(this.state)),t.push("nonce="+encodeURIComponent(this.nonce)),t.push("client_info=1"),t.push("x-client-SKU="+this.xClientSku),t.push("x-client-Ver="+this.xClientVer),this.extraQueryParameters&&t.push(this.extraQueryParameters),t.push("client-request-id="+encodeURIComponent(this.correlationId));var n=this.authorityInstance.AuthorizationEndpoint;return n.indexOf("?")<0?n+="?":n+="&",""+n+t.join("&")},e.prototype.translateclientIdUsedInScope=function(e){var t=e.indexOf(this.clientId);t>=0&&(e.splice(t,1),-1===e.indexOf("openid")&&e.push("openid"),-1===e.indexOf("profile")&&e.push("profile"))},e.prototype.parseScope=function(e){var t="";if(e)for(var n=0;n-1||""!=t&&r.indexOf(t)>-1)&&this.removeItem(r)},e.prototype.resetCacheItems=function(){var e=window[this._cacheLocation];if(!e)throw new Error("localStorage and sessionStorage are not supported");var t=void 0;for(t in e)e.hasOwnProperty(t)&&-1!==t.indexOf(r.Constants.msal)&&this.setItem(t,""),e.hasOwnProperty(t)&&-1!==t.indexOf(r.Constants.renewStatus)&&this.removeItem(t)},e}();t.Storage=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this.key=e,this.value=t}return e}();t.AccessTokenCacheItem=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(8),i=n(21),s=n(1),a=n(5),c=function(){function e(){}return e.DetectAuthorityFromUrl=function(e){switch(e=r.Utils.CanonicalizeUri(e),r.Utils.GetUrlComponents(e).PathSegments[0]){case"tfp":return s.AuthorityType.B2C;case"adfs":return s.AuthorityType.Adfs;default:return s.AuthorityType.Aad}},e.CreateInstance=function(t,n){switch(e.DetectAuthorityFromUrl(t)){case s.AuthorityType.B2C:return new i.B2cAuthority(t,n);case s.AuthorityType.Aad:return new o.AadAuthority(t,n);default:throw a.ErrorMessage.invalidAuthorityType}},e}();t.AuthorityFactory=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(8),i=n(1),s=n(5),a=n(0),c=function(e){function t(t,n){var r=e.call(this,t,n)||this,o=a.Utils.GetUrlComponents(t),i=o.PathSegments;if(i.length<3)throw s.ErrorMessage.b2cAuthorityUriInvalidPath;return r.CanonicalAuthority="https://"+o.HostNameAndPort+"/"+i[0]+"/"+i[1]+"/"+i[2]+"/",r}return r.__extends(t,e),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return i.AuthorityType.B2C},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,n){return t(e.DefaultOpenIdConfigurationEndpoint)});return this.IsValidationEnabled?this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)?t:new Promise(function(e,t){return t(s.ErrorMessage.unsupportedAuthorityValidation)}):t},t}(o.AadAuthority);t.B2cAuthority=c}])}); +var b=function(e,t){return(b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},I=function(){return I=Object.assign||function(e){for(var t,n=1,r=arguments.length;nthis._level||!this._piiLoggingEnabled&&n)){var i,s=(new Date).toUTCString();i=o.Utils.isEmpty(this._correlationId)?s+":"+o.Utils.getLibraryVersion()+"-"+r[e]+" "+t:s+":"+this._correlationId+"-"+o.Utils.getLibraryVersion()+"-"+r[e]+" "+t,this.executeCallback(e,i,n)}},e.prototype.executeCallback=function(e,t,n){this._localCallback&&this._localCallback(e,t,n)},e.prototype.error=function(e){this.logMessage(r.Error,e,!1)},e.prototype.errorPii=function(e){this.logMessage(r.Error,e,!0)},e.prototype.warning=function(e){this.logMessage(r.Warning,e,!1)},e.prototype.warningPii=function(e){this.logMessage(r.Warning,e,!0)},e.prototype.info=function(e){this.logMessage(r.Info,e,!1)},e.prototype.infoPii=function(e){this.logMessage(r.Info,e,!0)},e.prototype.verbose=function(e){this.logMessage(r.Verbose,e,!1)},e.prototype.verbosePii=function(e){this.logMessage(r.Verbose,e,!0)},e}();t.Logger=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return Object.defineProperty(e,"authorityUriInvalidPath",{get:function(){return"AuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"authorityUriInsecure",{get:function(){return"AuthorityUriInsecure"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"invalidAuthorityType",{get:function(){return"InvalidAuthorityType"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"unsupportedAuthorityValidation",{get:function(){return"UnsupportedAuthorityValidation"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"b2cAuthorityUriInvalidPath",{get:function(){return"B2cAuthorityUriInvalidPath"},enumerable:!0,configurable:!0}),e}();t.ErrorMessage=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.valid=!1,this.parameters={},this.stateMatch=!1,this.stateResponse="",this.requestType="unknown"}return e}();t.TokenResponse=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,r,o){this.displayableId=e,this.name=t,this.identityProvider=n,this.userIdentifier=r,this.idToken=o}return e.createUser=function(t,n,o){var i,s;n?(i=n.uid,s=n.utid):(i="",s="");var a=r.Utils.base64EncodeStringUrlSafe(i)+"."+r.Utils.base64EncodeStringUrlSafe(s);return new e(t.preferredName,t.name,t.issuer,a,t.decodedIdToken)},e}();t.User=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(1),i=n(9),s=function(e){function t(t,n){return e.call(this,t,n)||this}return r.__extends(t,e),Object.defineProperty(t.prototype,"AadInstanceDiscoveryEndpointUrl",{get:function(){return t.AadInstanceDiscoveryEndpoint+"?api-version=1.0&authorization_endpoint="+this.CanonicalAuthority+"oauth2/v2.0/authorize"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return o.AuthorityType.Aad},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,n){return t(e.DefaultOpenIdConfigurationEndpoint)});if(!this.IsValidationEnabled)return t;var n=this.CanonicalAuthorityUrlComponents.HostNameAndPort;return this.IsInTrustedHostList(n)?t:(new i.XhrClient).sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl,"GET",!0).then(function(e){return e.tenant_discovery_endpoint})},t.prototype.IsInTrustedHostList=function(e){return t.TrustedHostList[e.toLowerCase()]},t.AadInstanceDiscoveryEndpoint="https://login.microsoftonline.com/common/discovery/instance",t.TrustedHostList={"login.windows.net":"login.windows.net","login.chinacloudapi.cn":"login.chinacloudapi.cn","login.cloudgovapi.us":"login.cloudgovapi.us","login.microsoftonline.com":"login.microsoftonline.com","login.microsoftonline.de":"login.microsoftonline.de","login.microsoftonline.us":"login.microsoftonline.us"},t}(o.Authority);t.AadAuthority=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.prototype.sendRequestAsync=function(e,t,n){var r=this;return new Promise(function(n,o){var i=new XMLHttpRequest;if(i.open(t,e,!0),i.onload=function(e){(i.status<200||i.status>=300)&&o(r.handleError(i.responseText));try{var t=JSON.parse(i.responseText)}catch(e){o(r.handleError(i.responseText))}n(t)},i.onerror=function(e){o(i.status)},"GET"!==t)throw"not implemented";i.send()})},e.prototype.handleError=function(e){var t;try{if(t=JSON.parse(e),t.error)return t.error;throw e}catch(t){return e}},e}();t.XhrClient=r},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12);t.UserAgentApplication=r.UserAgentApplication;var o=n(4);t.Logger=o.Logger;var i=n(4);t.LogLevel=i.LogLevel;var s=n(7);t.User=s.User;var a=n(3);t.Constants=a.Constants;var c=n(6);t.TokenResponse=c.TokenResponse;var u=n(1);t.Authority=u.Authority},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(13),i=n(14),s=n(15),a=n(16),c=n(3),u=n(17),l=n(4),d=n(18),p=n(6),h=n(7),f=n(0),g=n(20),m={id_token:"id_token",token:"token",id_token_token:"id_token token"},y=function(e,t,n){var r=n.value;return n.value=function(){for(var e=[],t=0;t-1&&e.length>1?"ClientId can only be provided as a single scope":""},e.prototype.filterScopes=function(e){return e=e.filter(function(e){return"openid"!==e}),e=e.filter(function(e){return"profile"!==e})},e.prototype.registerCallback=function(e,t,n,r){var o=this;window.activeRenewals[t]=e,window.callBacksMappedToRenewStates[e]||(window.callBacksMappedToRenewStates[e]=[]),window.callBacksMappedToRenewStates[e].push({resolve:n,reject:r}),window.callBackMappedToRenewStates[e]||(window.callBackMappedToRenewStates[e]=function(n,r,i,s){window.activeRenewals[t]=null;for(var a=0;a-1?new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token,this._redirectUri):new s.AuthenticationRequestParameters(o,this.clientId,e,m.token,this._redirectUri):new s.AuthenticationRequestParameters(o,this.clientId,e,m.id_token_token,this._redirectUri),this.getCachedToken(r,t)}},e.prototype.getCachedToken=function(e,t){var n=null,r=e.scopes,o=this._cacheStorage.getAllAccessTokens(this.clientId,t?t.userIdentifier:null);if(0===o.length)return null;var i=[];if(e.authority){for(var s=0;s1)return{errorDesc:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority",token:null,error:"multiple_matching_tokens_detected"};var u=this.getUniqueAuthority(o,"authority");if(u.length>1)return{errorDesc:"Multiple authorities found in the cache. Pass authority in the API overload.",token:null,error:"multiple_matching_tokens_detected"};e.authorityInstance=g.AuthorityFactory.CreateInstance(u[0],this.validateAuthority)}}if(null!=n){var l=Number(n.value.expiresIn),d=this._clockSkew||300;return l&&l>f.Utils.now()+d?{errorDesc:null,token:n.value.accessToken,error:null}:(this._cacheStorage.removeItem(JSON.stringify(i[0].key)),null)}return null},e.prototype.getAllUsers=function(){for(var e=[],t=this._cacheStorage.getAllAccessTokens(c.Constants.clientId,c.Constants.userIdentifier),n=0;n-1?new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(l,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(l,o.clientId,e,m.id_token_token,o._redirectUri),o._cacheStorage.setItem(c.Constants.nonceIdToken,u.nonce);var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+a.userIdentifier+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(a));var n=c.Constants.authority+c.Constants.resourceDelimeter+u.state;f.Utils.isEmpty(o._cacheStorage.getItem(n))&&o._cacheStorage.setItem(n,l.CanonicalAuthority),r&&(u.extraQueryParameters=r);var i=u.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";(i=o.addHintParameters(i,a))&&(o._cacheStorage.setItem(c.Constants.stateAcquireToken,u.state),window.location.replace(i))})}},e.prototype.acquireTokenPopup=function(e,t,n,r){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);u&&!f.Utils.isEmpty(u)&&a(c.ErrorCodes.inputScopesError+"|"+u),e&&(e=o.filterScopes(e));var l=n||o.getUser();if(o._acquireTokenInProgress)return void a(c.ErrorCodes.acquireTokenProgressError+"|"+c.ErrorDescription.acquireTokenProgressError);var d=e.join(" ").toLowerCase();if(!l)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);o._acquireTokenInProgress=!0;var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance,y=o.openWindow("about:blank","_blank",1,o,i,a);y&&h.ResolveEndpointsAsync().then(function(){p=f.Utils.compareObjects(l,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri),o._cacheStorage.setItem(c.Constants.nonceIdToken,p.nonce),p.state=p.state;var t=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+l.userIdentifier+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(t))&&o._cacheStorage.setItem(t,JSON.stringify(l));var n=c.Constants.authority+c.Constants.resourceDelimeter+p.state;f.Utils.isEmpty(o._cacheStorage.getItem(n))&&o._cacheStorage.setItem(n,h.CanonicalAuthority),r&&(p.extraQueryParameters=r);var u=p.createNavigateUrl(e)+"&prompt=select_account&response_mode=fragment";u=o.addHintParameters(u,l),window.renewStates.push(p.state),window.requestType=c.Constants.renewToken,o.registerCallback(p.state,d,i,a),y&&(y.location.href=u)},function(){o._logger.info(c.ErrorCodes.endpointResolutionError+":"+c.ErrorDescription.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalError,c.ErrorCodes.endpointResolutionError),o._cacheStorage.setItem(c.Constants.msalErrorDescription,c.ErrorDescription.endpointResolutionError),a&&a(c.ErrorCodes.endpointResolutionError+"|"+c.ErrorDescription.endpointResolutionError),y&&y.close()}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})})},e.prototype.acquireTokenSilent=function(e,t,n,r){var o=this;return new Promise(function(i,a){var u=o.validateInputScope(e);if(!u||f.Utils.isEmpty(u)){e&&(e=o.filterScopes(e));var l=e.join(" ").toLowerCase(),d=n||o.getUser();if(!d)return void a(c.ErrorCodes.userLoginError+"|"+c.ErrorDescription.userLoginError);var p,h=t?g.AuthorityFactory.CreateInstance(t,o.validateAuthority):o.authorityInstance;p=f.Utils.compareObjects(d,o.getUser())?e.indexOf(o.clientId)>-1?new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.token,o._redirectUri):new s.AuthenticationRequestParameters(h,o.clientId,e,m.id_token_token,o._redirectUri);var y=o.getCachedToken(p,d);if(y){if(y.token)return o._logger.info("Token is already in cache for scope:"+l),void i(y.token);if(y.errorDesc||y.error)return o._logger.infoPii(y.errorDesc+":"+y.error),void a(y.errorDesc+"|"+y.error)}else o._logger.verbose("Token is not in cache for scope:"+l);return h.ResolveEndpointsAsync().then(function(){window.activeRenewals[l]?(o._logger.verbose("Renew token for scope: "+l+" is in progress. Registering callback"),o.registerCallback(window.activeRenewals[l],l,i,a)):e&&e.indexOf(o.clientId)>-1&&1===e.length?(o._logger.verbose("renewing idToken"),o.renewIdToken(e,i,a,d,p,r)):(o._logger.verbose("renewing accesstoken"),o.renewToken(e,i,a,d,p,r))}).catch(function(e){o._logger.warning("could not resolve endpoints"),a(e)})}a(c.ErrorCodes.inputScopesError+"|"+u)})},e.prototype.loadIframeTimeout=function(e,t,n){var r=this,o=window.activeRenewals[n];this._logger.verbose("Set loading state to pending for: "+n+":"+o),this._cacheStorage.setItem(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusInProgress),this.loadFrame(e,t),setTimeout(function(){r._cacheStorage.getItem(c.Constants.renewStatus+o)===c.Constants.tokenRenewStatusInProgress&&(r._logger.verbose("Loading frame has timed out after: "+r.loadFrameTimeout/1e3+" seconds for scope "+n+":"+o),o&&window.callBackMappedToRenewStates[o]&&window.callBackMappedToRenewStates[o]("Token renewal operation failed due to timeout",null,"Token Renewal Failed",c.Constants.accessToken),r._cacheStorage.setItem(c.Constants.renewStatus+o,c.Constants.tokenRenewStatusCancelled))},this.loadFrameTimeout)},e.prototype.loadFrame=function(e,t){var n=this;this._logger.info("LoadFrame: "+t);var r=t;setTimeout(function(){var o=n.addAdalFrame(r);""!==o.src&&"about:blank"!==o.src||(o.src=e,n._logger.infoPii("Frame Name : "+t+" Navigated to: "+e))},500)},e.prototype.addAdalFrame=function(e){if(void 0===e)return null;this._logger.info("Add msal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&-1===window.navigator.userAgent.indexOf("MSIE 5.0")){var n=document.createElement("iframe");n.setAttribute("id",e),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height="0",n.style.border="0",t=document.getElementsByTagName("body")[0].appendChild(n)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeend",'');window.frames&&window.frames[e]&&(t=window.frames[e])}return t},e.prototype.renewToken=function(e,t,n,r,o,i){var s=e.join(" ").toLowerCase();this._logger.verbose("renewToken is called for scope:"+s);var a=this.addAdalFrame("msalRenewFrame"+s);i&&(o.extraQueryParameters=i);var u=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+r.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,JSON.stringify(r));var l=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(l))&&this._cacheStorage.setItem(l,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew token Expected state: "+o.state);var d=o.createNavigateUrl(e)+"&prompt=none";d=this.addHintParameters(d,r),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,s,t,n),this._logger.infoPii("Navigate to:"+d),a.src="about:blank",this.loadIframeTimeout(d,"msalRenewFrame"+s,s)},e.prototype.renewIdToken=function(e,t,n,r,o,i){e.join(" ").toLowerCase();this._logger.info("renewidToken is called");var s=this.addAdalFrame("msalIdTokenFrame");i&&(o.extraQueryParameters=i);var a=c.Constants.acquireTokenUser+c.Constants.resourceDelimeter+r.userIdentifier+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(a))&&this._cacheStorage.setItem(a,JSON.stringify(r));var u=c.Constants.authority+c.Constants.resourceDelimeter+o.state;f.Utils.isEmpty(this._cacheStorage.getItem(u))&&this._cacheStorage.setItem(u,o.authority),this._cacheStorage.setItem(c.Constants.nonceIdToken,o.nonce),this._logger.verbose("Renew Idtoken Expected state: "+o.state);var l=o.createNavigateUrl(e)+"&prompt=none";l=this.addHintParameters(l,r),window.renewStates.push(o.state),window.requestType=c.Constants.renewToken,this.registerCallback(o.state,this.clientId,t,n),this._logger.infoPii("Navigate to:"+l),s.src="about:blank",this.loadIframeTimeout(l,"msalIdTokenFrame",this.clientId)},e.prototype.getUser=function(){if(this._user)return this._user;var e=this._cacheStorage.getItem(c.Constants.idTokenKey),t=this._cacheStorage.getItem(c.Constants.msalClientInfo);if(!f.Utils.isEmpty(e)&&!f.Utils.isEmpty(t)){var n=new u.IdToken(e),r=new a.ClientInfo(t);return this._user=h.User.createUser(n,r,this.authority),this._user}return null},e.prototype.handleAuthenticationResponse=function(e){null==e&&(e=window.location.hash);var t=null,n=!1,r=!1;try{r=window.opener&&window.opener.msal&&window.opener.msal!==window.msal}catch(e){r=!1}r?(t=window.opener.msal,n=!0):window.parent&&window.parent.msal&&(t=window.parent.msal);var o,i=t.getRequestInfo(e),s=null,a=null;if(t._logger.info("Returned from redirect url"),window.parent!==window&&window.parent.msal)a=window.parent.callBackMappedToRenewStates[i.stateResponse];else if(r)a=window.opener.callBackMappedToRenewStates[i.stateResponse];else{if(t._navigateToLoginRequestUrl)return a=null,t._cacheStorage.setItem(c.Constants.urlHash,e),!1,void(window.parent!==window||n||(window.location.href=t._cacheStorage.getItem(c.Constants.loginRequest)));a=t._tokenReceivedCallback,window.location.hash=""}t.saveTokenFromHash(i),i.requestType===c.Constants.renewToken&&window.parent?(window.parent!==window?t._logger.verbose("Window is in iframe, acquiring token silently"):t._logger.verbose("acquiring token interactive in progress"),s=i.parameters[c.Constants.accessToken]||i.parameters[c.Constants.idToken],o=c.Constants.accessToken):i.requestType===c.Constants.login&&(s=i.parameters[c.Constants.idToken],o=c.Constants.idToken);var u=i.parameters[c.Constants.errorDescription],l=i.parameters[c.Constants.error];try{a&&a.call(t,u,s,l,o)}catch(e){t._logger.error("Error occurred in token received callback function: "+e)}if(r)for(var d=0;d-1){this._logger.info("Fragment has id token"),this._loginInProgress=!1,i=new u.IdToken(e.parameters[c.Constants.idToken]),e.parameters.hasOwnProperty(c.Constants.clientInfo)?s=e.parameters[c.Constants.clientInfo]:this._logger.warning("ClientInfo not received in the response from AAD"),n=c.Constants.authority+c.Constants.resourceDelimeter+e.stateResponse;var d=void 0;f.Utils.isEmpty(this._cacheStorage.getItem(n))||(d=this._cacheStorage.getItem(n),d=f.Utils.replaceFirstPath(d,i.tenantId)),this._user=h.User.createUser(i,new a.ClientInfo(s),d),i&&i.nonce?i.nonce!==this._cacheStorage.getItem(c.Constants.nonceIdToken)?(this._user=null,this._cacheStorage.setItem(c.Constants.loginError,"Nonce Mismatch. Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce),this._logger.error("Nonce Mismatch.Expected Nonce: "+this._cacheStorage.getItem(c.Constants.nonceIdToken)+",Actual Nonce: "+i.nonce)):(this._cacheStorage.setItem(c.Constants.idTokenKey,e.parameters[c.Constants.idToken]),this._cacheStorage.setItem(c.Constants.msalClientInfo,s),this.saveAccessToken(d,e,this._user,s,i)):(n=e.stateResponse,r=e.stateResponse,this._logger.error("Invalid id_token received in the response"),e.parameters.error="invalid idToken",e.parameters.error_description="Invalid idToken. idToken: "+e.parameters[c.Constants.idToken],this._cacheStorage.setItem(c.Constants.msalError,"invalid idToken"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid idToken. idToken: "+e.parameters[c.Constants.idToken]))}}else n=e.stateResponse,r=e.stateResponse,this._logger.error("State Mismatch.Expected State: "+this._cacheStorage.getItem(c.Constants.stateLogin)+",Actual State: "+e.stateResponse),e.parameters.error="Invalid_state",e.parameters.error_description="Invalid_state. state: "+e.stateResponse,this._cacheStorage.setItem(c.Constants.msalError,"Invalid_state"),this._cacheStorage.setItem(c.Constants.msalErrorDescription,"Invalid_state. state: "+e.stateResponse);this._cacheStorage.setItem(c.Constants.renewStatus+e.stateResponse,c.Constants.tokenRenewStatusCompleted),this._cacheStorage.removeAcquireTokenEntries(n,r)},e.prototype.isCallback=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e);return t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken)},e.prototype.getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},e.prototype.getRequestInfo=function(e){e=this.getHash(e);var t=f.Utils.deserialize(e),n=new p.TokenResponse;if(t&&(n.parameters=t,t.hasOwnProperty(c.Constants.errorDescription)||t.hasOwnProperty(c.Constants.error)||t.hasOwnProperty(c.Constants.accessToken)||t.hasOwnProperty(c.Constants.idToken))){n.valid=!0;var r=void 0;if(!t.hasOwnProperty("state"))return n;if(r=t.state,n.stateResponse=r,r===this._cacheStorage.getItem(c.Constants.stateLogin))return n.requestType=c.Constants.login,n.stateMatch=!0,n;if(r===this._cacheStorage.getItem(c.Constants.stateAcquireToken))return n.requestType=c.Constants.renewToken,n.stateMatch=!0,n;if(!n.stateMatch){n.requestType=window.requestType;for(var o=window.renewStates,i=0;i-1&&t+10)for(var t=0;t-1)return null;if(this._endpoints.size>0)for(var n=0,r=Array.from(this._endpoints.keys());n-1)return this._endpoints.get(o)}return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this.getHostFromUri(e)===this.getHostFromUri(this._redirectUri)?new Array(this.clientId):null:new Array(this.clientId)},e.prototype.setloginInProgress=function(e){this._loginInProgress=e},e.prototype.getAcquireTokenInProgress=function(){return this._acquireTokenInProgress},e.prototype.setAcquireTokenInProgress=function(e){this._acquireTokenInProgress=e},e.prototype.getLogger=function(){return this._logger},r.__decorate([y],e.prototype,"acquireTokenSilent",null),e}();t.UserAgentApplication=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,o,i){this.authority=e,this.clientId=t,this.scopes=n,this.userIdentifier=r.Utils.base64EncodeStringUrlSafe(o)+"."+r.Utils.base64EncodeStringUrlSafe(i)}return e}();t.AccessTokenKey=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r){this.accessToken=e,this.idToken=t,this.expiresIn=n,this.clientInfo=r}return e}();t.AccessTokenValue=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(){function e(e,t,n,o,i){this.authorityInstance=e,this.clientId=t,this.scopes=n,this.responseType=o,this.redirectUri=i,this.correlationId=r.Utils.createNewGuid(),this.state=r.Utils.createNewGuid(),this.nonce=r.Utils.createNewGuid(),this.xClientSku="MSAL.JS",this.xClientVer=r.Utils.getLibraryVersion()}return Object.defineProperty(e.prototype,"authority",{get:function(){return this.authorityInstance.CanonicalAuthority},enumerable:!0,configurable:!0}),e.prototype.createNavigateUrl=function(e){e||(e=[this.clientId]),-1===e.indexOf(this.clientId)&&e.push(this.clientId);var t=[];t.push("response_type="+this.responseType),this.translateclientIdUsedInScope(e),t.push("scope="+encodeURIComponent(this.parseScope(e))),t.push("client_id="+encodeURIComponent(this.clientId)),t.push("redirect_uri="+encodeURIComponent(this.redirectUri)),t.push("state="+encodeURIComponent(this.state)),t.push("nonce="+encodeURIComponent(this.nonce)),t.push("client_info=1"),t.push("x-client-SKU="+this.xClientSku),t.push("x-client-Ver="+this.xClientVer),this.extraQueryParameters&&t.push(this.extraQueryParameters),t.push("client-request-id="+encodeURIComponent(this.correlationId));var n=this.authorityInstance.AuthorizationEndpoint;return n.indexOf("?")<0?n+="?":n+="&",""+n+t.join("&")},e.prototype.translateclientIdUsedInScope=function(e){var t=e.indexOf(this.clientId);t>=0&&(e.splice(t,1),-1===e.indexOf("openid")&&e.push("openid"),-1===e.indexOf("profile")&&e.push("profile"))},e.prototype.parseScope=function(e){var t="";if(e)for(var n=0;n-1||""!=t&&r.indexOf(t)>-1)&&this.removeItem(r)},e.prototype.resetCacheItems=function(){var e=window[this._cacheLocation];if(!e)throw new Error("localStorage and sessionStorage are not supported");var t=void 0;for(t in e)e.hasOwnProperty(t)&&-1!==t.indexOf(r.Constants.msal)&&this.setItem(t,""),e.hasOwnProperty(t)&&-1!==t.indexOf(r.Constants.renewStatus)&&this.removeItem(t)},e}();t.Storage=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this.key=e,this.value=t}return e}();t.AccessTokenCacheItem=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(8),i=n(21),s=n(1),a=n(5),c=function(){function e(){}return e.DetectAuthorityFromUrl=function(e){switch(e=r.Utils.CanonicalizeUri(e),r.Utils.GetUrlComponents(e).PathSegments[0]){case"tfp":return s.AuthorityType.B2C;case"adfs":return s.AuthorityType.Adfs;default:return s.AuthorityType.Aad}},e.CreateInstance=function(t,n){switch(e.DetectAuthorityFromUrl(t)){case s.AuthorityType.B2C:return new i.B2cAuthority(t,n);case s.AuthorityType.Aad:return new o.AadAuthority(t,n);default:throw a.ErrorMessage.invalidAuthorityType}},e}();t.AuthorityFactory=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(8),i=n(1),s=n(5),a=n(0),c=function(e){function t(t,n){var r=e.call(this,t,n)||this,o=a.Utils.GetUrlComponents(t),i=o.PathSegments;if(i.length<3)throw s.ErrorMessage.b2cAuthorityUriInvalidPath;return r.CanonicalAuthority="https://"+o.HostNameAndPort+"/"+i[0]+"/"+i[1]+"/"+i[2]+"/",r}return r.__extends(t,e),Object.defineProperty(t.prototype,"AuthorityType",{get:function(){return i.AuthorityType.B2C},enumerable:!0,configurable:!0}),t.prototype.GetOpenIdConfigurationEndpointAsync=function(){var e=this,t=new Promise(function(t,n){return t(e.DefaultOpenIdConfigurationEndpoint)});return this.IsValidationEnabled?this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)?t:new Promise(function(e,t){return t(s.ErrorMessage.unsupportedAuthorityValidation)}):t},t}(o.AadAuthority);t.B2cAuthority=c}])}); //# sourceMappingURL=msal.min.js.map \ No newline at end of file diff --git a/dist/msal.min.js.map b/dist/msal.min.js.map index d329e6d483..f335c566e3 100644 --- a/dist/msal.min.js.map +++ b/dist/msal.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///msal.min.js","webpack:///webpack/bootstrap 69c9743edfd0c24a95f0","webpack:///./src/Utils.ts","webpack:///./src/Authority.ts","webpack:///./node_modules/tslib/tslib.es6.js","webpack:///./src/Constants.ts","webpack:///./src/Logger.ts","webpack:///./src/ErrorMessage.ts","webpack:///./src/RequestInfo.ts","webpack:///./src/User.ts","webpack:///./src/AadAuthority.ts","webpack:///./src/XHRClient.ts","webpack:///./src/index.ts","webpack:///./src/UserAgentApplication.ts","webpack:///./src/AccessTokenKey.ts","webpack:///./src/AccessTokenValue.ts","webpack:///./src/AuthenticationRequestParameters.ts","webpack:///./src/ClientInfo.ts","webpack:///./src/IdToken.ts","webpack:///./src/Storage.ts","webpack:///./src/AccessTokenCacheItem.ts","webpack:///./src/AuthorityFactory.ts","webpack:///./src/B2cAuthority.ts"],"names":["root","factory","exports","module","define","amd","self","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","value","Utils","compareObjects","u1","u2","userIdentifier","expiresIn","expires","now","parseInt","Math","round","Date","getTime","isEmpty","str","length","extractIdToken","encodedIdToken","decodedToken","decodeJwt","base64IdToken","JWSPayload","base64Decoded","base64DecodeStringUrlSafe","JSON","parse","err","base64EncodeStringUrlSafe","input","window","btoa","encode","replace","atob","decodeURIComponent","encodeURIComponent","decode","chr1","chr2","chr3","enc1","enc2","enc3","enc4","keyStr","output","utf8Encode","charCodeAt","isNaN","charAt","utftext","String","fromCharCode","codes","Error","h1","h2","h3","h4","bits","c1","c2","c3","decoded","indexOf","jwtToken","idTokenPartsRegex","matches","exec","header","JWSSig","deserialize","query","match","pl","search","obj","isIntersectingScopes","cachedScopes","scopes","convertToLowerCase","toLowerCase","containsScope","every","toString","map","scope","removeElement","filter","decimalToHex","num","hex","getLibraryVersion","replaceFirstPath","href","tenantId","urlObject","GetUrlComponents","pathArray","PathSegments","shift","Protocol","HostNameAndPort","join","createNewGuid","cryptoObj","crypto","getRandomValues","buffer","Uint8Array","guidHolder","r","guidResponse","random","url","regEx","RegExp","urlComponents","AbsolutePath","pathSegments","split","val","CanonicalizeUri","endsWith","suffix","Utils_1","ErrorMessage_1","XHRClient_1","AuthorityType","Authority","authority","validateAuthority","IsValidationEnabled","CanonicalAuthority","validateAsUri","CanonicalAuthorityUrlComponents","validateResolved","tenantDiscoveryResponse","AuthorizationEndpoint","Tenant","EndSessionEndpoint","Issuer","canonicalAuthority","set","canonicalAuthorityUrlComponents","components","e","ErrorMessage","invalidAuthorityType","authorityUriInsecure","authorityUriInvalidPath","DiscoverEndpoints","openIdConfigurationEndpoint","XhrClient","sendRequestAsync","then","response","authorization_endpoint","end_session_endpoint","issuer","ResolveEndpointsAsync","_this","GetOpenIdConfigurationEndpointAsync","openIdConfigurationEndpointResponse","__webpack_exports__","__extends","b","__","constructor","extendStatics","create","__rest","t","getOwnPropertySymbols","__decorate","decorators","target","key","desc","arguments","getOwnPropertyDescriptor","Reflect","decorate","__param","paramIndex","decorator","__metadata","metadataKey","metadataValue","metadata","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","rejected","result","done","apply","__generator","body","verb","v","op","f","TypeError","_","y","label","ops","pop","trys","push","g","sent","throw","return","Symbol","iterator","__exportStar","__values","__read","ar","error","__spread","concat","__await","__asyncGenerator","a","q","resume","settle","fulfill","asyncIterator","__asyncDelegator","__asyncValues","__makeTemplateObject","cooked","raw","__importStar","mod","k","default","__importDefault","__assign","setPrototypeOf","__proto__","Array","assign","Constants","_popUpWidth","width","_popUpHeight","height","ErrorCodes","ErrorDescription","LogLevel","Logger","localCallback","options","_level","Info","_a","correlationId","_b","level","_c","piiLoggingEnabled","_localCallback","_correlationId","_piiLoggingEnabled","logMessage","logLevel","containsPii","log","timestamp","toUTCString","executeCallback","message","errorPii","warning","Warning","warningPii","info","infoPii","verbose","Verbose","verbosePii","TokenResponse","valid","parameters","stateMatch","stateResponse","requestType","User","displayableId","identityProvider","idToken","createUser","clientInfo","uid","utid","preferredName","decodedIdToken","tslib_1","Authority_1","AadAuthority","_super","AadInstanceDiscoveryEndpoint","Aad","resultPromise","DefaultOpenIdConfigurationEndpoint","host","IsInTrustedHostList","AadInstanceDiscoveryEndpointUrl","tenant_discovery_endpoint","TrustedHostList","login.windows.net","login.chinacloudapi.cn","login.cloudgovapi.us","login.microsoftonline.com","login.microsoftonline.de","login.microsoftonline.us","method","enableCaching","xhr","XMLHttpRequest","open","onload","ev","status","handleError","responseText","jsonResponse","onerror","send","UserAgentApplication_1","UserAgentApplication","Logger_1","Logger_2","User_1","Constants_1","RequestInfo_1","AccessTokenKey_1","AccessTokenValue_1","AuthenticationRequestParameters_1","ClientInfo_1","IdToken_1","Storage_1","AuthorityFactory_1","ResponseTypes","id_token","token","id_token_token","resolveTokenOnlyIfOutOfIframe","propertyKey","descriptor","tokenAcquisitionMethod","args","_i","isInIframe","clientId","tokenReceivedCallback","_cacheLocations","localStorage","sessionStorage","_clockSkew","_tokenReceivedCallback","_isAngular","cacheLocation","redirectUri","location","_d","postLogoutRedirectUri","_e","logger","_f","loadFrameTimeout","_g","navigateToLoginRequestUrl","_h","isAngular","_j","anonymousEndpoints","_k","endPoints","Map","_redirectUri","_postLogoutredirectUri","_loginInProgress","_acquireTokenInProgress","_cacheLocation","_navigateToLoginRequestUrl","_anonymousEndpoints","_endpoints","_cacheStorage","Storage","_logger","openedWindows","activeRenewals","renewStates","callBackMappedToRenewStates","callBacksMappedToRenewStates","msal","urlHash","hash","isCallback","handleAuthenticationResponse","pendingCallback","getItem","processCallBack","authorityInstance","AuthorityFactory","CreateInstance","requestInfo","getRequestInfo","saveTokenFromHash","tokenType","accessToken","errorDesc","errorDescription","removeItem","loginRedirect","extraQueryParameters","loginProgressError","isValidScope","validateInputScope","inputScopesError","filterScopes","authenticationRequest","AuthenticationRequestParameters","loginStartPage","angularLoginRequest","setItem","loginRequest","loginError","stateLogin","state","nonceIdToken","nonce","msalError","msalErrorDescription","authorityKey","resourceDelimeter","urlNavigate","createNavigateUrl","promptUser","loginPopup","popUpWindow","openWindow","login","registerCallback","endpointResolutionError","close","catch","title","interval","instance","popupWindow","openPopup","popUpWidth","popUpHeight","popUpWindowError","pollTimer","setInterval","closed","userCancelledError","clearInterval","broadcast","popUpWindowLocation","eventName","data","evt","CustomEvent","detail","dispatchEvent","logout","clearCache","_user","accessTokenItems","getAllAccessTokens","stringify","resetCacheItems","clearCacheForScope","winLeft","screenLeft","screenX","winTop","screenTop","screenY","innerWidth","document","documentElement","clientWidth","innerHeight","clientHeight","left","top_1","focus","isArray","element","expectedState","getCachedTokenInternal","user","userObject","getUser","newAuthority","getCachedToken","accessTokenCacheItem","tokenCacheItems","filteredItems","cacheItem","authorityList","getUniqueAuthority","expired","Number","offset","getAllUsers","users","accessTokenCacheItems","IdToken","ClientInfo","getUniqueUsers","flags","uniqueUsers","index","forEach","addHintParameters","decodedClientInfo","urlContainsQueryStringParameter","test","acquireTokenRedirect","userLoginError","acquireTokenAuthority","acquireTokenUserKey","acquireTokenUser","stateAcquireToken","acquireTokenPopup","acquireTokenProgressError","renewToken","acquireTokenSilent","scope_1","userObject_1","authenticationRequest_1","cacheResult","renewIdToken","loadIframeTimeout","frameName","renewStatus","tokenRenewStatusInProgress","loadFrame","setTimeout","tokenRenewStatusCancelled","frameCheck","frameHandle","addAdalFrame","src","iframeId","adalFrame","getElementById","createElement","navigator","userAgent","ifr","setAttribute","style","visibility","position","border","getElementsByTagName","appendChild","insertAdjacentHTML","frames","rawIdToken","idTokenKey","rawClientInfo","msalClientInfo","isPopup","isWindowOpenerMsal","opener","parent","saveAccessToken","tokenResponse","clientObj","consentedScopes","accessTokenKey","AccessTokenKey","accessTokenValue","AccessTokenValue","expiration","userKey","sessionState","msalSessionState","tokenRenewStatusCompleted","removeAcquireTokenEntries","getHash","substring","statesInParentContext","getScopeFromState","splitIndex","loginInProgress","getHostFromUri","uri","extractedUri","getScopesForEndpoint","endpoint","size","from","keys","setloginInProgress","getAcquireTokenInProgress","setAcquireTokenInProgress","acquireTokenInProgress","getLogger","responseType","xClientSku","xClientVer","translateclientIdUsedInScope","parseScope","authEndpoint","clientIdIndex","splice","scopeList","_uid","_utid","objectId","subject","version","homeObjectId","AccessTokenCacheItem_1","_instance","_localStorageSupported","_sessionStorageSupported","clear","results","storage","AccessTokenCacheItem","AadAuthority_1","B2cAuthority_1","DetectAuthorityFromUrl","authorityUrl","B2C","Adfs","B2cAuthority","b2cAuthorityUriInvalidPath","unsupportedAuthorityValidation"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,UAAAH,GACA,gBAAAC,SACAA,QAAA,KAAAD,IAEAD,EAAA,KAAAC,KACC,mBAAAK,WAAAC,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAR,OAGA,IAAAC,GAAAQ,EAAAD,IACAE,EAAAF,EACAG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AML,GAAAqB,aAAaC,uBAInC8Q,IAnCanc,GAAAmc,oBrBowHP,SAAUlc,EAAQD,EAASO,GAEjC,YAwBAY,QAAOC,eAAepB,EAAS,cAAgBgC,OAAO,GACtD,IAAIuT,GAAUhV,EAAoB,GsBxyHlC6pB,EAAA7pB,EAAA,GACAiV,EAAAjV,EAAA,GACAwJ,EAAAxJ,EAAA,GACAuJ,EAAAvJ,EAAA,GAKAmqB,EAAA,SAAAhV,GACE,QAAAgV,GAAmBvgB,EAAmBC,GAAtC,GAAA8B,GACEwJ,EAAA9U,KAAAP,KAAM8J,EAAWC,IAAkB/J,KAC/BiJ,EAAgBQ,EAAA7H,MAAMiG,iBAAiBiC,GAEvCX,EAAeF,EAAclB,YACjC,IAAIoB,EAAaxG,OAAS,EACtB,KAAM+G,GAAAqB,aAAauf,0BtB2yHnB,OsBxyHJze,GAAK5B,mBAAqB,WAAWhB,EAAcf,gBAAe,IAAIiB,EAAa,GAAE,IAAIA,EAAa,GAAE,IAAIA,EAAa,GAAE,ItBwyHhH0C,EsB/wHf,MAnCkCqJ,GAAAjJ,UAAAoe,EAAAhV,GAahCvU,OAAAC,eAAWspB,EAAA9oB,UAAA,iBtBwyHLL,IsBxyHN,WACE,MAAOiU,GAAAvL,cAAcugB,KtB0yHjBlpB,YAAY,EACZD,cAAc,IsBryHbqpB,EAAA9oB,UAAAuK,oCAAP,cAAAD,GAAA7L,KACMwV,EAAgB,GAAIzH,SAAgB,SAACC,EAASC,GAChD,MAAAD,GAAQnC,EAAK4J,qCAEf,OAAKzV,MAAKgK,oBAINhK,KAAK2V,oBAAoB3V,KAAKmK,gCAAgCjC,iBACzDsN,EAGF,GAAIzH,SAAgB,SAACC,EAASC,GACnC,MAAAA,GAAOvE,EAAAqB,aAAawf,kCARb/U,GAUb6U,GAnCkCN,EAAA3U,aAArBzV,GAAA0qB","file":"msal.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 10);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Utils = /** @class */ (function () {\r\n function Utils() {\r\n }\r\n Utils.compareObjects = function (u1, u2) {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Utils.expiresIn = function (expires) {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n };\r\n Utils.now = function () {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n };\r\n Utils.isEmpty = function (str) {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n };\r\n Utils.extractIdToken = function (encodedIdToken) {\r\n // id token will be decoded to get the username\r\n var decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n var base64IdToken = decodedToken.JWSPayload;\r\n var base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n }\r\n catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n return null;\r\n };\r\n Utils.base64EncodeStringUrlSafe = function (input) {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n };\r\n Utils.base64DecodeStringUrlSafe = function (base64IdToken) {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n };\r\n Utils.encode = function (input) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n input = this.utf8Encode(input);\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n };\r\n Utils.utf8Encode = function (input) {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n return utftext;\r\n };\r\n Utils.decode = function (base64IdToken) {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n var h1, h2, h3, h4, bits, c1, c2, c3, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n };\r\n Utils.decodeJwt = function (jwtToken) {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n var idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n var matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n var crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n };\r\n Utils.deserialize = function (query) {\r\n var match; // Regex for replacing addition symbol with a space\r\n var pl = /\\+/g;\r\n var search = /([^&=]+)=([^&]*)/g;\r\n var decode = function (s) { return decodeURIComponent(s.replace(pl, \" \")); };\r\n var obj = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n };\r\n Utils.isIntersectingScopes = function (cachedScopes, scopes) {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (var i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Utils.containsScope = function (cachedScopes, scopes) {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every(function (value) { return cachedScopes.indexOf(value.toString().toLowerCase()) >= 0; });\r\n };\r\n Utils.convertToLowerCase = function (scopes) {\r\n return scopes.map(function (scope) { return scope.toLowerCase(); });\r\n };\r\n Utils.removeElement = function (scopes, scope) {\r\n return scopes.filter(function (value) { return value !== scope; });\r\n };\r\n Utils.decimalToHex = function (num) {\r\n var hex = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n };\r\n Utils.getLibraryVersion = function () {\r\n return \"0.1.8\";\r\n };\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n Utils.replaceFirstPath = function (href, tenantId) {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n };\r\n Utils.createNewGuid = function () {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n var cryptoObj = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n var buffer = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n var guidHolder = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n var hex = \"0123456789abcdef\";\r\n var r = 0;\r\n var guidResponse = \"\";\r\n for (var i = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n }\r\n else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n }\r\n else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n };\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n Utils.GetUrlComponents = function (url) {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n var match = url.match(regEx);\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n var urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n var pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter(function (val) { return val && val.length > 0; }); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n };\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n Utils.CanonicalizeUri = function (url) {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n return url;\r\n };\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n Utils.endsWith = function (url, suffix) {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n };\r\n return Utils;\r\n}());\r\nexports.Utils = Utils;\r\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar XHRClient_1 = __webpack_require__(9);\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n/*\r\n * @hidden\r\n */\r\nvar AuthorityType;\r\n(function (AuthorityType) {\r\n AuthorityType[AuthorityType[\"Aad\"] = 0] = \"Aad\";\r\n AuthorityType[AuthorityType[\"Adfs\"] = 1] = \"Adfs\";\r\n AuthorityType[AuthorityType[\"B2C\"] = 2] = \"B2C\";\r\n})(AuthorityType = exports.AuthorityType || (exports.AuthorityType = {}));\r\n/*\r\n * @hidden\r\n */\r\nvar Authority = /** @class */ (function () {\r\n function Authority(authority, validateAuthority) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n this.validateAsUri();\r\n }\r\n Object.defineProperty(Authority.prototype, \"Tenant\", {\r\n get: function () {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"AuthorizationEndpoint\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"EndSessionEndpoint\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"SelfSignedJwtAudience\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Authority.prototype.validateResolved = function () {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n };\r\n Object.defineProperty(Authority.prototype, \"CanonicalAuthority\", {\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n get: function () {\r\n return this.canonicalAuthority;\r\n },\r\n set: function (url) {\r\n this.canonicalAuthority = Utils_1.Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"CanonicalAuthorityUrlComponents\", {\r\n get: function () {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils_1.Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n return this.canonicalAuthorityUrlComponents;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"DefaultOpenIdConfigurationEndpoint\", {\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n get: function () {\r\n return this.CanonicalAuthority + \"v2.0/.well-known/openid-configuration\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n Authority.prototype.validateAsUri = function () {\r\n var components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n }\r\n catch (e) {\r\n throw ErrorMessage_1.ErrorMessage.invalidAuthorityType;\r\n }\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage_1.ErrorMessage.authorityUriInsecure;\r\n }\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage_1.ErrorMessage.authorityUriInvalidPath;\r\n }\r\n };\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n Authority.prototype.DiscoverEndpoints = function (openIdConfigurationEndpoint) {\r\n var client = new XHRClient_1.XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then(function (response) {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n };\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n Authority.prototype.ResolveEndpointsAsync = function () {\r\n var _this = this;\r\n var openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(function (openIdConfigurationEndpointResponse) {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return _this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then(function (tenantDiscoveryResponse) {\r\n _this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return _this;\r\n });\r\n };\r\n return Authority;\r\n}());\r\nexports.Authority = Authority;\r\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (immutable) */ __webpack_exports__[\"__extends\"] = __extends;\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__assign\", function() { return __assign; });\n/* harmony export (immutable) */ __webpack_exports__[\"__rest\"] = __rest;\n/* harmony export (immutable) */ __webpack_exports__[\"__decorate\"] = __decorate;\n/* harmony export (immutable) */ __webpack_exports__[\"__param\"] = __param;\n/* harmony export (immutable) */ __webpack_exports__[\"__metadata\"] = __metadata;\n/* harmony export (immutable) */ __webpack_exports__[\"__awaiter\"] = __awaiter;\n/* harmony export (immutable) */ __webpack_exports__[\"__generator\"] = __generator;\n/* harmony export (immutable) */ __webpack_exports__[\"__exportStar\"] = __exportStar;\n/* harmony export (immutable) */ __webpack_exports__[\"__values\"] = __values;\n/* harmony export (immutable) */ __webpack_exports__[\"__read\"] = __read;\n/* harmony export (immutable) */ __webpack_exports__[\"__spread\"] = __spread;\n/* harmony export (immutable) */ __webpack_exports__[\"__await\"] = __await;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncGenerator\"] = __asyncGenerator;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncDelegator\"] = __asyncDelegator;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncValues\"] = __asyncValues;\n/* harmony export (immutable) */ __webpack_exports__[\"__makeTemplateObject\"] = __makeTemplateObject;\n/* harmony export (immutable) */ __webpack_exports__[\"__importStar\"] = __importStar;\n/* harmony export (immutable) */ __webpack_exports__[\"__importDefault\"] = __importDefault;\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nfunction __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n Object.defineProperty(Constants, \"errorDescription\", {\r\n get: function () { return \"error_description\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"error\", {\r\n get: function () { return \"error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"scope\", {\r\n get: function () { return \"scope\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"acquireTokenUser\", {\r\n get: function () { return \"msal.acquireTokenUser\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"clientInfo\", {\r\n get: function () { return \"client_info\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"clientId\", {\r\n get: function () { return \"clientId\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"authority\", {\r\n get: function () { return \"msal.authority\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"idToken\", {\r\n get: function () { return \"id_token\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"accessToken\", {\r\n get: function () { return \"access_token\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"expiresIn\", {\r\n get: function () { return \"expires_in\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"sessionState\", {\r\n get: function () { return \"session_state\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalClientInfo\", {\r\n get: function () { return \"msal.client.info\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalError\", {\r\n get: function () { return \"msal.error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalErrorDescription\", {\r\n get: function () { return \"msal.error.description\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalSessionState\", {\r\n get: function () { return \"msal.session.state\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenKeys\", {\r\n get: function () { return \"msal.token.keys\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"accessTokenKey\", {\r\n get: function () { return \"msal.access.token.key\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"expirationKey\", {\r\n get: function () { return \"msal.expiration.key\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateLogin\", {\r\n get: function () { return \"msal.state.login\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateAcquireToken\", {\r\n get: function () { return \"msal.state.acquireToken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateRenew\", {\r\n get: function () { return \"msal.state.renew\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"nonceIdToken\", {\r\n get: function () { return \"msal.nonce.idtoken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"userName\", {\r\n get: function () { return \"msal.username\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"idTokenKey\", {\r\n get: function () { return \"msal.idtoken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"loginRequest\", {\r\n get: function () { return \"msal.login.request\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"loginError\", {\r\n get: function () { return \"msal.login.error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"renewStatus\", {\r\n get: function () { return \"msal.token.renew.status\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msal\", {\r\n get: function () { return \"msal\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"resourceDelimeter\", {\r\n get: function () { return \"|\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusCancelled\", {\r\n get: function () { return \"Canceled\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusCompleted\", {\r\n get: function () { return \"Completed\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusInProgress\", {\r\n get: function () { return \"In Progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"popUpWidth\", {\r\n get: function () { return this._popUpWidth; },\r\n set: function (width) {\r\n this._popUpWidth = width;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"popUpHeight\", {\r\n get: function () { return this._popUpHeight; },\r\n set: function (height) {\r\n this._popUpHeight = height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"login\", {\r\n get: function () { return \"LOGIN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"renewToken\", {\r\n get: function () { return \"RENEW_TOKEN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"unknown\", {\r\n get: function () { return \"UNKNOWN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"urlHash\", {\r\n get: function () { return \"msal.urlHash\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"angularLoginRequest\", {\r\n get: function () { return \"msal.angular.login.request\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"userIdentifier\", {\r\n get: function () { return \"userIdentifier\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Constants._popUpWidth = 483;\r\n Constants._popUpHeight = 600;\r\n return Constants;\r\n}());\r\nexports.Constants = Constants;\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorCodes = /** @class */ (function () {\r\n function ErrorCodes() {\r\n }\r\n Object.defineProperty(ErrorCodes, \"loginProgressError\", {\r\n get: function () { return \"login_progress_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"acquireTokenProgressError\", {\r\n get: function () { return \"acquiretoken_progress_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"inputScopesError\", {\r\n get: function () { return \"input_scopes_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"endpointResolutionError\", {\r\n get: function () { return \"endpoints_resolution_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"popUpWindowError\", {\r\n get: function () { return \"popup_window_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"userLoginError\", {\r\n get: function () { return \"user_login_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"userCancelledError\", {\r\n get: function () { return \"user_cancelled\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorCodes;\r\n}());\r\nexports.ErrorCodes = ErrorCodes;\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorDescription = /** @class */ (function () {\r\n function ErrorDescription() {\r\n }\r\n Object.defineProperty(ErrorDescription, \"loginProgressError\", {\r\n get: function () { return \"Login is in progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"acquireTokenProgressError\", {\r\n get: function () { return \"Acquire token is in progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"inputScopesError\", {\r\n get: function () { return \"Invalid value of input scopes provided\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"endpointResolutionError\", {\r\n get: function () { return \"Endpoints cannot be resolved\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"popUpWindowError\", {\r\n get: function () { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"userLoginError\", {\r\n get: function () { return \"User login is required\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"userCancelledError\", {\r\n get: function () { return \"User closed the popup window window and cancelled the flow\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorDescription;\r\n}());\r\nexports.ErrorDescription = ErrorDescription;\r\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"Error\"] = 0] = \"Error\";\r\n LogLevel[LogLevel[\"Warning\"] = 1] = \"Warning\";\r\n LogLevel[LogLevel[\"Info\"] = 2] = \"Info\";\r\n LogLevel[LogLevel[\"Verbose\"] = 3] = \"Verbose\";\r\n})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));\r\nvar Logger = /** @class */ (function () {\r\n function Logger(localCallback, options) {\r\n if (options === void 0) { options = {}; }\r\n /*\r\n * @hidden\r\n */\r\n this._level = LogLevel.Info;\r\n var _a = options.correlationId, correlationId = _a === void 0 ? \"\" : _a, _b = options.level, level = _b === void 0 ? LogLevel.Info : _b, _c = options.piiLoggingEnabled, piiLoggingEnabled = _c === void 0 ? false : _c;\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.logMessage = function (logLevel, logMessage, containsPii) {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log;\r\n if (!Utils_1.Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils_1.Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils_1.Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.executeCallback = function (level, message, containsPii) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.error = function (message) {\r\n this.logMessage(LogLevel.Error, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.errorPii = function (message) {\r\n this.logMessage(LogLevel.Error, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.warning = function (message) {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.warningPii = function (message) {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.info = function (message) {\r\n this.logMessage(LogLevel.Info, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.infoPii = function (message) {\r\n this.logMessage(LogLevel.Info, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.verbose = function (message) {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.verbosePii = function (message) {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n };\r\n return Logger;\r\n}());\r\nexports.Logger = Logger;\r\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorMessage = /** @class */ (function () {\r\n function ErrorMessage() {\r\n }\r\n Object.defineProperty(ErrorMessage, \"authorityUriInvalidPath\", {\r\n get: function () { return \"AuthorityUriInvalidPath\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"authorityUriInsecure\", {\r\n get: function () { return \"AuthorityUriInsecure\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"invalidAuthorityType\", {\r\n get: function () { return \"InvalidAuthorityType\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"unsupportedAuthorityValidation\", {\r\n get: function () { return \"UnsupportedAuthorityValidation\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"b2cAuthorityUriInvalidPath\", {\r\n get: function () { return \"B2cAuthorityUriInvalidPath\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorMessage;\r\n}());\r\nexports.ErrorMessage = ErrorMessage;\r\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar TokenResponse = /** @class */ (function () {\r\n function TokenResponse() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n return TokenResponse;\r\n}());\r\nexports.TokenResponse = TokenResponse;\r\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar User = /** @class */ (function () {\r\n /*\r\n * @hidden\r\n */\r\n function User(displayableId, name, identityProvider, userIdentifier, idToken) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n /*\r\n * @hidden\r\n */\r\n User.createUser = function (idToken, clientInfo, authority) {\r\n var uid;\r\n var utid;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n var userIdentifier = Utils_1.Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils_1.Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n };\r\n return User;\r\n}());\r\nexports.User = User;\r\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar XHRClient_1 = __webpack_require__(9);\r\n/**\r\n * @hidden\r\n */\r\nvar AadAuthority = /** @class */ (function (_super) {\r\n tslib_1.__extends(AadAuthority, _super);\r\n function AadAuthority(authority, validateAuthority) {\r\n return _super.call(this, authority, validateAuthority) || this;\r\n }\r\n Object.defineProperty(AadAuthority.prototype, \"AadInstanceDiscoveryEndpointUrl\", {\r\n get: function () {\r\n return AadAuthority.AadInstanceDiscoveryEndpoint + \"?api-version=1.0&authorization_endpoint=\" + this.CanonicalAuthority + \"oauth2/v2.0/authorize\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AadAuthority.prototype, \"AuthorityType\", {\r\n get: function () {\r\n return Authority_1.AuthorityType.Aad;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n AadAuthority.prototype.GetOpenIdConfigurationEndpointAsync = function () {\r\n var _this = this;\r\n var resultPromise = new Promise(function (resolve, reject) {\r\n return resolve(_this.DefaultOpenIdConfigurationEndpoint);\r\n });\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n var host = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n var client = new XHRClient_1.XhrClient();\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then(function (response) {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n };\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n AadAuthority.prototype.IsInTrustedHostList = function (host) {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n };\r\n AadAuthority.AadInstanceDiscoveryEndpoint = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n AadAuthority.TrustedHostList = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n return AadAuthority;\r\n}(Authority_1.Authority));\r\nexports.AadAuthority = AadAuthority;\r\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nvar XhrClient = /** @class */ (function () {\r\n function XhrClient() {\r\n }\r\n XhrClient.prototype.sendRequestAsync = function (url, method, enableCaching) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n xhr.onload = function (ev) {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(_this.handleError(xhr.responseText));\r\n }\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n }\r\n catch (e) {\r\n reject(_this.handleError(xhr.responseText));\r\n }\r\n resolve(jsonResponse);\r\n };\r\n xhr.onerror = function (ev) {\r\n reject(xhr.status);\r\n };\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n };\r\n XhrClient.prototype.handleError = function (responseText) {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n }\r\n else {\r\n throw responseText;\r\n }\r\n }\r\n catch (e) {\r\n return responseText;\r\n }\r\n };\r\n return XhrClient;\r\n}());\r\nexports.XhrClient = XhrClient;\r\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(11);\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar UserAgentApplication_1 = __webpack_require__(12);\r\nexports.UserAgentApplication = UserAgentApplication_1.UserAgentApplication;\r\nvar Logger_1 = __webpack_require__(4);\r\nexports.Logger = Logger_1.Logger;\r\nvar Logger_2 = __webpack_require__(4);\r\nexports.LogLevel = Logger_2.LogLevel;\r\nvar User_1 = __webpack_require__(7);\r\nexports.User = User_1.User;\r\nvar Constants_1 = __webpack_require__(3);\r\nexports.Constants = Constants_1.Constants;\r\nvar RequestInfo_1 = __webpack_require__(6);\r\nexports.TokenResponse = RequestInfo_1.TokenResponse;\r\nvar Authority_1 = __webpack_require__(1);\r\nexports.Authority = Authority_1.Authority;\r\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar AccessTokenKey_1 = __webpack_require__(13);\r\nvar AccessTokenValue_1 = __webpack_require__(14);\r\nvar AuthenticationRequestParameters_1 = __webpack_require__(15);\r\nvar ClientInfo_1 = __webpack_require__(16);\r\nvar Constants_1 = __webpack_require__(3);\r\nvar IdToken_1 = __webpack_require__(17);\r\nvar Logger_1 = __webpack_require__(4);\r\nvar Storage_1 = __webpack_require__(18);\r\nvar RequestInfo_1 = __webpack_require__(6);\r\nvar User_1 = __webpack_require__(7);\r\nvar Utils_1 = __webpack_require__(0);\r\nvar AuthorityFactory_1 = __webpack_require__(20);\r\n/*\r\n * @hidden\r\n */\r\nvar ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\nvar resolveTokenOnlyIfOutOfIframe = function (target, propertyKey, descriptor) {\r\n var tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this.isInIframe()\r\n ? new Promise(function () { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nvar UserAgentApplication = /** @class */ (function () {\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n function UserAgentApplication(clientId, authority, tokenReceivedCallback, options) {\r\n if (options === void 0) { options = {}; }\r\n /*\r\n * @hidden\r\n */\r\n this._cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n /*\r\n * @hidden\r\n */\r\n this._clockSkew = 300;\r\n /*\r\n * @hidden\r\n */\r\n this._tokenReceivedCallback = null;\r\n this._isAngular = false;\r\n var _a = options.validateAuthority, validateAuthority = _a === void 0 ? true : _a, _b = options.cacheLocation, cacheLocation = _b === void 0 ? \"sessionStorage\" : _b, _c = options.redirectUri, redirectUri = _c === void 0 ? window.location.href.split(\"?\")[0].split(\"#\")[0] : _c, _d = options.postLogoutRedirectUri, postLogoutRedirectUri = _d === void 0 ? window.location.href.split(\"?\")[0].split(\"#\")[0] : _d, _e = options.logger, logger = _e === void 0 ? new Logger_1.Logger(null) : _e, _f = options.loadFrameTimeout, loadFrameTimeout = _f === void 0 ? 6000 : _f, _g = options.navigateToLoginRequestUrl, navigateToLoginRequestUrl = _g === void 0 ? true : _g, _h = options.isAngular, isAngular = _h === void 0 ? false : _h, _j = options.anonymousEndpoints, anonymousEndpoints = _j === void 0 ? new Array() : _j, _k = options.endPoints, endPoints = _k === void 0 ? new Map() : _k;\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n this._cacheStorage = new Storage_1.Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = {};\r\n window.callBacksMappedToRenewStates = {};\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants_1.Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n Object.defineProperty(UserAgentApplication.prototype, \"cacheLocation\", {\r\n /*\r\n * Used to get the cache location\r\n */\r\n get: function () {\r\n return this._cacheLocation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UserAgentApplication.prototype, \"authority\", {\r\n /*\r\n * Used to get the authority.\r\n */\r\n get: function () {\r\n return this.authorityInstance.CanonicalAuthority;\r\n },\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n set: function (val) {\r\n this.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.processCallBack = function (hash) {\r\n this._logger.info('Processing the callback from redirect response');\r\n var requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n var token = requestInfo.parameters[Constants_1.Constants.accessToken] || requestInfo.parameters[Constants_1.Constants.idToken];\r\n var errorDesc = requestInfo.parameters[Constants_1.Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants_1.Constants.error];\r\n var tokenType;\r\n if (requestInfo.parameters[Constants_1.Constants.accessToken]) {\r\n tokenType = Constants_1.Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants_1.Constants.idToken;\r\n }\r\n this._cacheStorage.removeItem(Constants_1.Constants.urlHash);\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n }\r\n catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n };\r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n UserAgentApplication.prototype.loginRedirect = function (scopes, extraQueryParameters) {\r\n var _this = this;\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.loginProgressError, null, Constants_1.ErrorCodes.loginProgressError, Constants_1.Constants.idToken);\r\n return;\r\n }\r\n }\r\n if (scopes) {\r\n var isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.inputScopesError, null, Constants_1.ErrorCodes.inputScopesError, Constants_1.Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n this._loginInProgress = true;\r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(function () {\r\n var authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(_this.authorityInstance, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var loginStartPage = _this._cacheStorage.getItem(Constants_1.Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n _this._cacheStorage.setItem(Constants_1.Constants.angularLoginRequest, \"\");\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginRequest, loginStartPage);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateLogin, authenticationRequest.state);\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, _this.authority);\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n _this.promptUser(urlNavigate);\r\n });\r\n };\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n UserAgentApplication.prototype.loginPopup = function (scopes, extraQueryParameters) {\r\n var _this = this;\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise(function (resolve, reject) {\r\n if (_this._loginInProgress) {\r\n reject(Constants_1.ErrorCodes.loginProgressError + \"|\" + Constants_1.ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n if (scopes) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + Constants_1.ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [_this.clientId];\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = _this.openWindow(\"about:blank\", \"_blank\", 1, _this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n _this._loginInProgress = true;\r\n _this.authorityInstance.ResolveEndpointsAsync().then(function () {\r\n var authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(_this.authorityInstance, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginRequest, window.location.href);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, _this.authority);\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.login;\r\n _this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n _this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n }, function () {\r\n _this._logger.info(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n };\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.promptUser = function (urlNavigate) {\r\n if (urlNavigate && !Utils_1.Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n }\r\n else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n };\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n UserAgentApplication.prototype.openWindow = function (urlNavigate, title, interval, instance, resolve, reject) {\r\n var _this = this;\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants_1.Constants.popUpWidth, Constants_1.Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(Constants_1.ErrorCodes.popUpWindowError + \":\" + Constants_1.ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.popUpWindowError + \"|\" + Constants_1.ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(function () {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.userCancelledError + \"|\" + Constants_1.ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (_this._isAngular) {\r\n _this.broadcast('msal:popUpClosed', Constants_1.ErrorCodes.userCancelledError + \"|\" + Constants_1.ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(_this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n _this._logger.info(\"Closing popup window\");\r\n if (_this._isAngular) {\r\n _this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n }, interval);\r\n return popupWindow;\r\n };\r\n UserAgentApplication.prototype.broadcast = function (eventName, data) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n };\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n UserAgentApplication.prototype.logout = function () {\r\n this.clearCache();\r\n this._user = null;\r\n var logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n var urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n };\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.clearCache = function () {\r\n window.renewStates = [];\r\n var accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n };\r\n UserAgentApplication.prototype.clearCacheForScope = function (accessToken) {\r\n var accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++) {\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n };\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.openPopup = function (urlNavigate, title, popUpWidth, popUpHeight) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n var winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n var winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n var left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n var top_1 = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n var popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top_1 + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n return popupWindow;\r\n }\r\n catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n };\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.validateInputScope = function (scopes) {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n };\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.filterScopes = function (scopes) {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n return scopes;\r\n };\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.registerCallback = function (expectedState, scope, resolve, reject) {\r\n var _this = this;\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n function (errorDesc, token, error, tokenType) {\r\n window.activeRenewals[scope] = null;\r\n for (var i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n }\r\n catch (e) {\r\n _this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n };\r\n UserAgentApplication.prototype.getCachedTokenInternal = function (scopes, user) {\r\n var userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n var authenticationRequest;\r\n var newAuthority = this.authorityInstance ? this.authorityInstance : AuthorityFactory_1.AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n if (Utils_1.Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n return this.getCachedToken(authenticationRequest, user);\r\n };\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getCachedToken = function (authenticationRequest, user) {\r\n var accessTokenCacheItem = null;\r\n var scopes = authenticationRequest.scopes;\r\n var tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier : null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n var filteredItems = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (var i = 0; i < tokenCacheItems.length; i++) {\r\n var cacheItem = tokenCacheItems[i];\r\n var cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n authenticationRequest.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n var authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n authenticationRequest.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (var i = 0; i < tokenCacheItems.length; i++) {\r\n var cacheItem = tokenCacheItems[i];\r\n var cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n if (accessTokenCacheItem != null) {\r\n var expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n var offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils_1.Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n }\r\n else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n UserAgentApplication.prototype.getAllUsers = function () {\r\n var users = [];\r\n var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenCacheItems.length; i++) {\r\n var idToken = new IdToken_1.IdToken(accessTokenCacheItems[i].value.idToken);\r\n var clientInfo = new ClientInfo_1.ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n var user = User_1.User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n return this.getUniqueUsers(users);\r\n };\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUniqueUsers = function (users) {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n var flags = [];\r\n var uniqueUsers = [];\r\n for (var index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n return uniqueUsers;\r\n };\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUniqueAuthority = function (accessTokenCacheItems, property) {\r\n var authorityList = [];\r\n var flags = [];\r\n accessTokenCacheItems.forEach(function (element) {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n };\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.addHintParameters = function (urlNavigate, user) {\r\n var userObject = user ? user : this.getUser();\r\n var decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n var uid = Utils_1.Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n var utid = Utils_1.Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils_1.Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n if (!Utils_1.Utils.isEmpty(uid) && !Utils_1.Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils_1.Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils_1.Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils_1.Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n }\r\n else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n return urlNavigate;\r\n };\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.urlContainsQueryStringParameter = function (name, url) {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n };\r\n UserAgentApplication.prototype.acquireTokenRedirect = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n var isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.inputScopesError, null, Constants_1.ErrorCodes.inputScopesError, Constants_1.Constants.accessToken);\r\n return;\r\n }\r\n }\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n var userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.userLoginError, null, Constants_1.ErrorCodes.userLoginError, Constants_1.Constants.accessToken);\r\n return;\r\n }\r\n }\r\n this._acquireTokenInProgress = true;\r\n var authenticationRequest;\r\n var acquireTokenAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(function () {\r\n if (Utils_1.Utils.compareObjects(userObject, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userObject.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n _this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = _this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n };\r\n UserAgentApplication.prototype.acquireTokenPopup = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n if (scopes) {\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n var userObject = user ? user : _this.getUser();\r\n if (_this._acquireTokenInProgress) {\r\n reject(Constants_1.ErrorCodes.acquireTokenProgressError + \"|\" + Constants_1.ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(Constants_1.ErrorCodes.userLoginError + \"|\" + Constants_1.ErrorDescription.userLoginError);\r\n return;\r\n }\r\n _this._acquireTokenInProgress = true;\r\n var authenticationRequest;\r\n var acquireTokenAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, _this.validateAuthority) : _this.authorityInstance;\r\n var popUpWindow = _this.openWindow(\"about:blank\", \"_blank\", 1, _this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(function () {\r\n if (Utils_1.Utils.compareObjects(userObject, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userObject.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n _this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = _this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n _this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n }, function () {\r\n _this._logger.info(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.endpointResolutionError + \"|\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n };\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n UserAgentApplication.prototype.acquireTokenSilent = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n else {\r\n if (scopes) {\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n var scope_1 = scopes.join(\" \").toLowerCase();\r\n var userObject_1 = user ? user : _this.getUser();\r\n if (!userObject_1) {\r\n reject(Constants_1.ErrorCodes.userLoginError + \"|\" + Constants_1.ErrorDescription.userLoginError);\r\n return;\r\n }\r\n var authenticationRequest_1;\r\n var newAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, _this.validateAuthority) : _this.authorityInstance;\r\n if (Utils_1.Utils.compareObjects(userObject_1, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n var cacheResult = _this.getCachedToken(authenticationRequest_1, userObject_1);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n _this._logger.info(\"Token is already in cache for scope:\" + scope_1);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n _this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n _this._logger.verbose(\"Token is not in cache for scope:\" + scope_1);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(function () {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope_1]) {\r\n _this._logger.verbose(\"Renew token for scope: \" + scope_1 + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n _this.registerCallback(window.activeRenewals[scope_1], scope_1, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(_this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n _this._logger.verbose(\"renewing idToken\");\r\n _this.renewIdToken(scopes, resolve, reject, userObject_1, authenticationRequest_1, extraQueryParameters);\r\n }\r\n else {\r\n _this._logger.verbose(\"renewing accesstoken\");\r\n _this.renewToken(scopes, resolve, reject, userObject_1, authenticationRequest_1, extraQueryParameters);\r\n }\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n };\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.loadIframeTimeout = function (urlNavigate, frameName, scope) {\r\n var _this = this;\r\n //set iframe session to pending\r\n var expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants_1.Constants.renewStatus + expectedState, Constants_1.Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(function () {\r\n if (_this._cacheStorage.getItem(Constants_1.Constants.renewStatus + expectedState) === Constants_1.Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n _this._logger.verbose(\"Loading frame has timed out after: \" + (_this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants_1.Constants.accessToken);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.renewStatus + expectedState, Constants_1.Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n };\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.loadFrame = function (urlNavigate, frameName) {\r\n var _this = this;\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(function () {\r\n var frameHandle = _this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n _this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n }, 500);\r\n };\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.addAdalFrame = function (iframeId) {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n var adalFrame = document.getElementById(iframeId);\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n var ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = document.getElementsByTagName(\"body\")[0].appendChild(ifr);\r\n }\r\n else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n return adalFrame;\r\n };\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.renewToken = function (scopes, resolve, reject, user, authenticationRequest, extraQueryParameters) {\r\n var scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n var frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n };\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.renewIdToken = function (scopes, resolve, reject, user, authenticationRequest, extraQueryParameters) {\r\n var scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n var frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n };\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n UserAgentApplication.prototype.getUser = function () {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n // frame is used to get idToken\r\n var rawIdToken = this._cacheStorage.getItem(Constants_1.Constants.idTokenKey);\r\n var rawClientInfo = this._cacheStorage.getItem(Constants_1.Constants.msalClientInfo);\r\n if (!Utils_1.Utils.isEmpty(rawIdToken) && !Utils_1.Utils.isEmpty(rawClientInfo)) {\r\n var idToken = new IdToken_1.IdToken(rawIdToken);\r\n var clientInfo = new ClientInfo_1.ClientInfo(rawClientInfo);\r\n this._user = User_1.User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n return null;\r\n };\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.handleAuthenticationResponse = function (hash) {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n var self = null;\r\n var isPopup = false;\r\n var isWindowOpenerMsal = false;\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n }\r\n catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n var requestInfo = self.getRequestInfo(hash); //if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n var token = null, tokenReceivedCallback = null, tokenType, saveToken = true;\r\n self._logger.info(\"Returned from redirect url\");\r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants_1.Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants_1.Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n }\r\n self.saveTokenFromHash(requestInfo);\r\n if ((requestInfo.requestType === Constants_1.Constants.renewToken) && window.parent) {\r\n if (window.parent !== window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n }\r\n else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n token = requestInfo.parameters[Constants_1.Constants.accessToken] || requestInfo.parameters[Constants_1.Constants.idToken];\r\n tokenType = Constants_1.Constants.accessToken;\r\n }\r\n else if (requestInfo.requestType === Constants_1.Constants.login) {\r\n token = requestInfo.parameters[Constants_1.Constants.idToken];\r\n tokenType = Constants_1.Constants.idToken;\r\n }\r\n var errorDesc = requestInfo.parameters[Constants_1.Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants_1.Constants.error];\r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n }\r\n catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n };\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.saveAccessToken = function (authority, tokenResponse, user, clientInfo, idToken) {\r\n var scope;\r\n var clientObj = new ClientInfo_1.ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n var consentedScopes = scope.split(\" \");\r\n var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (var i = 0; i < accessTokenCacheItems.length; i++) {\r\n var accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n var cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n var accessTokenKey = new AccessTokenKey_1.AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n var accessTokenValue = new AccessTokenValue_1.AccessTokenValue(tokenResponse.parameters[Constants_1.Constants.accessToken], idToken.rawIdToken, Utils_1.Utils.expiresIn(tokenResponse.parameters[Constants_1.Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n else {\r\n scope = this.clientId;\r\n var accessTokenKey = new AccessTokenKey_1.AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n var accessTokenValue = new AccessTokenValue_1.AccessTokenValue(tokenResponse.parameters[Constants_1.Constants.idToken], tokenResponse.parameters[Constants_1.Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n };\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.saveTokenFromHash = function (tokenResponse) {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var scope = \"\";\r\n var authorityKey = \"\";\r\n var acquireTokenUserKey = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants_1.Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants_1.Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, tokenResponse.parameters[Constants_1.Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants_1.Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants_1.Constants.loginError, tokenResponse.parameters[Constants_1.Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants_1.Constants.error]);\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n if (tokenResponse.requestType === Constants_1.Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userKey + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n }\r\n else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants_1.Constants.msalSessionState, tokenResponse.parameters[Constants_1.Constants.sessionState]);\r\n }\r\n var idToken;\r\n var clientInfo = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n var user = void 0;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n idToken = new IdToken_1.IdToken(tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n }\r\n else {\r\n idToken = new IdToken_1.IdToken(this._cacheStorage.getItem(Constants_1.Constants.idTokenKey));\r\n }\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var authority = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils_1.Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants_1.Constants.clientInfo];\r\n user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n }\r\n else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n }\r\n acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var acquireTokenUser = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils_1.Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n }\r\n else {\r\n this._logger.warning(\"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken_1.IdToken(tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants_1.Constants.clientInfo];\r\n }\r\n else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var authority = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils_1.Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n this._user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants_1.Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants_1.Constants.idTokenKey, tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalClientInfo, clientInfo);\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n }\r\n else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants_1.Constants.idToken];\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants_1.Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants_1.Constants.renewStatus + tokenResponse.stateResponse, Constants_1.Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n };\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.isCallback = function (hash) {\r\n hash = this.getHash(hash);\r\n var parameters = Utils_1.Utils.deserialize(hash);\r\n return (parameters.hasOwnProperty(Constants_1.Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.error) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.idToken));\r\n };\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getHash = function (hash) {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n }\r\n else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n return hash;\r\n };\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getRequestInfo = function (hash) {\r\n hash = this.getHash(hash);\r\n var parameters = Utils_1.Utils.deserialize(hash);\r\n var tokenResponse = new RequestInfo_1.TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants_1.Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.error) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n var stateResponse = void 0;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n }\r\n else {\r\n return tokenResponse;\r\n }\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants_1.Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants_1.Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n else if (stateResponse === this._cacheStorage.getItem(Constants_1.Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants_1.Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n var statesInParentContext = window.renewStates;\r\n for (var i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n };\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getScopeFromState = function (state) {\r\n if (state) {\r\n var splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n };\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.isInIframe = function () {\r\n return window.parent !== window;\r\n };\r\n UserAgentApplication.prototype.loginInProgress = function () {\r\n var pendingCallback = this._cacheStorage.getItem(Constants_1.Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n };\r\n UserAgentApplication.prototype.getHostFromUri = function (uri) {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n };\r\n UserAgentApplication.prototype.getScopesForEndpoint = function (endpoint) {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n if (this._endpoints.size > 0) {\r\n for (var _i = 0, _a = Array.from(this._endpoints.keys()); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n };\r\n //These APIS are exposed for msalAngular wrapper only\r\n UserAgentApplication.prototype.setloginInProgress = function (loginInProgress) {\r\n this._loginInProgress = loginInProgress;\r\n };\r\n UserAgentApplication.prototype.getAcquireTokenInProgress = function () {\r\n return this._acquireTokenInProgress;\r\n };\r\n UserAgentApplication.prototype.setAcquireTokenInProgress = function (acquireTokenInProgress) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n };\r\n UserAgentApplication.prototype.getLogger = function () {\r\n return this._logger;\r\n };\r\n tslib_1.__decorate([\r\n resolveTokenOnlyIfOutOfIframe\r\n ], UserAgentApplication.prototype, \"acquireTokenSilent\", null);\r\n return UserAgentApplication;\r\n}());\r\nexports.UserAgentApplication = UserAgentApplication;\r\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenKey = /** @class */ (function () {\r\n function AccessTokenKey(authority, clientId, scopes, uid, utid) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils_1.Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils_1.Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n return AccessTokenKey;\r\n}());\r\nexports.AccessTokenKey = AccessTokenKey;\r\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenValue = /** @class */ (function () {\r\n function AccessTokenValue(accessToken, idToken, expiresIn, clientInfo) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n return AccessTokenValue;\r\n}());\r\nexports.AccessTokenValue = AccessTokenValue;\r\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar AuthenticationRequestParameters = /** @class */ (function () {\r\n function AuthenticationRequestParameters(authority, clientId, scope, responseType, redirectUri) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils_1.Utils.createNewGuid();\r\n this.state = Utils_1.Utils.createNewGuid();\r\n this.nonce = Utils_1.Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils_1.Utils.getLibraryVersion();\r\n }\r\n Object.defineProperty(AuthenticationRequestParameters.prototype, \"authority\", {\r\n get: function () {\r\n return this.authorityInstance.CanonicalAuthority;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AuthenticationRequestParameters.prototype.createNavigateUrl = function (scopes) {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n var str = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(\"x-client-SKU=\" + this.xClientSku);\r\n str.push(\"x-client-Ver=\" + this.xClientVer);\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n var authEndpoint = this.authorityInstance.AuthorizationEndpoint;\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n }\r\n else {\r\n authEndpoint += \"&\";\r\n }\r\n var requestUrl = \"\" + authEndpoint + str.join(\"&\");\r\n return requestUrl;\r\n };\r\n AuthenticationRequestParameters.prototype.translateclientIdUsedInScope = function (scopes) {\r\n var clientIdIndex = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n };\r\n AuthenticationRequestParameters.prototype.parseScope = function (scopes) {\r\n var scopeList = \"\";\r\n if (scopes) {\r\n for (var i = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n return scopeList;\r\n };\r\n return AuthenticationRequestParameters;\r\n}());\r\nexports.AuthenticationRequestParameters = AuthenticationRequestParameters;\r\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar ClientInfo = /** @class */ (function () {\r\n function ClientInfo(rawClientInfo) {\r\n if (!rawClientInfo || Utils_1.Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n try {\r\n var decodedClientInfo = Utils_1.Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n var clientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n Object.defineProperty(ClientInfo.prototype, \"uid\", {\r\n get: function () {\r\n return this._uid ? this._uid : \"\";\r\n },\r\n set: function (uid) {\r\n this._uid = uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientInfo.prototype, \"utid\", {\r\n get: function () {\r\n return this._utid ? this._utid : \"\";\r\n },\r\n set: function (utid) {\r\n this._utid = utid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ClientInfo;\r\n}());\r\nexports.ClientInfo = ClientInfo;\r\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar IdToken = /** @class */ (function () {\r\n function IdToken(rawIdToken) {\r\n if (Utils_1.Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils_1.Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n }\r\n catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n return IdToken;\r\n}());\r\nexports.IdToken = IdToken;\r\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Constants_1 = __webpack_require__(3);\r\nvar AccessTokenCacheItem_1 = __webpack_require__(19);\r\n/*\r\n * @hidden\r\n */\r\nvar Storage = /** @class */ (function () {\r\n function Storage(cacheLocation) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n return Storage._instance;\r\n }\r\n // add value to storage\r\n Storage.prototype.setItem = function (key, value) {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // get one item by key from storage\r\n Storage.prototype.getItem = function (key) {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // remove value from storage\r\n Storage.prototype.removeItem = function (key) {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // clear storage (remove all items from it)\r\n Storage.prototype.clear = function () {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n Storage.prototype.getAllAccessTokens = function (clientId, userIdentifier) {\r\n var results = [];\r\n var accessTokenCacheItem;\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n var value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem_1.AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n return results;\r\n };\r\n Storage.prototype.removeAcquireTokenEntries = function (authorityKey, acquireTokenUserKey) {\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey != \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n Storage.prototype.resetCacheItems = function () {\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants_1.Constants.msal) !== -1) {\r\n this.setItem(key, \"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants_1.Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n return Storage;\r\n}());\r\nexports.Storage = Storage;\r\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenCacheItem = /** @class */ (function () {\r\n function AccessTokenCacheItem(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n return AccessTokenCacheItem;\r\n}());\r\nexports.AccessTokenCacheItem = AccessTokenCacheItem;\r\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Utils_1 = __webpack_require__(0);\r\nvar AadAuthority_1 = __webpack_require__(8);\r\nvar B2cAuthority_1 = __webpack_require__(21);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar AuthorityFactory = /** @class */ (function () {\r\n function AuthorityFactory() {\r\n }\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n AuthorityFactory.DetectAuthorityFromUrl = function (authorityUrl) {\r\n authorityUrl = Utils_1.Utils.CanonicalizeUri(authorityUrl);\r\n var components = Utils_1.Utils.GetUrlComponents(authorityUrl);\r\n var pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return Authority_1.AuthorityType.B2C;\r\n case \"adfs\":\r\n return Authority_1.AuthorityType.Adfs;\r\n default:\r\n return Authority_1.AuthorityType.Aad;\r\n }\r\n };\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n AuthorityFactory.CreateInstance = function (authorityUrl, validateAuthority) {\r\n var type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case Authority_1.AuthorityType.B2C:\r\n return new B2cAuthority_1.B2cAuthority(authorityUrl, validateAuthority);\r\n case Authority_1.AuthorityType.Aad:\r\n return new AadAuthority_1.AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage_1.ErrorMessage.invalidAuthorityType;\r\n }\r\n };\r\n return AuthorityFactory;\r\n}());\r\nexports.AuthorityFactory = AuthorityFactory;\r\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar AadAuthority_1 = __webpack_require__(8);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar B2cAuthority = /** @class */ (function (_super) {\r\n tslib_1.__extends(B2cAuthority, _super);\r\n function B2cAuthority(authority, validateAuthority) {\r\n var _this = _super.call(this, authority, validateAuthority) || this;\r\n var urlComponents = Utils_1.Utils.GetUrlComponents(authority);\r\n var pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage_1.ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n _this.CanonicalAuthority = \"https://\" + urlComponents.HostNameAndPort + \"/\" + pathSegments[0] + \"/\" + pathSegments[1] + \"/\" + pathSegments[2] + \"/\";\r\n return _this;\r\n }\r\n Object.defineProperty(B2cAuthority.prototype, \"AuthorityType\", {\r\n get: function () {\r\n return Authority_1.AuthorityType.B2C;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n B2cAuthority.prototype.GetOpenIdConfigurationEndpointAsync = function () {\r\n var _this = this;\r\n var resultPromise = new Promise(function (resolve, reject) {\r\n return resolve(_this.DefaultOpenIdConfigurationEndpoint);\r\n });\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n return new Promise(function (resolve, reject) {\r\n return reject(ErrorMessage_1.ErrorMessage.unsupportedAuthorityValidation);\r\n });\r\n };\r\n return B2cAuthority;\r\n}(AadAuthority_1.AadAuthority));\r\nexports.B2cAuthority = B2cAuthority;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// msal.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 69c9743edfd0c24a95f0","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { IUri } from \"./IUri\";\r\nimport { User } from \"./User\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Utils {\r\n static compareObjects(u1: User, u2: User): boolean {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static expiresIn(expires: string): number {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n }\r\n\r\n static now(): number {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n }\r\n\r\n static isEmpty(str: string): boolean {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n }\r\n\r\n static extractIdToken(encodedIdToken: string): any {\r\n // id token will be decoded to get the username\r\n const decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n const base64IdToken = decodedToken.JWSPayload;\r\n const base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n } catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n static base64EncodeStringUrlSafe(input: string): string {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n }\r\n\r\n static base64DecodeStringUrlSafe(base64IdToken: string): string {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n }\r\n\r\n static encode(input: string): string {\r\n const keyStr: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n let output = \"\";\r\n let chr1: number, chr2: number, chr3: number, enc1: number, enc2: number, enc3: number, enc4: number;\r\n var i = 0;\r\n\r\n input = this.utf8Encode(input);\r\n\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n } else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n }\r\n\r\n static utf8Encode(input: string): string {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n\r\n return utftext;\r\n }\r\n\r\n static decode(base64IdToken: string): string {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n let h1: number, h2: number, h3: number, h4: number, bits: number, c1: number, c2: number, c3: number, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n }\r\n\r\n static decodeJwt(jwtToken: string): any {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n const idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n const matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n const crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n }\r\n\r\n static deserialize(query: string): any {\r\n let match: Array; // Regex for replacing addition symbol with a space\r\n const pl = /\\+/g;\r\n const search = /([^&=]+)=([^&]*)/g;\r\n const decode = (s: string) => decodeURIComponent(s.replace(pl, \" \"));\r\n const obj: {} = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n }\r\n\r\n static isIntersectingScopes(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (let i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static containsScope(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every((value: any): boolean => cachedScopes.indexOf(value.toString().toLowerCase()) >= 0);\r\n }\r\n\r\n static convertToLowerCase(scopes: Array): Array {\r\n return scopes.map(scope => scope.toLowerCase());\r\n }\r\n\r\n static removeElement(scopes: Array, scope: string): Array {\r\n return scopes.filter(value => value !== scope);\r\n }\r\n\r\n static decimalToHex(num: number): string {\r\n var hex: string = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n }\r\n\r\n static getLibraryVersion(): string {\r\n return \"0.1.8\";\r\n }\r\n\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n static replaceFirstPath(href: string, tenantId: string): string {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n }\r\n\r\n static createNewGuid(): string {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n\r\n const cryptoObj: Crypto = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n const buffer: Uint8Array = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n const guidHolder: string = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n const hex: string = \"0123456789abcdef\";\r\n let r: number = 0;\r\n let guidResponse: string = \"\";\r\n for (let i: number = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n } else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n } else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n }\r\n\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n static GetUrlComponents(url: string): IUri {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n\r\n var match = url.match(regEx);\r\n\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n\r\n let urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n\r\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n }\r\n\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n static CanonicalizeUri(url: string): string {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n\r\n return url;\r\n }\r\n\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n static endsWith(url: string, suffix: string): boolean {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Utils.ts","import { IUri } from \"./IUri\";\r\nimport { Utils } from \"./Utils\";\r\nimport { ITenantDiscoveryResponse } from \"./ITenantDiscoveryResponse\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport enum AuthorityType {\r\n Aad,\r\n Adfs,\r\n B2C\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport abstract class Authority {\r\n constructor(authority: string, validateAuthority: boolean) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n\r\n this.validateAsUri();\r\n }\r\n\r\n public abstract get AuthorityType(): AuthorityType;\r\n\r\n public IsValidationEnabled: boolean;\r\n\r\n public get Tenant(): string {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n }\r\n\r\n private tenantDiscoveryResponse: ITenantDiscoveryResponse;\r\n\r\n public get AuthorizationEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get EndSessionEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get SelfSignedJwtAudience(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n private validateResolved() {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n }\r\n\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n public get CanonicalAuthority(): string {\r\n return this.canonicalAuthority;\r\n }\r\n\r\n public set CanonicalAuthority(url: string) {\r\n this.canonicalAuthority = Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n }\r\n\r\n private canonicalAuthority: string;\r\n private canonicalAuthorityUrlComponents: IUri;\r\n\r\n public get CanonicalAuthorityUrlComponents(): IUri {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n\r\n return this.canonicalAuthorityUrlComponents;\r\n }\r\n\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n protected get DefaultOpenIdConfigurationEndpoint(): string {\r\n return `${this.CanonicalAuthority}v2.0/.well-known/openid-configuration`;\r\n }\r\n\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n private validateAsUri() {\r\n let components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n } catch (e) {\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage.authorityUriInsecure;\r\n }\r\n\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage.authorityUriInvalidPath;\r\n }\r\n }\r\n\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n private DiscoverEndpoints(openIdConfigurationEndpoint: string): Promise {\r\n let client = new XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then((response: any) => {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n public ResolveEndpointsAsync(): Promise {\r\n let openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(openIdConfigurationEndpointResponse => {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then((tenantDiscoveryResponse: ITenantDiscoveryResponse) => {\r\n this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return this;\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public abstract GetOpenIdConfigurationEndpointAsync(): Promise;\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Authority.ts","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/tslib/tslib.es6.js\n// module id = 2\n// module chunks = 0 1","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Constants {\r\n static get errorDescription(): string { return \"error_description\"; }\r\n static get error(): string { return \"error\"; }\r\n static get scope(): string { return \"scope\"; }\r\n static get acquireTokenUser(): string { return \"msal.acquireTokenUser\"; }\r\n static get clientInfo(): string { return \"client_info\"; }\r\n static get clientId(): string { return \"clientId\"; }\r\n static get authority(): string { return \"msal.authority\"; }\r\n static get idToken(): string { return \"id_token\"; }\r\n static get accessToken(): string { return \"access_token\"; }\r\n static get expiresIn(): string { return \"expires_in\"; }\r\n static get sessionState(): string { return \"session_state\"; }\r\n static get msalClientInfo(): string { return \"msal.client.info\"; }\r\n static get msalError(): string { return \"msal.error\"; }\r\n static get msalErrorDescription(): string { return \"msal.error.description\"; }\r\n static get msalSessionState(): string { return \"msal.session.state\"; }\r\n static get tokenKeys(): string { return \"msal.token.keys\"; }\r\n static get accessTokenKey(): string { return \"msal.access.token.key\"; }\r\n static get expirationKey(): string { return \"msal.expiration.key\"; }\r\n static get stateLogin(): string { return \"msal.state.login\"; }\r\n static get stateAcquireToken(): string { return \"msal.state.acquireToken\"; }\r\n static get stateRenew(): string { return \"msal.state.renew\"; }\r\n static get nonceIdToken(): string { return \"msal.nonce.idtoken\"; }\r\n static get userName(): string { return \"msal.username\"; }\r\n static get idTokenKey(): string { return \"msal.idtoken\"; }\r\n static get loginRequest(): string { return \"msal.login.request\"; }\r\n static get loginError(): string { return \"msal.login.error\"; }\r\n static get renewStatus(): string { return \"msal.token.renew.status\"; }\r\n static get msal(): string { return \"msal\"; }\r\n static get resourceDelimeter(): string { return \"|\"; }\r\n static get tokenRenewStatusCancelled(): string { return \"Canceled\"; }\r\n static get tokenRenewStatusCompleted(): string { return \"Completed\"; }\r\n static get tokenRenewStatusInProgress(): string { return \"In Progress\"; }\r\n private static _popUpWidth: number = 483;\r\n static get popUpWidth(): number { return this._popUpWidth; }\r\n static set popUpWidth(width: number) {\r\n this._popUpWidth = width;\r\n }\r\n private static _popUpHeight: number = 600;\r\n static get popUpHeight(): number { return this._popUpHeight; }\r\n static set popUpHeight(height: number) {\r\n this._popUpHeight = height;\r\n }\r\n static get login(): string { return \"LOGIN\"; }\r\n static get renewToken(): string { return \"RENEW_TOKEN\"; }\r\n static get unknown(): string { return \"UNKNOWN\"; }\r\n static get urlHash(): string { return \"msal.urlHash\"; }\r\n static get angularLoginRequest(): string { return \"msal.angular.login.request\"; }\r\n static get userIdentifier(): string { return \"userIdentifier\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorCodes {\r\n static get loginProgressError(): string { return \"login_progress_error\"; }\r\n static get acquireTokenProgressError(): string { return \"acquiretoken_progress_error\"; }\r\n static get inputScopesError(): string { return \"input_scopes_error\"; }\r\n static get endpointResolutionError(): string { return \"endpoints_resolution_error\"; }\r\n static get popUpWindowError(): string { return \"popup_window_error\"; }\r\n static get userLoginError(): string { return \"user_login_error\"; }\r\n static get userCancelledError(): string { return \"user_cancelled\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorDescription {\r\n static get loginProgressError(): string { return \"Login is in progress\"; }\r\n static get acquireTokenProgressError(): string { return \"Acquire token is in progress\"; }\r\n static get inputScopesError(): string { return \"Invalid value of input scopes provided\"; }\r\n static get endpointResolutionError(): string { return \"Endpoints cannot be resolved\"; }\r\n static get popUpWindowError(): string { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; }\r\n static get userLoginError(): string { return \"User login is required\"; }\r\n static get userCancelledError(): string { return \"User closed the popup window window and cancelled the flow\"; }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport interface ILoggerCallback {\r\n (level: LogLevel, message: string, containsPii: boolean): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Error,\r\n Warning,\r\n Info,\r\n Verbose\r\n}\r\n\r\nexport class Logger {// Singleton Class\r\n\r\n /*\r\n * @hidden\r\n */\r\n private static _instance: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _correlationId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _level: LogLevel = LogLevel.Info;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _piiLoggingEnabled: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _localCallback: ILoggerCallback;\r\n\r\n constructor(localCallback: ILoggerCallback,\r\n options:\r\n {\r\n correlationId?: string,\r\n level?: LogLevel,\r\n piiLoggingEnabled?: boolean,\r\n } = {}) {\r\n const {\r\n correlationId = \"\",\r\n level = LogLevel.Info,\r\n piiLoggingEnabled = false\r\n } = options;\r\n\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n private logMessage(logLevel: LogLevel, logMessage: string, containsPii: boolean): void {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log: string;\r\n if (!Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n executeCallback(level: LogLevel, message: string, containsPii: boolean) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n error(message: string): void {\r\n this.logMessage(LogLevel.Error, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n errorPii(message: string): void {\r\n this.logMessage(LogLevel.Error, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warning(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warningPii(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n info(message: string): void {\r\n this.logMessage(LogLevel.Info, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n infoPii(message: string): void {\r\n this.logMessage(LogLevel.Info, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbose(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbosePii(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Logger.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorMessage {\r\n static get authorityUriInvalidPath(): string { return \"AuthorityUriInvalidPath\"; }\r\n static get authorityUriInsecure(): string { return \"AuthorityUriInsecure\"; }\r\n static get invalidAuthorityType(): string { return \"InvalidAuthorityType\"; }\r\n static get unsupportedAuthorityValidation(): string { return \"UnsupportedAuthorityValidation\"; }\r\n static get b2cAuthorityUriInvalidPath(): string { return \"B2cAuthorityUriInvalidPath\"; }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ErrorMessage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class TokenResponse {\r\n valid: boolean;\r\n parameters: Object;\r\n stateMatch: boolean;\r\n stateResponse: string;\r\n requestType: string;\r\n\r\n constructor() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/RequestInfo.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport class User {\r\n\r\n displayableId: string;\r\n name: string;\r\n identityProvider: string;\r\n userIdentifier: string;\r\n idToken: Object\r\n\r\n /*\r\n * @hidden\r\n */\r\n constructor(displayableId: string, name: string, identityProvider: string, userIdentifier: string, idToken:Object) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n static createUser(idToken: IdToken, clientInfo: ClientInfo, authority: string): User {\r\n let uid: string;\r\n let utid: string;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n\r\n const userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n }\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/User.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class AadAuthority extends Authority {\r\n private static readonly AadInstanceDiscoveryEndpoint: string = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n\r\n private get AadInstanceDiscoveryEndpointUrl(): string {\r\n return `${AadAuthority.AadInstanceDiscoveryEndpoint}?api-version=1.0&authorization_endpoint=${this.CanonicalAuthority}oauth2/v2.0/authorize`;\r\n }\r\n\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.Aad;\r\n }\r\n\r\n private static readonly TrustedHostList: any = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise: Promise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n let host: string = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n\r\n let client: XhrClient = new XhrClient();\r\n\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then((response) => {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n public IsInTrustedHostList(host: string): boolean {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AadAuthority.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nexport class XhrClient {\r\n public sendRequestAsync(url: string, method: string, enableCaching?: boolean): Promise {\r\n return new Promise((resolve, reject) => {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n\r\n xhr.onload = (ev) => {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n } catch (e) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n resolve(jsonResponse);\r\n };\r\n\r\n xhr.onerror = (ev) => {\r\n reject(xhr.status);\r\n };\r\n\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n }\r\n\r\n protected handleError(responseText: string): any {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n } else {\r\n throw responseText;\r\n }\r\n } catch (e) {\r\n return responseText;\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/XHRClient.ts","export { UserAgentApplication } from \"./UserAgentApplication\";\r\nexport { Logger } from \"./Logger\";\r\nexport { LogLevel } from \"./Logger\";\r\nexport { User } from \"./User\";\r\nexport { Constants } from \"./Constants\";\r\nexport { TokenResponse} from \"./RequestInfo\";\r\nexport {Authority} from \"./Authority\";\r\nexport {CacheResult} from \"./UserAgentApplication\";\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\nimport { AuthenticationRequestParameters } from \"./AuthenticationRequestParameters\";\r\nimport { Authority } from \"./Authority\";\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { Constants, ErrorCodes, ErrorDescription } from \"./Constants\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Logger } from \"./Logger\";\r\nimport { Storage } from \"./Storage\";\r\nimport { TokenResponse } from \"./RequestInfo\";\r\nimport { User } from \"./User\";\r\nimport { Utils } from \"./Utils\";\r\nimport { AuthorityFactory } from \"./AuthorityFactory\";\r\n\r\ndeclare global {\r\n interface Window {\r\n msal: Object;\r\n CustomEvent: CustomEvent;\r\n Event: Event;\r\n activeRenewals: {};\r\n renewStates: Array;\r\n callBackMappedToRenewStates : {};\r\n callBacksMappedToRenewStates: {};\r\n openedWindows: Array;\r\n requestType: string;\r\n }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nlet ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport interface CacheResult {\r\n errorDesc: string;\r\n token: string;\r\n error: string;\r\n}\r\n\r\n/*\r\n * A type alias of for a tokenReceivedCallback function.\r\n * @param tokenReceivedCallback.errorDesc error description returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.token token returned from STS if token request is successful.\r\n * @param tokenReceivedCallback.error error code returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.tokenType tokenType returned from the STS if API call is successful. Possible values are: id_token OR access_token.\r\n */\r\nexport type tokenReceivedCallback = (errorDesc: string, token: string, error: string, tokenType: string) => void;\r\nconst resolveTokenOnlyIfOutOfIframe = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\r\n const tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function (...args: any[]) {\r\n return this.isInIframe()\r\n ? new Promise(() => { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nexport class UserAgentApplication {\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocation: string;\r\n\r\n /*\r\n * Used to get the cache location\r\n */\r\n get cacheLocation(): string {\r\n return this._cacheLocation;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _logger: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _loginInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _acquireTokenInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _clockSkew = 300;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _cacheStorage: Storage;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _tokenReceivedCallback: tokenReceivedCallback = null;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _user: User;\r\n\r\n /*\r\n * Client ID assigned to your app by Azure Active Directory.\r\n */\r\n clientId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected authorityInstance: Authority;\r\n\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n public set authority(val) {\r\n this.authorityInstance = AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n }\r\n\r\n /*\r\n * Used to get the authority.\r\n */\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n /*\r\n * Used to turn authority validation on/off.\r\n * When set to true (default), MSAL will compare the application\"s authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.\r\n */\r\n validateAuthority: boolean;\r\n\r\n /*\r\n * The redirect URI of the application, this should be same as the value in the application registration portal.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _redirectUri: string;\r\n\r\n /*\r\n * Used to redirect the user to this location after logout.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _postLogoutredirectUri: string;\r\n\r\n loadFrameTimeout: number;\r\n\r\n protected _navigateToLoginRequestUrl: boolean;\r\n\r\n private _isAngular: boolean = false;\r\n\r\n private _endpoints: Map>;\r\n\r\n private _anonymousEndpoints: Array;\r\n\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n constructor(\r\n clientId: string,\r\n authority: string | null,\r\n tokenReceivedCallback: tokenReceivedCallback,\r\n options:\r\n {\r\n validateAuthority?: boolean,\r\n cacheLocation?: string,\r\n redirectUri?: string,\r\n postLogoutRedirectUri?: string,\r\n logger?: Logger,\r\n loadFrameTimeout?: number,\r\n navigateToLoginRequestUrl?: boolean,\r\n isAngular?: boolean,\r\n anonymousEndpoints?: Array\r\n endPoints?:Map>\r\n } = {}) {\r\n const {\r\n validateAuthority = true,\r\n cacheLocation = \"sessionStorage\",\r\n redirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n postLogoutRedirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n logger = new Logger(null),\r\n loadFrameTimeout = 6000,\r\n navigateToLoginRequestUrl = true,\r\n isAngular = false,\r\n anonymousEndpoints = new Array(),\r\n endPoints = new Map>(),\r\n } = options;\r\n\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n\r\n this._cacheStorage = new Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = { };\r\n window.callBacksMappedToRenewStates = { };\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private processCallBack(hash: string): void {\r\n this._logger.info('Processing the callback from redirect response');\r\n const requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n const token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n const errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n const error = requestInfo.parameters[Constants.error];\r\n var tokenType: string;\r\n\r\n if (requestInfo.parameters[Constants.accessToken]) {\r\n tokenType = Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n this._cacheStorage.removeItem(Constants.urlHash);\r\n\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n }\r\n\r\n \r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n loginRedirect(scopes?: Array, extraQueryParameters?: string): void {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.loginProgressError, null, ErrorCodes.loginProgressError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n this._loginInProgress = true;\r\n \r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n var loginStartPage = this._cacheStorage.getItem(Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants.angularLoginRequest, \"\")\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, loginStartPage);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n this.promptUser(urlNavigate);\r\n });\r\n }\r\n\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n loginPopup(scopes: Array, extraQueryParameters?: string): Promise {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise((resolve, reject) => {\r\n if (this._loginInProgress) {\r\n reject(ErrorCodes.loginProgressError + \"|\" + ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n\r\n scopes = this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [this.clientId];\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n \r\n this._loginInProgress = true;\r\n\r\n this.authorityInstance.ResolveEndpointsAsync().then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, window.location.href);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.login;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n }\r\n\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n private promptUser(urlNavigate: string) {\r\n if (urlNavigate && !Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n } else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n }\r\n\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n private openWindow(urlNavigate: string, title: string, interval: number, instance: this, resolve?: Function, reject?: Function): Window {\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(ErrorCodes.popUpWindowError + \":\" + ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(ErrorCodes.popUpWindowError + \"|\" + ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(() => {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpClosed', ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(\"Closing popup window\");\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n },\r\n interval);\r\n\r\n return popupWindow;\r\n }\r\n\r\n private broadcast(eventName: string, data: string) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n }\r\n\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n logout(): void {\r\n this.clearCache();\r\n this._user = null;\r\n let logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n\r\n const urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n }\r\n\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected clearCache(): void {\r\n window.renewStates = [];\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n }\r\n\r\n clearCacheForScope(accessToken: string) {\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++){\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n }\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n const winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n const left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n const top = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n\r\n const popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n\r\n return popupWindow;\r\n } catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n private validateInputScope(scopes: Array): string {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n private filterScopes(scopes: Array): Array {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n\r\n return scopes;\r\n }\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n private registerCallback(expectedState: string, scope: string, resolve: Function, reject: Function): void {\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n (errorDesc: string, token: string, error: string, tokenType: string) => {\r\n window.activeRenewals[scope] = null;\r\n for (let i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n } catch (e) {\r\n this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n }\r\n\r\n\r\nprotected getCachedTokenInternal(scopes : Array , user: User): CacheResult\r\n{\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = this.authorityInstance?this.authorityInstance: AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n return this.getCachedToken(authenticationRequest, user);\r\n}\r\n\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n private getCachedToken(authenticationRequest: AuthenticationRequestParameters, user: User): CacheResult {\r\n let accessTokenCacheItem: AccessTokenCacheItem = null;\r\n const scopes = authenticationRequest.scopes;\r\n const tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier:null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n\r\n const filteredItems: Array = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n const authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n\r\n if (accessTokenCacheItem != null) {\r\n const expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n const offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n } else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n getAllUsers(): Array {\r\n const users: Array = [];\r\n const accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const idToken = new IdToken(accessTokenCacheItems[i].value.idToken);\r\n const clientInfo = new ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n const user = User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n\r\n return this.getUniqueUsers(users);\r\n }\r\n\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueUsers(users: Array): Array {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n\r\n const flags: Array = [];\r\n const uniqueUsers: Array = [];\r\n for (let index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n\r\n return uniqueUsers;\r\n }\r\n\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueAuthority(accessTokenCacheItems: Array, property: string): Array {\r\n const authorityList: Array = [];\r\n const flags: Array = [];\r\n accessTokenCacheItems.forEach(element => {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n }\r\n\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n private addHintParameters(urlNavigate: string, user: User): string {\r\n const userObject = user ? user : this.getUser();\r\n const decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n const uid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n const utid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n\r\n if (!Utils.isEmpty(uid) && !Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n } else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n\r\n return urlNavigate;\r\n }\r\n\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n private urlContainsQueryStringParameter(name: string, url: string): boolean {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n const regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n }\r\n\r\n /*\r\n * Used to obtain an access_token by redirecting the user to the authorization endpoint.\r\n * To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://{instance}/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://{instance}/tfp/<tenant>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n */\r\n acquireTokenRedirect(scopes: Array): void;\r\n acquireTokenRedirect(scopes: Array, authority: string): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User, extraQueryParameters: string): void;\r\n acquireTokenRedirect(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): void {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.userLoginError, null, ErrorCodes.userLoginError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n this._cacheStorage.setItem(Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Used to acquire an access token for a new user using interactive authentication via a popup Window.\r\n * To request an id_token, pass the clientId as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\".\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n acquireTokenPopup(scopes: Array): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User, extraQueryParameters: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n reject(ErrorCodes.acquireTokenProgressError + \"|\" + ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \"|\" + ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n @resolveTokenOnlyIfOutOfIframe\r\n acquireTokenSilent(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n } else {\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n const cacheResult = this.getCachedToken(authenticationRequest, userObject);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n this._logger.info(\"Token is already in cache for scope:\" + scope);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n this._logger.verbose(\"Token is not in cache for scope:\" + scope);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(() => {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope]) {\r\n this._logger.verbose(\"Renew token for scope: \" + scope + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n this.registerCallback(window.activeRenewals[scope], scope, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n this._logger.verbose(\"renewing idToken\");\r\n this.renewIdToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n } else {\r\n this._logger.verbose(\"renewing accesstoken\");\r\n this.renewToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n }\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadIframeTimeout(urlNavigate: string, frameName: string, scope: string): void {\r\n //set iframe session to pending\r\n const expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(() => {\r\n if (this._cacheStorage.getItem(Constants.renewStatus + expectedState) === Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n this._logger.verbose(\"Loading frame has timed out after: \" + (this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants.accessToken);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n }\r\n\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadFrame(urlNavigate: string, frameName: string): void {\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(() => {\r\n var frameHandle = this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n },\r\n 500);\r\n }\r\n\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n private addAdalFrame(iframeId: string): HTMLIFrameElement {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n let adalFrame = document.getElementById(iframeId) as HTMLIFrameElement;\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n const ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = (document.getElementsByTagName(\"body\")[0].appendChild(ifr) as HTMLIFrameElement);\r\n } else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n\r\n return adalFrame;\r\n }\r\n\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n const frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n }\r\n\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewIdToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n const frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n }\r\n\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n getUser(): User {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n\r\n // frame is used to get idToken\r\n const rawIdToken = this._cacheStorage.getItem(Constants.idTokenKey);\r\n const rawClientInfo = this._cacheStorage.getItem(Constants.msalClientInfo);\r\n if (!Utils.isEmpty(rawIdToken) && !Utils.isEmpty(rawClientInfo)) {\r\n const idToken = new IdToken(rawIdToken);\r\n const clientInfo = new ClientInfo(rawClientInfo);\r\n this._user = User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private handleAuthenticationResponse(hash: string): void {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n\r\n var self = null;\r\n var isPopup: boolean = false;\r\n var isWindowOpenerMsal = false;\r\n\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n } catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n\r\n const requestInfo = self.getRequestInfo(hash);//if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n let token: string = null, tokenReceivedCallback: (errorDesc: string, token: string, error: string, tokenType: string) => void = null, tokenType: string, saveToken:boolean = true;\r\n \r\n self._logger.info(\"Returned from redirect url\");\r\n \r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n\r\n }\r\n\r\n self.saveTokenFromHash(requestInfo);\r\n\r\n if ((requestInfo.requestType === Constants.renewToken) && window.parent) {\r\n if (window.parent!==window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n } else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n\r\n token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.accessToken;\r\n } else if (requestInfo.requestType === Constants.login) {\r\n token = requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n var errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants.error];\r\n \r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n private saveAccessToken(authority: string, tokenResponse: TokenResponse, user: User, clientInfo: string, idToken: IdToken): void {\r\n let scope: string;\r\n let clientObj: ClientInfo = new ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n const consentedScopes = scope.split(\" \");\r\n const accessTokenCacheItems =\r\n this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n const cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.accessToken], idToken.rawIdToken, Utils.expiresIn(tokenResponse.parameters[Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n } else {\r\n scope = this.clientId;\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.idToken], tokenResponse.parameters[Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n }\r\n\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected saveTokenFromHash(tokenResponse: TokenResponse): void {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n var scope: string = \"\";\r\n var authorityKey: string = \"\";\r\n var acquireTokenUserKey: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, tokenResponse.parameters[Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants.loginError, tokenResponse.parameters[Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants.error]);\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n if (tokenResponse.requestType === Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userKey + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n } else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants.msalSessionState, tokenResponse.parameters[Constants.sessionState]);\r\n }\r\n \r\n var idToken: IdToken;\r\n var clientInfo: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n let user: User;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n } else {\r\n idToken = new IdToken(this._cacheStorage.getItem(Constants.idTokenKey));\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n }\r\n\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let acquireTokenUser: User;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\r\n \"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n } else {\r\n this._logger.warning(\r\n \"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n this._user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n } else {\r\n this._cacheStorage.setItem(Constants.idTokenKey, tokenResponse.parameters[Constants.idToken]);\r\n this._cacheStorage.setItem(Constants.msalClientInfo, clientInfo);\r\n\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants.idToken];\r\n this._cacheStorage.setItem(Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants.idToken]);\r\n }\r\n }\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants.renewStatus + tokenResponse.stateResponse, Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n }\r\n\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n isCallback(hash: string): boolean {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n return (\r\n parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)\r\n\r\n );\r\n }\r\n\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private getHash(hash: string): string {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n } else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n\r\n return hash;\r\n }\r\n\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected getRequestInfo(hash: string): TokenResponse {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n const tokenResponse = new TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n let stateResponse: string;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n } else {\r\n return tokenResponse;\r\n }\r\n\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n } else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n const statesInParentContext = window.renewStates;\r\n for (let i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n }\r\n\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n private getScopeFromState(state: string): string {\r\n if (state) {\r\n const splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n private isInIframe() {\r\n return window.parent !== window;\r\n }\r\n\r\n loginInProgress(): boolean {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n }\r\n\r\n private getHostFromUri(uri: string): string {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n }\r\n \r\n getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._endpoints.size > 0) {\r\n for (let key of Array.from(this._endpoints.keys())) {\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n }\r\n\r\n //These APIS are exposed for msalAngular wrapper only\r\n protected setloginInProgress(loginInProgress : boolean) {\r\n this._loginInProgress = loginInProgress;\r\n }\r\n\r\n protected getAcquireTokenInProgress(): boolean\r\n {\r\n return this._acquireTokenInProgress;\r\n }\r\n\r\n protected setAcquireTokenInProgress(acquireTokenInProgress : boolean) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n }\r\n\r\n protected getLogger()\r\n {\r\n return this._logger;\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/UserAgentApplication.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenKey {\r\n\r\n authority: string;\r\n clientId: string;\r\n userIdentifier: string;\r\n scopes: string;\r\n\r\n constructor(authority: string, clientId: string, scopes: string, uid: string, utid: string) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenKey.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenValue {\r\n\r\n accessToken: string;\r\n idToken: string;\r\n expiresIn: string;\r\n clientInfo: string;\r\n\r\n constructor(accessToken: string, idToken: string, expiresIn: string, clientInfo: string) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenValue.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority } from \"./Authority\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AuthenticationRequestParameters {\r\n authorityInstance: Authority;\r\n clientId: string;\r\n nonce: string;\r\n state: string;\r\n correlationId: string;\r\n xClientVer: string;\r\n xClientSku: string;\r\n scopes: Array;\r\n responseType: string;\r\n promptValue: string;\r\n extraQueryParameters: string;\r\n loginHint: string;\r\n domainHint: string;\r\n redirectUri: string;\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n constructor(authority: Authority, clientId: string, scope: Array, responseType: string, redirectUri: string) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils.createNewGuid();\r\n this.state = Utils.createNewGuid();\r\n this.nonce = Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils.getLibraryVersion();\r\n }\r\n\r\n createNavigateUrl(scopes: Array): string {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n\r\n const str: Array = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(`x-client-SKU=${this.xClientSku}`);\r\n str.push(`x-client-Ver=${this.xClientVer}`);\r\n\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n let authEndpoint: string = this.authorityInstance.AuthorizationEndpoint;\r\n\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n } else {\r\n authEndpoint += \"&\";\r\n }\r\n\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n translateclientIdUsedInScope(scopes: Array): void {\r\n const clientIdIndex: number = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n }\r\n\r\n parseScope(scopes: Array): string {\r\n let scopeList: string = \"\";\r\n if (scopes) {\r\n for (let i: number = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n\r\n return scopeList;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationRequestParameters.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ClientInfo {\r\n\r\n private _uid: string;\r\n get uid(): string {\r\n return this._uid ? this._uid : \"\";\r\n }\r\n\r\n set uid(uid: string) {\r\n this._uid = uid;\r\n }\r\n\r\n private _utid: string;\r\n get utid(): string {\r\n return this._utid ? this._utid : \"\";\r\n }\r\n\r\n set utid(utid: string) {\r\n this._utid = utid;\r\n }\r\n\r\n constructor(rawClientInfo: string) {\r\n if (!rawClientInfo || Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n const clientInfo: ClientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ClientInfo.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class IdToken {\r\n\r\n issuer: string;\r\n objectId: string;\r\n subject: string;\r\n tenantId: string;\r\n version: string;\r\n preferredName: string;\r\n name: string;\r\n homeObjectId: string;\r\n nonce: string;\r\n expiration: string;\r\n rawIdToken: string;\r\n decodedIdToken: Object\r\n\r\n constructor(rawIdToken: string) {\r\n if (Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/IdToken.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Constants } from \"./Constants\";\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Storage {// Singleton\r\n\r\n private static _instance: Storage;\r\n private _localStorageSupported: boolean;\r\n private _sessionStorageSupported: boolean;\r\n private _cacheLocation: string;\r\n\r\n constructor(cacheLocation: string) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n\r\n return Storage._instance;\r\n }\r\n\r\n // add value to storage\r\n setItem(key: string, value: string): void {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string): string {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // remove value from storage\r\n removeItem(key: string): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // clear storage (remove all items from it)\r\n clear(): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n getAllAccessTokens(clientId: string, userIdentifier: string): Array {\r\n const results: Array = [];\r\n let accessTokenCacheItem: AccessTokenCacheItem;\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n let value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n\r\n return results;\r\n }\r\n\r\n removeAcquireTokenEntries(authorityKey: string, acquireTokenUserKey: string): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey!= \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n resetCacheItems(): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.msal) !== -1) {\r\n this.setItem(key,\"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Storage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenCacheItem {\r\n\r\n key: AccessTokenKey;\r\n value: AccessTokenValue;\r\n\r\n constructor(key: AccessTokenKey, value: AccessTokenValue) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenCacheItem.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nimport { Utils } from \"./Utils\";\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { B2cAuthority } from \"./B2cAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\n\r\nexport class AuthorityFactory {\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n private static DetectAuthorityFromUrl(authorityUrl: string): AuthorityType {\r\n authorityUrl = Utils.CanonicalizeUri(authorityUrl);\r\n let components = Utils.GetUrlComponents(authorityUrl);\r\n let pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return AuthorityType.B2C;\r\n case \"adfs\":\r\n return AuthorityType.Adfs;\r\n default:\r\n return AuthorityType.Aad;\r\n }\r\n }\r\n\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n public static CreateInstance(authorityUrl: string, validateAuthority: boolean): Authority {\r\n let type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case AuthorityType.B2C:\r\n return new B2cAuthority(authorityUrl, validateAuthority);\r\n case AuthorityType.Aad:\r\n return new AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthorityFactory.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class B2cAuthority extends AadAuthority {\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n let urlComponents = Utils.GetUrlComponents(authority);\r\n\r\n let pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n\r\n this.CanonicalAuthority = `https://${urlComponents.HostNameAndPort}/${pathSegments[0]}/${pathSegments[1]}/${pathSegments[2]}/`;\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.B2C;\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n reject(ErrorMessage.unsupportedAuthorityValidation));\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/B2cAuthority.ts"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///msal.min.js","webpack:///webpack/bootstrap ae24f8fce33e1fd2db85","webpack:///./src/Utils.ts","webpack:///./src/Authority.ts","webpack:///./node_modules/tslib/tslib.es6.js","webpack:///./src/Constants.ts","webpack:///./src/Logger.ts","webpack:///./src/ErrorMessage.ts","webpack:///./src/RequestInfo.ts","webpack:///./src/User.ts","webpack:///./src/AadAuthority.ts","webpack:///./src/XHRClient.ts","webpack:///./src/index.ts","webpack:///./src/UserAgentApplication.ts","webpack:///./src/AccessTokenKey.ts","webpack:///./src/AccessTokenValue.ts","webpack:///./src/AuthenticationRequestParameters.ts","webpack:///./src/ClientInfo.ts","webpack:///./src/IdToken.ts","webpack:///./src/Storage.ts","webpack:///./src/AccessTokenCacheItem.ts","webpack:///./src/AuthorityFactory.ts","webpack:///./src/B2cAuthority.ts"],"names":["root","factory","exports","module","define","amd","self","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","value","Utils","compareObjects","u1","u2","userIdentifier","expiresIn","expires","now","parseInt","Math","round","Date","getTime","isEmpty","str","length","extractIdToken","encodedIdToken","decodedToken","decodeJwt","base64IdToken","JWSPayload","base64Decoded","base64DecodeStringUrlSafe","JSON","parse","err","base64EncodeStringUrlSafe","input","window","btoa","encode","replace","atob","decodeURIComponent","encodeURIComponent","decode","chr1","chr2","chr3","enc1","enc2","enc3","enc4","keyStr","output","utf8Encode","charCodeAt","isNaN","charAt","utftext","String","fromCharCode","codes","Error","h1","h2","h3","h4","bits","c1","c2","c3","decoded","indexOf","jwtToken","idTokenPartsRegex","matches","exec","header","JWSSig","deserialize","query","match","pl","search","obj","isIntersectingScopes","cachedScopes","scopes","convertToLowerCase","toLowerCase","containsScope","every","toString","map","scope","removeElement","filter","decimalToHex","num","hex","getLibraryVersion","replaceFirstPath","href","tenantId","urlObject","GetUrlComponents","pathArray","PathSegments","shift","Protocol","HostNameAndPort","join","createNewGuid","cryptoObj","crypto","getRandomValues","buffer","Uint8Array","guidHolder","r","guidResponse","random","url","regEx","RegExp","urlComponents","AbsolutePath","pathSegments","split","val","CanonicalizeUri","endsWith","suffix","Utils_1","ErrorMessage_1","XHRClient_1","AuthorityType","Authority","authority","validateAuthority","IsValidationEnabled","CanonicalAuthority","validateAsUri","CanonicalAuthorityUrlComponents","validateResolved","tenantDiscoveryResponse","AuthorizationEndpoint","Tenant","EndSessionEndpoint","Issuer","canonicalAuthority","set","canonicalAuthorityUrlComponents","components","e","ErrorMessage","invalidAuthorityType","authorityUriInsecure","authorityUriInvalidPath","DiscoverEndpoints","openIdConfigurationEndpoint","XhrClient","sendRequestAsync","then","response","authorization_endpoint","end_session_endpoint","issuer","ResolveEndpointsAsync","_this","GetOpenIdConfigurationEndpointAsync","openIdConfigurationEndpointResponse","__webpack_exports__","__extends","b","__","constructor","extendStatics","create","__rest","t","getOwnPropertySymbols","__decorate","decorators","target","key","desc","arguments","getOwnPropertyDescriptor","Reflect","decorate","__param","paramIndex","decorator","__metadata","metadataKey","metadataValue","metadata","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","step","next","rejected","result","done","apply","__generator","body","verb","v","op","f","TypeError","_","y","label","ops","pop","trys","push","g","sent","throw","return","Symbol","iterator","__exportStar","__values","__read","ar","error","__spread","concat","__await","__asyncGenerator","a","q","resume","settle","fulfill","asyncIterator","__asyncDelegator","__asyncValues","__makeTemplateObject","cooked","raw","__importStar","mod","k","default","__importDefault","__assign","setPrototypeOf","__proto__","Array","assign","Constants","_popUpWidth","width","_popUpHeight","height","ErrorCodes","ErrorDescription","LogLevel","Logger","localCallback","options","_level","Info","_a","correlationId","_b","level","_c","piiLoggingEnabled","_localCallback","_correlationId","_piiLoggingEnabled","logMessage","logLevel","containsPii","log","timestamp","toUTCString","executeCallback","message","errorPii","warning","Warning","warningPii","info","infoPii","verbose","Verbose","verbosePii","TokenResponse","valid","parameters","stateMatch","stateResponse","requestType","User","displayableId","identityProvider","idToken","createUser","clientInfo","uid","utid","preferredName","decodedIdToken","tslib_1","Authority_1","AadAuthority","_super","AadInstanceDiscoveryEndpoint","Aad","resultPromise","DefaultOpenIdConfigurationEndpoint","host","IsInTrustedHostList","AadInstanceDiscoveryEndpointUrl","tenant_discovery_endpoint","TrustedHostList","login.windows.net","login.chinacloudapi.cn","login.cloudgovapi.us","login.microsoftonline.com","login.microsoftonline.de","login.microsoftonline.us","method","enableCaching","xhr","XMLHttpRequest","open","onload","ev","status","handleError","responseText","jsonResponse","onerror","send","UserAgentApplication_1","UserAgentApplication","Logger_1","Logger_2","User_1","Constants_1","RequestInfo_1","AccessTokenKey_1","AccessTokenValue_1","AuthenticationRequestParameters_1","ClientInfo_1","IdToken_1","Storage_1","AuthorityFactory_1","ResponseTypes","id_token","token","id_token_token","resolveTokenOnlyIfOutOfIframe","propertyKey","descriptor","tokenAcquisitionMethod","args","_i","isInIframe","clientId","tokenReceivedCallback","_cacheLocations","localStorage","sessionStorage","_clockSkew","_tokenReceivedCallback","_isAngular","cacheLocation","redirectUri","location","_d","postLogoutRedirectUri","_e","logger","_f","loadFrameTimeout","_g","navigateToLoginRequestUrl","_h","isAngular","_j","anonymousEndpoints","_k","endPoints","Map","_redirectUri","_postLogoutredirectUri","_loginInProgress","_acquireTokenInProgress","_cacheLocation","_navigateToLoginRequestUrl","_anonymousEndpoints","_endpoints","_cacheStorage","Storage","_logger","openedWindows","activeRenewals","renewStates","callBackMappedToRenewStates","callBacksMappedToRenewStates","msal","urlHash","hash","isCallback","handleAuthenticationResponse","pendingCallback","getItem","processCallBack","authorityInstance","AuthorityFactory","CreateInstance","requestInfo","getRequestInfo","saveTokenFromHash","tokenType","accessToken","errorDesc","errorDescription","removeItem","loginRedirect","extraQueryParameters","loginProgressError","isValidScope","validateInputScope","inputScopesError","filterScopes","authenticationRequest","AuthenticationRequestParameters","loginStartPage","angularLoginRequest","setItem","loginRequest","loginError","stateLogin","state","nonceIdToken","nonce","msalError","msalErrorDescription","authorityKey","resourceDelimeter","urlNavigate","createNavigateUrl","promptUser","loginPopup","popUpWindow","openWindow","login","registerCallback","endpointResolutionError","close","catch","title","interval","instance","popupWindow","openPopup","popUpWidth","popUpHeight","popUpWindowError","pollTimer","setInterval","closed","userCancelledError","clearInterval","broadcast","popUpWindowLocation","eventName","data","evt","CustomEvent","detail","dispatchEvent","logout","clearCache","_user","accessTokenItems","getAllAccessTokens","stringify","resetCacheItems","clearCacheForScope","winLeft","screenLeft","screenX","winTop","screenTop","screenY","innerWidth","document","documentElement","clientWidth","innerHeight","clientHeight","left","top_1","focus","isArray","element","expectedState","getCachedTokenInternal","user","userObject","getUser","newAuthority","getCachedToken","accessTokenCacheItem","tokenCacheItems","filteredItems","cacheItem","authorityList","getUniqueAuthority","expired","Number","offset","getAllUsers","users","accessTokenCacheItems","IdToken","ClientInfo","getUniqueUsers","flags","uniqueUsers","index","forEach","addHintParameters","decodedClientInfo","urlContainsQueryStringParameter","test","acquireTokenRedirect","userLoginError","acquireTokenAuthority","acquireTokenUserKey","acquireTokenUser","stateAcquireToken","acquireTokenPopup","acquireTokenProgressError","renewToken","acquireTokenSilent","scope_1","userObject_1","authenticationRequest_1","cacheResult","renewIdToken","loadIframeTimeout","frameName","renewStatus","tokenRenewStatusInProgress","loadFrame","setTimeout","tokenRenewStatusCancelled","frameCheck","frameHandle","addAdalFrame","src","iframeId","adalFrame","getElementById","createElement","navigator","userAgent","ifr","setAttribute","style","visibility","position","border","getElementsByTagName","appendChild","insertAdjacentHTML","frames","rawIdToken","idTokenKey","rawClientInfo","msalClientInfo","isPopup","isWindowOpenerMsal","opener","parent","saveAccessToken","tokenResponse","clientObj","consentedScopes","accessTokenKey","AccessTokenKey","accessTokenValue","AccessTokenValue","expiration","userKey","sessionState","msalSessionState","tokenRenewStatusCompleted","removeAcquireTokenEntries","getHash","substring","statesInParentContext","getScopeFromState","splitIndex","loginInProgress","getHostFromUri","uri","extractedUri","getScopesForEndpoint","endpoint","size","from","keys","setloginInProgress","getAcquireTokenInProgress","setAcquireTokenInProgress","acquireTokenInProgress","getLogger","responseType","xClientSku","xClientVer","translateclientIdUsedInScope","parseScope","authEndpoint","clientIdIndex","splice","scopeList","_uid","_utid","objectId","subject","version","homeObjectId","AccessTokenCacheItem_1","_instance","_localStorageSupported","_sessionStorageSupported","clear","results","storage","AccessTokenCacheItem","AadAuthority_1","B2cAuthority_1","DetectAuthorityFromUrl","authorityUrl","B2C","Adfs","B2cAuthority","b2cAuthorityUriInvalidPath","unsupportedAuthorityValidation"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,OAAA,UAAAH,GACA,gBAAAC,SACAA,QAAA,KAAAD,IAEAD,EAAA,KAAAC,KACC,mBAAAK,WAAAC,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAR,OAGA,IAAAC,GAAAQ,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAX,WAUA,OANAM,GAAAE,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAU,GAAA,EAGAV,EAAAD,QAvBA,GAAAS,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAvB,GACA,GAAAgB,GAAAhB,KAAAwB,WACA,WAA2B,MAAAxB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAM,GAAAQ,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KAAM8J,EAAWC,IAAkB/J,KAC/BiJ,EAAgBQ,EAAA7H,MAAMiG,iBAAiBiC,GAEvCX,EAAeF,EAAclB,YACjC,IAAIoB,EAAaxG,OAAS,EACtB,KAAM+G,GAAAqB,aAAauf,0BtBizHnB,OsB9yHJze,GAAK5B,mBAAqB,WAAWhB,EAAcf,gBAAe,IAAIiB,EAAa,GAAE,IAAIA,EAAa,GAAE,IAAIA,EAAa,GAAE,ItB8yHhH0C,EsBrxHf,MAnCkCqJ,GAAAjJ,UAAAoe,EAAAhV,GAahCvU,OAAAC,eAAWspB,EAAA9oB,UAAA,iBtB8yHLL,IsB9yHN,WACE,MAAOiU,GAAAvL,cAAcugB,KtBgzHjBlpB,YAAY,EACZD,cAAc,IsB3yHbqpB,EAAA9oB,UAAAuK,oCAAP,cAAAD,GAAA7L,KACMwV,EAAgB,GAAIzH,SAAgB,SAACC,EAASC,GAChD,MAAAD,GAAQnC,EAAK4J,qCAEf,OAAKzV,MAAKgK,oBAINhK,KAAK2V,oBAAoB3V,KAAKmK,gCAAgCjC,iBACzDsN,EAGF,GAAIzH,SAAgB,SAACC,EAASC,GACnC,MAAAA,GAAOvE,EAAAqB,aAAawf,kCARb/U,GAUb6U,GAnCkCN,EAAA3U,aAArBzV,GAAA0qB","file":"msal.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Msal\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Msal\"] = factory();\n\telse\n\t\troot[\"Msal\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 10);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Utils = /** @class */ (function () {\r\n function Utils() {\r\n }\r\n Utils.compareObjects = function (u1, u2) {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Utils.expiresIn = function (expires) {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n };\r\n Utils.now = function () {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n };\r\n Utils.isEmpty = function (str) {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n };\r\n Utils.extractIdToken = function (encodedIdToken) {\r\n // id token will be decoded to get the username\r\n var decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n var base64IdToken = decodedToken.JWSPayload;\r\n var base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n }\r\n catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n return null;\r\n };\r\n Utils.base64EncodeStringUrlSafe = function (input) {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n };\r\n Utils.base64DecodeStringUrlSafe = function (base64IdToken) {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n };\r\n Utils.encode = function (input) {\r\n var keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n var output = \"\";\r\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\r\n var i = 0;\r\n input = this.utf8Encode(input);\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n }\r\n else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n };\r\n Utils.utf8Encode = function (input) {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n return utftext;\r\n };\r\n Utils.decode = function (base64IdToken) {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n var h1, h2, h3, h4, bits, c1, c2, c3, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n };\r\n Utils.decodeJwt = function (jwtToken) {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n var idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n var matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n var crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n };\r\n Utils.deserialize = function (query) {\r\n var match; // Regex for replacing addition symbol with a space\r\n var pl = /\\+/g;\r\n var search = /([^&=]+)=([^&]*)/g;\r\n var decode = function (s) { return decodeURIComponent(s.replace(pl, \" \")); };\r\n var obj = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n };\r\n Utils.isIntersectingScopes = function (cachedScopes, scopes) {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (var i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n Utils.containsScope = function (cachedScopes, scopes) {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every(function (value) { return cachedScopes.indexOf(value.toString().toLowerCase()) >= 0; });\r\n };\r\n Utils.convertToLowerCase = function (scopes) {\r\n return scopes.map(function (scope) { return scope.toLowerCase(); });\r\n };\r\n Utils.removeElement = function (scopes, scope) {\r\n return scopes.filter(function (value) { return value !== scope; });\r\n };\r\n Utils.decimalToHex = function (num) {\r\n var hex = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n };\r\n Utils.getLibraryVersion = function () {\r\n return \"0.1.9\";\r\n };\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n Utils.replaceFirstPath = function (href, tenantId) {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n };\r\n Utils.createNewGuid = function () {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n var cryptoObj = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n var buffer = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n var guidHolder = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n var hex = \"0123456789abcdef\";\r\n var r = 0;\r\n var guidResponse = \"\";\r\n for (var i = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n }\r\n else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n }\r\n else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n };\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n Utils.GetUrlComponents = function (url) {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n var match = url.match(regEx);\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n var urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n var pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter(function (val) { return val && val.length > 0; }); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n };\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n Utils.CanonicalizeUri = function (url) {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n return url;\r\n };\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n Utils.endsWith = function (url, suffix) {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n };\r\n return Utils;\r\n}());\r\nexports.Utils = Utils;\r\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar XHRClient_1 = __webpack_require__(9);\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n/*\r\n * @hidden\r\n */\r\nvar AuthorityType;\r\n(function (AuthorityType) {\r\n AuthorityType[AuthorityType[\"Aad\"] = 0] = \"Aad\";\r\n AuthorityType[AuthorityType[\"Adfs\"] = 1] = \"Adfs\";\r\n AuthorityType[AuthorityType[\"B2C\"] = 2] = \"B2C\";\r\n})(AuthorityType = exports.AuthorityType || (exports.AuthorityType = {}));\r\n/*\r\n * @hidden\r\n */\r\nvar Authority = /** @class */ (function () {\r\n function Authority(authority, validateAuthority) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n this.validateAsUri();\r\n }\r\n Object.defineProperty(Authority.prototype, \"Tenant\", {\r\n get: function () {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"AuthorizationEndpoint\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"EndSessionEndpoint\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"SelfSignedJwtAudience\", {\r\n get: function () {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Authority.prototype.validateResolved = function () {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n };\r\n Object.defineProperty(Authority.prototype, \"CanonicalAuthority\", {\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n get: function () {\r\n return this.canonicalAuthority;\r\n },\r\n set: function (url) {\r\n this.canonicalAuthority = Utils_1.Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"CanonicalAuthorityUrlComponents\", {\r\n get: function () {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils_1.Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n return this.canonicalAuthorityUrlComponents;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"DefaultOpenIdConfigurationEndpoint\", {\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n get: function () {\r\n return this.CanonicalAuthority + \"v2.0/.well-known/openid-configuration\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n Authority.prototype.validateAsUri = function () {\r\n var components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n }\r\n catch (e) {\r\n throw ErrorMessage_1.ErrorMessage.invalidAuthorityType;\r\n }\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage_1.ErrorMessage.authorityUriInsecure;\r\n }\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage_1.ErrorMessage.authorityUriInvalidPath;\r\n }\r\n };\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n Authority.prototype.DiscoverEndpoints = function (openIdConfigurationEndpoint) {\r\n var client = new XHRClient_1.XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then(function (response) {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n };\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n Authority.prototype.ResolveEndpointsAsync = function () {\r\n var _this = this;\r\n var openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(function (openIdConfigurationEndpointResponse) {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return _this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then(function (tenantDiscoveryResponse) {\r\n _this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return _this;\r\n });\r\n };\r\n return Authority;\r\n}());\r\nexports.Authority = Authority;\r\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (immutable) */ __webpack_exports__[\"__extends\"] = __extends;\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__assign\", function() { return __assign; });\n/* harmony export (immutable) */ __webpack_exports__[\"__rest\"] = __rest;\n/* harmony export (immutable) */ __webpack_exports__[\"__decorate\"] = __decorate;\n/* harmony export (immutable) */ __webpack_exports__[\"__param\"] = __param;\n/* harmony export (immutable) */ __webpack_exports__[\"__metadata\"] = __metadata;\n/* harmony export (immutable) */ __webpack_exports__[\"__awaiter\"] = __awaiter;\n/* harmony export (immutable) */ __webpack_exports__[\"__generator\"] = __generator;\n/* harmony export (immutable) */ __webpack_exports__[\"__exportStar\"] = __exportStar;\n/* harmony export (immutable) */ __webpack_exports__[\"__values\"] = __values;\n/* harmony export (immutable) */ __webpack_exports__[\"__read\"] = __read;\n/* harmony export (immutable) */ __webpack_exports__[\"__spread\"] = __spread;\n/* harmony export (immutable) */ __webpack_exports__[\"__await\"] = __await;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncGenerator\"] = __asyncGenerator;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncDelegator\"] = __asyncDelegator;\n/* harmony export (immutable) */ __webpack_exports__[\"__asyncValues\"] = __asyncValues;\n/* harmony export (immutable) */ __webpack_exports__[\"__makeTemplateObject\"] = __makeTemplateObject;\n/* harmony export (immutable) */ __webpack_exports__[\"__importStar\"] = __importStar;\n/* harmony export (immutable) */ __webpack_exports__[\"__importDefault\"] = __importDefault;\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nfunction __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Constants = /** @class */ (function () {\r\n function Constants() {\r\n }\r\n Object.defineProperty(Constants, \"errorDescription\", {\r\n get: function () { return \"error_description\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"error\", {\r\n get: function () { return \"error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"scope\", {\r\n get: function () { return \"scope\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"acquireTokenUser\", {\r\n get: function () { return \"msal.acquireTokenUser\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"clientInfo\", {\r\n get: function () { return \"client_info\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"clientId\", {\r\n get: function () { return \"clientId\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"authority\", {\r\n get: function () { return \"msal.authority\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"idToken\", {\r\n get: function () { return \"id_token\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"accessToken\", {\r\n get: function () { return \"access_token\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"expiresIn\", {\r\n get: function () { return \"expires_in\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"sessionState\", {\r\n get: function () { return \"session_state\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalClientInfo\", {\r\n get: function () { return \"msal.client.info\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalError\", {\r\n get: function () { return \"msal.error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalErrorDescription\", {\r\n get: function () { return \"msal.error.description\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msalSessionState\", {\r\n get: function () { return \"msal.session.state\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenKeys\", {\r\n get: function () { return \"msal.token.keys\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"accessTokenKey\", {\r\n get: function () { return \"msal.access.token.key\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"expirationKey\", {\r\n get: function () { return \"msal.expiration.key\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateLogin\", {\r\n get: function () { return \"msal.state.login\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateAcquireToken\", {\r\n get: function () { return \"msal.state.acquireToken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"stateRenew\", {\r\n get: function () { return \"msal.state.renew\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"nonceIdToken\", {\r\n get: function () { return \"msal.nonce.idtoken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"userName\", {\r\n get: function () { return \"msal.username\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"idTokenKey\", {\r\n get: function () { return \"msal.idtoken\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"loginRequest\", {\r\n get: function () { return \"msal.login.request\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"loginError\", {\r\n get: function () { return \"msal.login.error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"renewStatus\", {\r\n get: function () { return \"msal.token.renew.status\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"msal\", {\r\n get: function () { return \"msal\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"resourceDelimeter\", {\r\n get: function () { return \"|\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusCancelled\", {\r\n get: function () { return \"Canceled\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusCompleted\", {\r\n get: function () { return \"Completed\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"tokenRenewStatusInProgress\", {\r\n get: function () { return \"In Progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"popUpWidth\", {\r\n get: function () { return this._popUpWidth; },\r\n set: function (width) {\r\n this._popUpWidth = width;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"popUpHeight\", {\r\n get: function () { return this._popUpHeight; },\r\n set: function (height) {\r\n this._popUpHeight = height;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"login\", {\r\n get: function () { return \"LOGIN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"renewToken\", {\r\n get: function () { return \"RENEW_TOKEN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"unknown\", {\r\n get: function () { return \"UNKNOWN\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"urlHash\", {\r\n get: function () { return \"msal.urlHash\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"angularLoginRequest\", {\r\n get: function () { return \"msal.angular.login.request\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Constants, \"userIdentifier\", {\r\n get: function () { return \"userIdentifier\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Constants._popUpWidth = 483;\r\n Constants._popUpHeight = 600;\r\n return Constants;\r\n}());\r\nexports.Constants = Constants;\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorCodes = /** @class */ (function () {\r\n function ErrorCodes() {\r\n }\r\n Object.defineProperty(ErrorCodes, \"loginProgressError\", {\r\n get: function () { return \"login_progress_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"acquireTokenProgressError\", {\r\n get: function () { return \"acquiretoken_progress_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"inputScopesError\", {\r\n get: function () { return \"input_scopes_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"endpointResolutionError\", {\r\n get: function () { return \"endpoints_resolution_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"popUpWindowError\", {\r\n get: function () { return \"popup_window_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"userLoginError\", {\r\n get: function () { return \"user_login_error\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorCodes, \"userCancelledError\", {\r\n get: function () { return \"user_cancelled\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorCodes;\r\n}());\r\nexports.ErrorCodes = ErrorCodes;\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorDescription = /** @class */ (function () {\r\n function ErrorDescription() {\r\n }\r\n Object.defineProperty(ErrorDescription, \"loginProgressError\", {\r\n get: function () { return \"Login is in progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"acquireTokenProgressError\", {\r\n get: function () { return \"Acquire token is in progress\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"inputScopesError\", {\r\n get: function () { return \"Invalid value of input scopes provided\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"endpointResolutionError\", {\r\n get: function () { return \"Endpoints cannot be resolved\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"popUpWindowError\", {\r\n get: function () { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"userLoginError\", {\r\n get: function () { return \"User login is required\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorDescription, \"userCancelledError\", {\r\n get: function () { return \"User closed the popup window window and cancelled the flow\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorDescription;\r\n}());\r\nexports.ErrorDescription = ErrorDescription;\r\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"Error\"] = 0] = \"Error\";\r\n LogLevel[LogLevel[\"Warning\"] = 1] = \"Warning\";\r\n LogLevel[LogLevel[\"Info\"] = 2] = \"Info\";\r\n LogLevel[LogLevel[\"Verbose\"] = 3] = \"Verbose\";\r\n})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));\r\nvar Logger = /** @class */ (function () {\r\n function Logger(localCallback, options) {\r\n if (options === void 0) { options = {}; }\r\n /*\r\n * @hidden\r\n */\r\n this._level = LogLevel.Info;\r\n var _a = options.correlationId, correlationId = _a === void 0 ? \"\" : _a, _b = options.level, level = _b === void 0 ? LogLevel.Info : _b, _c = options.piiLoggingEnabled, piiLoggingEnabled = _c === void 0 ? false : _c;\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.logMessage = function (logLevel, logMessage, containsPii) {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log;\r\n if (!Utils_1.Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils_1.Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils_1.Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.executeCallback = function (level, message, containsPii) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.error = function (message) {\r\n this.logMessage(LogLevel.Error, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.errorPii = function (message) {\r\n this.logMessage(LogLevel.Error, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.warning = function (message) {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.warningPii = function (message) {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.info = function (message) {\r\n this.logMessage(LogLevel.Info, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.infoPii = function (message) {\r\n this.logMessage(LogLevel.Info, message, true);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.verbose = function (message) {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n };\r\n /*\r\n * @hidden\r\n */\r\n Logger.prototype.verbosePii = function (message) {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n };\r\n return Logger;\r\n}());\r\nexports.Logger = Logger;\r\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar ErrorMessage = /** @class */ (function () {\r\n function ErrorMessage() {\r\n }\r\n Object.defineProperty(ErrorMessage, \"authorityUriInvalidPath\", {\r\n get: function () { return \"AuthorityUriInvalidPath\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"authorityUriInsecure\", {\r\n get: function () { return \"AuthorityUriInsecure\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"invalidAuthorityType\", {\r\n get: function () { return \"InvalidAuthorityType\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"unsupportedAuthorityValidation\", {\r\n get: function () { return \"UnsupportedAuthorityValidation\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ErrorMessage, \"b2cAuthorityUriInvalidPath\", {\r\n get: function () { return \"B2cAuthorityUriInvalidPath\"; },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ErrorMessage;\r\n}());\r\nexports.ErrorMessage = ErrorMessage;\r\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar TokenResponse = /** @class */ (function () {\r\n function TokenResponse() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n return TokenResponse;\r\n}());\r\nexports.TokenResponse = TokenResponse;\r\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\nvar User = /** @class */ (function () {\r\n /*\r\n * @hidden\r\n */\r\n function User(displayableId, name, identityProvider, userIdentifier, idToken) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n /*\r\n * @hidden\r\n */\r\n User.createUser = function (idToken, clientInfo, authority) {\r\n var uid;\r\n var utid;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n var userIdentifier = Utils_1.Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils_1.Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n };\r\n return User;\r\n}());\r\nexports.User = User;\r\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar XHRClient_1 = __webpack_require__(9);\r\n/**\r\n * @hidden\r\n */\r\nvar AadAuthority = /** @class */ (function (_super) {\r\n tslib_1.__extends(AadAuthority, _super);\r\n function AadAuthority(authority, validateAuthority) {\r\n return _super.call(this, authority, validateAuthority) || this;\r\n }\r\n Object.defineProperty(AadAuthority.prototype, \"AadInstanceDiscoveryEndpointUrl\", {\r\n get: function () {\r\n return AadAuthority.AadInstanceDiscoveryEndpoint + \"?api-version=1.0&authorization_endpoint=\" + this.CanonicalAuthority + \"oauth2/v2.0/authorize\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(AadAuthority.prototype, \"AuthorityType\", {\r\n get: function () {\r\n return Authority_1.AuthorityType.Aad;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n AadAuthority.prototype.GetOpenIdConfigurationEndpointAsync = function () {\r\n var _this = this;\r\n var resultPromise = new Promise(function (resolve, reject) {\r\n return resolve(_this.DefaultOpenIdConfigurationEndpoint);\r\n });\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n var host = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n var client = new XHRClient_1.XhrClient();\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then(function (response) {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n };\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n AadAuthority.prototype.IsInTrustedHostList = function (host) {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n };\r\n AadAuthority.AadInstanceDiscoveryEndpoint = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n AadAuthority.TrustedHostList = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n return AadAuthority;\r\n}(Authority_1.Authority));\r\nexports.AadAuthority = AadAuthority;\r\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nvar XhrClient = /** @class */ (function () {\r\n function XhrClient() {\r\n }\r\n XhrClient.prototype.sendRequestAsync = function (url, method, enableCaching) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n xhr.onload = function (ev) {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(_this.handleError(xhr.responseText));\r\n }\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n }\r\n catch (e) {\r\n reject(_this.handleError(xhr.responseText));\r\n }\r\n resolve(jsonResponse);\r\n };\r\n xhr.onerror = function (ev) {\r\n reject(xhr.status);\r\n };\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n };\r\n XhrClient.prototype.handleError = function (responseText) {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n }\r\n else {\r\n throw responseText;\r\n }\r\n }\r\n catch (e) {\r\n return responseText;\r\n }\r\n };\r\n return XhrClient;\r\n}());\r\nexports.XhrClient = XhrClient;\r\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(11);\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar UserAgentApplication_1 = __webpack_require__(12);\r\nexports.UserAgentApplication = UserAgentApplication_1.UserAgentApplication;\r\nvar Logger_1 = __webpack_require__(4);\r\nexports.Logger = Logger_1.Logger;\r\nvar Logger_2 = __webpack_require__(4);\r\nexports.LogLevel = Logger_2.LogLevel;\r\nvar User_1 = __webpack_require__(7);\r\nexports.User = User_1.User;\r\nvar Constants_1 = __webpack_require__(3);\r\nexports.Constants = Constants_1.Constants;\r\nvar RequestInfo_1 = __webpack_require__(6);\r\nexports.TokenResponse = RequestInfo_1.TokenResponse;\r\nvar Authority_1 = __webpack_require__(1);\r\nexports.Authority = Authority_1.Authority;\r\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar AccessTokenKey_1 = __webpack_require__(13);\r\nvar AccessTokenValue_1 = __webpack_require__(14);\r\nvar AuthenticationRequestParameters_1 = __webpack_require__(15);\r\nvar ClientInfo_1 = __webpack_require__(16);\r\nvar Constants_1 = __webpack_require__(3);\r\nvar IdToken_1 = __webpack_require__(17);\r\nvar Logger_1 = __webpack_require__(4);\r\nvar Storage_1 = __webpack_require__(18);\r\nvar RequestInfo_1 = __webpack_require__(6);\r\nvar User_1 = __webpack_require__(7);\r\nvar Utils_1 = __webpack_require__(0);\r\nvar AuthorityFactory_1 = __webpack_require__(20);\r\n/*\r\n * @hidden\r\n */\r\nvar ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\nvar resolveTokenOnlyIfOutOfIframe = function (target, propertyKey, descriptor) {\r\n var tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n return this.isInIframe()\r\n ? new Promise(function () { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nvar UserAgentApplication = /** @class */ (function () {\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n function UserAgentApplication(clientId, authority, tokenReceivedCallback, options) {\r\n if (options === void 0) { options = {}; }\r\n /*\r\n * @hidden\r\n */\r\n this._cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n /*\r\n * @hidden\r\n */\r\n this._clockSkew = 300;\r\n /*\r\n * @hidden\r\n */\r\n this._tokenReceivedCallback = null;\r\n this._isAngular = false;\r\n var _a = options.validateAuthority, validateAuthority = _a === void 0 ? true : _a, _b = options.cacheLocation, cacheLocation = _b === void 0 ? \"sessionStorage\" : _b, _c = options.redirectUri, redirectUri = _c === void 0 ? window.location.href.split(\"?\")[0].split(\"#\")[0] : _c, _d = options.postLogoutRedirectUri, postLogoutRedirectUri = _d === void 0 ? window.location.href.split(\"?\")[0].split(\"#\")[0] : _d, _e = options.logger, logger = _e === void 0 ? new Logger_1.Logger(null) : _e, _f = options.loadFrameTimeout, loadFrameTimeout = _f === void 0 ? 6000 : _f, _g = options.navigateToLoginRequestUrl, navigateToLoginRequestUrl = _g === void 0 ? true : _g, _h = options.isAngular, isAngular = _h === void 0 ? false : _h, _j = options.anonymousEndpoints, anonymousEndpoints = _j === void 0 ? new Array() : _j, _k = options.endPoints, endPoints = _k === void 0 ? new Map() : _k;\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n this._cacheStorage = new Storage_1.Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = {};\r\n window.callBacksMappedToRenewStates = {};\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants_1.Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n Object.defineProperty(UserAgentApplication.prototype, \"cacheLocation\", {\r\n /*\r\n * Used to get the cache location\r\n */\r\n get: function () {\r\n return this._cacheLocation;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(UserAgentApplication.prototype, \"authority\", {\r\n /*\r\n * Used to get the authority.\r\n */\r\n get: function () {\r\n return this.authorityInstance.CanonicalAuthority;\r\n },\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n set: function (val) {\r\n this.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.processCallBack = function (hash) {\r\n this._logger.info('Processing the callback from redirect response');\r\n var requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n var token = requestInfo.parameters[Constants_1.Constants.accessToken] || requestInfo.parameters[Constants_1.Constants.idToken];\r\n var errorDesc = requestInfo.parameters[Constants_1.Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants_1.Constants.error];\r\n var tokenType;\r\n if (requestInfo.parameters[Constants_1.Constants.accessToken]) {\r\n tokenType = Constants_1.Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants_1.Constants.idToken;\r\n }\r\n this._cacheStorage.removeItem(Constants_1.Constants.urlHash);\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n }\r\n catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n };\r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n UserAgentApplication.prototype.loginRedirect = function (scopes, extraQueryParameters) {\r\n var _this = this;\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.loginProgressError, null, Constants_1.ErrorCodes.loginProgressError, Constants_1.Constants.idToken);\r\n return;\r\n }\r\n }\r\n if (scopes) {\r\n var isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.inputScopesError, null, Constants_1.ErrorCodes.inputScopesError, Constants_1.Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n this._loginInProgress = true;\r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(function () {\r\n var authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(_this.authorityInstance, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var loginStartPage = _this._cacheStorage.getItem(Constants_1.Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n _this._cacheStorage.setItem(Constants_1.Constants.angularLoginRequest, \"\");\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginRequest, loginStartPage);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateLogin, authenticationRequest.state);\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, _this.authority);\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n _this.promptUser(urlNavigate);\r\n });\r\n };\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n UserAgentApplication.prototype.loginPopup = function (scopes, extraQueryParameters) {\r\n var _this = this;\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise(function (resolve, reject) {\r\n if (_this._loginInProgress) {\r\n reject(Constants_1.ErrorCodes.loginProgressError + \"|\" + Constants_1.ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n if (scopes) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + Constants_1.ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [_this.clientId];\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = _this.openWindow(\"about:blank\", \"_blank\", 1, _this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n _this._loginInProgress = true;\r\n _this.authorityInstance.ResolveEndpointsAsync().then(function () {\r\n var authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(_this.authorityInstance, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginRequest, window.location.href);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, _this.authority);\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.login;\r\n _this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n _this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n }, function () {\r\n _this._logger.info(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n };\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.promptUser = function (urlNavigate) {\r\n if (urlNavigate && !Utils_1.Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n }\r\n else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n };\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n UserAgentApplication.prototype.openWindow = function (urlNavigate, title, interval, instance, resolve, reject) {\r\n var _this = this;\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants_1.Constants.popUpWidth, Constants_1.Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(Constants_1.ErrorCodes.popUpWindowError + \":\" + Constants_1.ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.popUpWindowError + \"|\" + Constants_1.ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(function () {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.userCancelledError + \"|\" + Constants_1.ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (_this._isAngular) {\r\n _this.broadcast('msal:popUpClosed', Constants_1.ErrorCodes.userCancelledError + \"|\" + Constants_1.ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(_this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n _this._logger.info(\"Closing popup window\");\r\n if (_this._isAngular) {\r\n _this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n }, interval);\r\n return popupWindow;\r\n };\r\n UserAgentApplication.prototype.broadcast = function (eventName, data) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n };\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n UserAgentApplication.prototype.logout = function () {\r\n this.clearCache();\r\n this._user = null;\r\n var logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n var urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n };\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.clearCache = function () {\r\n window.renewStates = [];\r\n var accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n };\r\n UserAgentApplication.prototype.clearCacheForScope = function (accessToken) {\r\n var accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++) {\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n };\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.openPopup = function (urlNavigate, title, popUpWidth, popUpHeight) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n var winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n var winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n var left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n var top_1 = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n var popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top_1 + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n return popupWindow;\r\n }\r\n catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n };\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.validateInputScope = function (scopes) {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n };\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.filterScopes = function (scopes) {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n return scopes;\r\n };\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.registerCallback = function (expectedState, scope, resolve, reject) {\r\n var _this = this;\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n function (errorDesc, token, error, tokenType) {\r\n window.activeRenewals[scope] = null;\r\n for (var i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n }\r\n catch (e) {\r\n _this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n };\r\n UserAgentApplication.prototype.getCachedTokenInternal = function (scopes, user) {\r\n var userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n var authenticationRequest;\r\n var newAuthority = this.authorityInstance ? this.authorityInstance : AuthorityFactory_1.AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n if (Utils_1.Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n return this.getCachedToken(authenticationRequest, user);\r\n };\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getCachedToken = function (authenticationRequest, user) {\r\n var accessTokenCacheItem = null;\r\n var scopes = authenticationRequest.scopes;\r\n var tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier : null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n var filteredItems = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (var i = 0; i < tokenCacheItems.length; i++) {\r\n var cacheItem = tokenCacheItems[i];\r\n var cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n authenticationRequest.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n var authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n authenticationRequest.authorityInstance = AuthorityFactory_1.AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (var i = 0; i < tokenCacheItems.length; i++) {\r\n var cacheItem = tokenCacheItems[i];\r\n var cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n if (accessTokenCacheItem != null) {\r\n var expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n var offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils_1.Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n }\r\n else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n UserAgentApplication.prototype.getAllUsers = function () {\r\n var users = [];\r\n var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants_1.Constants.clientId, Constants_1.Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenCacheItems.length; i++) {\r\n var idToken = new IdToken_1.IdToken(accessTokenCacheItems[i].value.idToken);\r\n var clientInfo = new ClientInfo_1.ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n var user = User_1.User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n return this.getUniqueUsers(users);\r\n };\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUniqueUsers = function (users) {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n var flags = [];\r\n var uniqueUsers = [];\r\n for (var index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n return uniqueUsers;\r\n };\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUniqueAuthority = function (accessTokenCacheItems, property) {\r\n var authorityList = [];\r\n var flags = [];\r\n accessTokenCacheItems.forEach(function (element) {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n };\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.addHintParameters = function (urlNavigate, user) {\r\n var userObject = user ? user : this.getUser();\r\n var decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n var uid = Utils_1.Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n var utid = Utils_1.Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils_1.Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n if (!Utils_1.Utils.isEmpty(uid) && !Utils_1.Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils_1.Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils_1.Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils_1.Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n }\r\n else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n return urlNavigate;\r\n };\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.urlContainsQueryStringParameter = function (name, url) {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n };\r\n UserAgentApplication.prototype.acquireTokenRedirect = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n var isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.inputScopesError, null, Constants_1.ErrorCodes.inputScopesError, Constants_1.Constants.accessToken);\r\n return;\r\n }\r\n }\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n var userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(Constants_1.ErrorDescription.userLoginError, null, Constants_1.ErrorCodes.userLoginError, Constants_1.Constants.accessToken);\r\n return;\r\n }\r\n }\r\n this._acquireTokenInProgress = true;\r\n var authenticationRequest;\r\n var acquireTokenAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(function () {\r\n if (Utils_1.Utils.compareObjects(userObject, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userObject.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n _this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = _this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n };\r\n UserAgentApplication.prototype.acquireTokenPopup = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n if (scopes) {\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n var userObject = user ? user : _this.getUser();\r\n if (_this._acquireTokenInProgress) {\r\n reject(Constants_1.ErrorCodes.acquireTokenProgressError + \"|\" + Constants_1.ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n var scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(Constants_1.ErrorCodes.userLoginError + \"|\" + Constants_1.ErrorDescription.userLoginError);\r\n return;\r\n }\r\n _this._acquireTokenInProgress = true;\r\n var authenticationRequest;\r\n var acquireTokenAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, _this.validateAuthority) : _this.authorityInstance;\r\n var popUpWindow = _this.openWindow(\"about:blank\", \"_blank\", 1, _this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(function () {\r\n if (Utils_1.Utils.compareObjects(userObject, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userObject.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n _this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(_this._cacheStorage.getItem(authorityKey))) {\r\n _this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = _this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n _this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n }, function () {\r\n _this._logger.info(Constants_1.ErrorCodes.endpointResolutionError + \":\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalError, Constants_1.ErrorCodes.endpointResolutionError);\r\n _this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, Constants_1.ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(Constants_1.ErrorCodes.endpointResolutionError + \"|\" + Constants_1.ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n };\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n UserAgentApplication.prototype.acquireTokenSilent = function (scopes, authority, user, extraQueryParameters) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var isValidScope = _this.validateInputScope(scopes);\r\n if (isValidScope && !Utils_1.Utils.isEmpty(isValidScope)) {\r\n reject(Constants_1.ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n else {\r\n if (scopes) {\r\n scopes = _this.filterScopes(scopes);\r\n }\r\n var scope_1 = scopes.join(\" \").toLowerCase();\r\n var userObject_1 = user ? user : _this.getUser();\r\n if (!userObject_1) {\r\n reject(Constants_1.ErrorCodes.userLoginError + \"|\" + Constants_1.ErrorDescription.userLoginError);\r\n return;\r\n }\r\n var authenticationRequest_1;\r\n var newAuthority = authority ? AuthorityFactory_1.AuthorityFactory.CreateInstance(authority, _this.validateAuthority) : _this.authorityInstance;\r\n if (Utils_1.Utils.compareObjects(userObject_1, _this.getUser())) {\r\n if (scopes.indexOf(_this.clientId) > -1) {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.id_token, _this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri);\r\n }\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri);\r\n }\r\n var cacheResult = _this.getCachedToken(authenticationRequest_1, userObject_1);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n _this._logger.info(\"Token is already in cache for scope:\" + scope_1);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n _this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n _this._logger.verbose(\"Token is not in cache for scope:\" + scope_1);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(function () {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope_1]) {\r\n _this._logger.verbose(\"Renew token for scope: \" + scope_1 + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n _this.registerCallback(window.activeRenewals[scope_1], scope_1, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(_this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n _this._logger.verbose(\"renewing idToken\");\r\n _this.renewIdToken(scopes, resolve, reject, userObject_1, authenticationRequest_1, extraQueryParameters);\r\n }\r\n else {\r\n _this._logger.verbose(\"renewing accesstoken\");\r\n _this.renewToken(scopes, resolve, reject, userObject_1, authenticationRequest_1, extraQueryParameters);\r\n }\r\n }\r\n }).catch(function (err) {\r\n _this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n };\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.loadIframeTimeout = function (urlNavigate, frameName, scope) {\r\n var _this = this;\r\n //set iframe session to pending\r\n var expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants_1.Constants.renewStatus + expectedState, Constants_1.Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(function () {\r\n if (_this._cacheStorage.getItem(Constants_1.Constants.renewStatus + expectedState) === Constants_1.Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n _this._logger.verbose(\"Loading frame has timed out after: \" + (_this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants_1.Constants.accessToken);\r\n }\r\n _this._cacheStorage.setItem(Constants_1.Constants.renewStatus + expectedState, Constants_1.Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n };\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.loadFrame = function (urlNavigate, frameName) {\r\n var _this = this;\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(function () {\r\n var frameHandle = _this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n _this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n }, 500);\r\n };\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.addAdalFrame = function (iframeId) {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n var adalFrame = document.getElementById(iframeId);\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n var ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = document.getElementsByTagName(\"body\")[0].appendChild(ifr);\r\n }\r\n else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n return adalFrame;\r\n };\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.renewToken = function (scopes, resolve, reject, user, authenticationRequest, extraQueryParameters) {\r\n var scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n var frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n };\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.renewIdToken = function (scopes, resolve, reject, user, authenticationRequest, extraQueryParameters) {\r\n var scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n var frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n var acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n var authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants_1.Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n };\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n UserAgentApplication.prototype.getUser = function () {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n // frame is used to get idToken\r\n var rawIdToken = this._cacheStorage.getItem(Constants_1.Constants.idTokenKey);\r\n var rawClientInfo = this._cacheStorage.getItem(Constants_1.Constants.msalClientInfo);\r\n if (!Utils_1.Utils.isEmpty(rawIdToken) && !Utils_1.Utils.isEmpty(rawClientInfo)) {\r\n var idToken = new IdToken_1.IdToken(rawIdToken);\r\n var clientInfo = new ClientInfo_1.ClientInfo(rawClientInfo);\r\n this._user = User_1.User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n return null;\r\n };\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.handleAuthenticationResponse = function (hash) {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n var self = null;\r\n var isPopup = false;\r\n var isWindowOpenerMsal = false;\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n }\r\n catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n var requestInfo = self.getRequestInfo(hash); //if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n var token = null, tokenReceivedCallback = null, tokenType, saveToken = true;\r\n self._logger.info(\"Returned from redirect url\");\r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants_1.Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants_1.Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n }\r\n self.saveTokenFromHash(requestInfo);\r\n if ((requestInfo.requestType === Constants_1.Constants.renewToken) && window.parent) {\r\n if (window.parent !== window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n }\r\n else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n token = requestInfo.parameters[Constants_1.Constants.accessToken] || requestInfo.parameters[Constants_1.Constants.idToken];\r\n tokenType = Constants_1.Constants.accessToken;\r\n }\r\n else if (requestInfo.requestType === Constants_1.Constants.login) {\r\n token = requestInfo.parameters[Constants_1.Constants.idToken];\r\n tokenType = Constants_1.Constants.idToken;\r\n }\r\n var errorDesc = requestInfo.parameters[Constants_1.Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants_1.Constants.error];\r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n }\r\n catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n };\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.saveAccessToken = function (authority, tokenResponse, user, clientInfo, idToken) {\r\n var scope;\r\n var clientObj = new ClientInfo_1.ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n var consentedScopes = scope.split(\" \");\r\n var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (var i = 0; i < accessTokenCacheItems.length; i++) {\r\n var accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n var cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils_1.Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n var accessTokenKey = new AccessTokenKey_1.AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n var accessTokenValue = new AccessTokenValue_1.AccessTokenValue(tokenResponse.parameters[Constants_1.Constants.accessToken], idToken.rawIdToken, Utils_1.Utils.expiresIn(tokenResponse.parameters[Constants_1.Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n else {\r\n scope = this.clientId;\r\n var accessTokenKey = new AccessTokenKey_1.AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n var accessTokenValue = new AccessTokenValue_1.AccessTokenValue(tokenResponse.parameters[Constants_1.Constants.idToken], tokenResponse.parameters[Constants_1.Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n };\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.saveTokenFromHash = function (tokenResponse) {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"\");\r\n var scope = \"\";\r\n var authorityKey = \"\";\r\n var acquireTokenUserKey = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants_1.Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants_1.Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, tokenResponse.parameters[Constants_1.Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants_1.Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants_1.Constants.loginError, tokenResponse.parameters[Constants_1.Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants_1.Constants.error]);\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n if (tokenResponse.requestType === Constants_1.Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + userKey + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n }\r\n else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants_1.Constants.msalSessionState, tokenResponse.parameters[Constants_1.Constants.sessionState]);\r\n }\r\n var idToken;\r\n var clientInfo = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n var user = void 0;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n idToken = new IdToken_1.IdToken(tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n }\r\n else {\r\n idToken = new IdToken_1.IdToken(this._cacheStorage.getItem(Constants_1.Constants.idTokenKey));\r\n }\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var authority = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils_1.Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants_1.Constants.clientInfo];\r\n user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n }\r\n else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n }\r\n acquireTokenUserKey = Constants_1.Constants.acquireTokenUser + Constants_1.Constants.resourceDelimeter + user.userIdentifier + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var acquireTokenUser = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils_1.Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n }\r\n else {\r\n this._logger.warning(\"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken_1.IdToken(tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants_1.Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants_1.Constants.clientInfo];\r\n }\r\n else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n authorityKey = Constants_1.Constants.authority + Constants_1.Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var authority = void 0;\r\n if (!Utils_1.Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils_1.Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n this._user = User_1.User.createUser(idToken, new ClientInfo_1.ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants_1.Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants_1.Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants_1.Constants.idTokenKey, tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n this._cacheStorage.setItem(Constants_1.Constants.msalClientInfo, clientInfo);\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n }\r\n else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants_1.Constants.idToken];\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants_1.Constants.idToken]);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants_1.Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants_1.Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants_1.Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants_1.Constants.renewStatus + tokenResponse.stateResponse, Constants_1.Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n };\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.isCallback = function (hash) {\r\n hash = this.getHash(hash);\r\n var parameters = Utils_1.Utils.deserialize(hash);\r\n return (parameters.hasOwnProperty(Constants_1.Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.error) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.idToken));\r\n };\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getHash = function (hash) {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n }\r\n else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n return hash;\r\n };\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getRequestInfo = function (hash) {\r\n hash = this.getHash(hash);\r\n var parameters = Utils_1.Utils.deserialize(hash);\r\n var tokenResponse = new RequestInfo_1.TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants_1.Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.error) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants_1.Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n var stateResponse = void 0;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n }\r\n else {\r\n return tokenResponse;\r\n }\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants_1.Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants_1.Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n else if (stateResponse === this._cacheStorage.getItem(Constants_1.Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants_1.Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n var statesInParentContext = window.renewStates;\r\n for (var i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n };\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getScopeFromState = function (state) {\r\n if (state) {\r\n var splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n };\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.isInIframe = function () {\r\n return window.parent !== window;\r\n };\r\n UserAgentApplication.prototype.loginInProgress = function () {\r\n var pendingCallback = this._cacheStorage.getItem(Constants_1.Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n };\r\n UserAgentApplication.prototype.getHostFromUri = function (uri) {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n };\r\n UserAgentApplication.prototype.getScopesForEndpoint = function (endpoint) {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n if (this._endpoints.size > 0) {\r\n for (var _i = 0, _a = Array.from(this._endpoints.keys()); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n };\r\n //These APIS are exposed for msalAngular wrapper only\r\n UserAgentApplication.prototype.setloginInProgress = function (loginInProgress) {\r\n this._loginInProgress = loginInProgress;\r\n };\r\n UserAgentApplication.prototype.getAcquireTokenInProgress = function () {\r\n return this._acquireTokenInProgress;\r\n };\r\n UserAgentApplication.prototype.setAcquireTokenInProgress = function (acquireTokenInProgress) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n };\r\n UserAgentApplication.prototype.getLogger = function () {\r\n return this._logger;\r\n };\r\n tslib_1.__decorate([\r\n resolveTokenOnlyIfOutOfIframe\r\n ], UserAgentApplication.prototype, \"acquireTokenSilent\", null);\r\n return UserAgentApplication;\r\n}());\r\nexports.UserAgentApplication = UserAgentApplication;\r\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenKey = /** @class */ (function () {\r\n function AccessTokenKey(authority, clientId, scopes, uid, utid) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils_1.Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils_1.Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n return AccessTokenKey;\r\n}());\r\nexports.AccessTokenKey = AccessTokenKey;\r\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenValue = /** @class */ (function () {\r\n function AccessTokenValue(accessToken, idToken, expiresIn, clientInfo) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n return AccessTokenValue;\r\n}());\r\nexports.AccessTokenValue = AccessTokenValue;\r\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar AuthenticationRequestParameters = /** @class */ (function () {\r\n function AuthenticationRequestParameters(authority, clientId, scope, responseType, redirectUri) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils_1.Utils.createNewGuid();\r\n this.state = Utils_1.Utils.createNewGuid();\r\n this.nonce = Utils_1.Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils_1.Utils.getLibraryVersion();\r\n }\r\n Object.defineProperty(AuthenticationRequestParameters.prototype, \"authority\", {\r\n get: function () {\r\n return this.authorityInstance.CanonicalAuthority;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n AuthenticationRequestParameters.prototype.createNavigateUrl = function (scopes) {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n var str = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(\"x-client-SKU=\" + this.xClientSku);\r\n str.push(\"x-client-Ver=\" + this.xClientVer);\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n var authEndpoint = this.authorityInstance.AuthorizationEndpoint;\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n }\r\n else {\r\n authEndpoint += \"&\";\r\n }\r\n var requestUrl = \"\" + authEndpoint + str.join(\"&\");\r\n return requestUrl;\r\n };\r\n AuthenticationRequestParameters.prototype.translateclientIdUsedInScope = function (scopes) {\r\n var clientIdIndex = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n };\r\n AuthenticationRequestParameters.prototype.parseScope = function (scopes) {\r\n var scopeList = \"\";\r\n if (scopes) {\r\n for (var i = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n return scopeList;\r\n };\r\n return AuthenticationRequestParameters;\r\n}());\r\nexports.AuthenticationRequestParameters = AuthenticationRequestParameters;\r\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar ClientInfo = /** @class */ (function () {\r\n function ClientInfo(rawClientInfo) {\r\n if (!rawClientInfo || Utils_1.Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n try {\r\n var decodedClientInfo = Utils_1.Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n var clientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n Object.defineProperty(ClientInfo.prototype, \"uid\", {\r\n get: function () {\r\n return this._uid ? this._uid : \"\";\r\n },\r\n set: function (uid) {\r\n this._uid = uid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientInfo.prototype, \"utid\", {\r\n get: function () {\r\n return this._utid ? this._utid : \"\";\r\n },\r\n set: function (utid) {\r\n this._utid = utid;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ClientInfo;\r\n}());\r\nexports.ClientInfo = ClientInfo;\r\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar IdToken = /** @class */ (function () {\r\n function IdToken(rawIdToken) {\r\n if (Utils_1.Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils_1.Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n }\r\n catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n return IdToken;\r\n}());\r\nexports.IdToken = IdToken;\r\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar Constants_1 = __webpack_require__(3);\r\nvar AccessTokenCacheItem_1 = __webpack_require__(19);\r\n/*\r\n * @hidden\r\n */\r\nvar Storage = /** @class */ (function () {\r\n function Storage(cacheLocation) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n return Storage._instance;\r\n }\r\n // add value to storage\r\n Storage.prototype.setItem = function (key, value) {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // get one item by key from storage\r\n Storage.prototype.getItem = function (key) {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // remove value from storage\r\n Storage.prototype.removeItem = function (key) {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n // clear storage (remove all items from it)\r\n Storage.prototype.clear = function () {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n Storage.prototype.getAllAccessTokens = function (clientId, userIdentifier) {\r\n var results = [];\r\n var accessTokenCacheItem;\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n var value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem_1.AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n return results;\r\n };\r\n Storage.prototype.removeAcquireTokenEntries = function (authorityKey, acquireTokenUserKey) {\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey != \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n Storage.prototype.resetCacheItems = function () {\r\n var storage = window[this._cacheLocation];\r\n if (storage) {\r\n var key = void 0;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants_1.Constants.msal) !== -1) {\r\n this.setItem(key, \"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants_1.Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n }\r\n else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n };\r\n return Storage;\r\n}());\r\nexports.Storage = Storage;\r\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar AccessTokenCacheItem = /** @class */ (function () {\r\n function AccessTokenCacheItem(key, value) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n return AccessTokenCacheItem;\r\n}());\r\nexports.AccessTokenCacheItem = AccessTokenCacheItem;\r\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\n/*\r\n * @hidden\r\n */\r\nvar Utils_1 = __webpack_require__(0);\r\nvar AadAuthority_1 = __webpack_require__(8);\r\nvar B2cAuthority_1 = __webpack_require__(21);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar AuthorityFactory = /** @class */ (function () {\r\n function AuthorityFactory() {\r\n }\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n AuthorityFactory.DetectAuthorityFromUrl = function (authorityUrl) {\r\n authorityUrl = Utils_1.Utils.CanonicalizeUri(authorityUrl);\r\n var components = Utils_1.Utils.GetUrlComponents(authorityUrl);\r\n var pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return Authority_1.AuthorityType.B2C;\r\n case \"adfs\":\r\n return Authority_1.AuthorityType.Adfs;\r\n default:\r\n return Authority_1.AuthorityType.Aad;\r\n }\r\n };\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n AuthorityFactory.CreateInstance = function (authorityUrl, validateAuthority) {\r\n var type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case Authority_1.AuthorityType.B2C:\r\n return new B2cAuthority_1.B2cAuthority(authorityUrl, validateAuthority);\r\n case Authority_1.AuthorityType.Aad:\r\n return new AadAuthority_1.AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage_1.ErrorMessage.invalidAuthorityType;\r\n }\r\n };\r\n return AuthorityFactory;\r\n}());\r\nexports.AuthorityFactory = AuthorityFactory;\r\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar tslib_1 = __webpack_require__(2);\r\nvar AadAuthority_1 = __webpack_require__(8);\r\nvar Authority_1 = __webpack_require__(1);\r\nvar ErrorMessage_1 = __webpack_require__(5);\r\nvar Utils_1 = __webpack_require__(0);\r\n/*\r\n * @hidden\r\n */\r\nvar B2cAuthority = /** @class */ (function (_super) {\r\n tslib_1.__extends(B2cAuthority, _super);\r\n function B2cAuthority(authority, validateAuthority) {\r\n var _this = _super.call(this, authority, validateAuthority) || this;\r\n var urlComponents = Utils_1.Utils.GetUrlComponents(authority);\r\n var pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage_1.ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n _this.CanonicalAuthority = \"https://\" + urlComponents.HostNameAndPort + \"/\" + pathSegments[0] + \"/\" + pathSegments[1] + \"/\" + pathSegments[2] + \"/\";\r\n return _this;\r\n }\r\n Object.defineProperty(B2cAuthority.prototype, \"AuthorityType\", {\r\n get: function () {\r\n return Authority_1.AuthorityType.B2C;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n B2cAuthority.prototype.GetOpenIdConfigurationEndpointAsync = function () {\r\n var _this = this;\r\n var resultPromise = new Promise(function (resolve, reject) {\r\n return resolve(_this.DefaultOpenIdConfigurationEndpoint);\r\n });\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n return new Promise(function (resolve, reject) {\r\n return reject(ErrorMessage_1.ErrorMessage.unsupportedAuthorityValidation);\r\n });\r\n };\r\n return B2cAuthority;\r\n}(AadAuthority_1.AadAuthority));\r\nexports.B2cAuthority = B2cAuthority;\r\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// msal.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 10);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ae24f8fce33e1fd2db85","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { IUri } from \"./IUri\";\r\nimport { User } from \"./User\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Utils {\r\n static compareObjects(u1: User, u2: User): boolean {\r\n if (!u1 || !u2) {\r\n return false;\r\n }\r\n if (u1.userIdentifier && u2.userIdentifier) {\r\n if (u1.userIdentifier === u2.userIdentifier) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static expiresIn(expires: string): number {\r\n // if AAD did not send \"expires_in\" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as \"expires_in\" value instead of 3600\r\n if (!expires) {\r\n expires = \"3599\";\r\n }\r\n return this.now() + parseInt(expires, 10);\r\n }\r\n\r\n static now(): number {\r\n return Math.round(new Date().getTime() / 1000.0);\r\n }\r\n\r\n static isEmpty(str: string): boolean {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n }\r\n\r\n static extractIdToken(encodedIdToken: string): any {\r\n // id token will be decoded to get the username\r\n const decodedToken = this.decodeJwt(encodedIdToken);\r\n if (!decodedToken) {\r\n return null;\r\n }\r\n try {\r\n const base64IdToken = decodedToken.JWSPayload;\r\n const base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken);\r\n if (!base64Decoded) {\r\n //this._requestContext.logger.info(\"The returned id_token could not be base64 url safe decoded.\");\r\n return null;\r\n }\r\n // ECMA script has JSON built-in support\r\n return JSON.parse(base64Decoded);\r\n } catch (err) {\r\n //this._requestContext.logger.error(\"The returned id_token could not be decoded\" + err);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n static base64EncodeStringUrlSafe(input: string): string {\r\n // html5 should support atob function for decoding\r\n if (window.btoa) {\r\n return window.btoa(input);\r\n }\r\n else {\r\n return this.encode(input);\r\n }\r\n }\r\n\r\n static base64DecodeStringUrlSafe(base64IdToken: string): string {\r\n // html5 should support atob function for decoding\r\n base64IdToken = base64IdToken.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n if (window.atob) {\r\n return decodeURIComponent(encodeURIComponent(window.atob(base64IdToken))); // jshint ignore:line\r\n }\r\n else {\r\n return decodeURIComponent(encodeURIComponent(this.decode(base64IdToken)));\r\n }\r\n }\r\n\r\n static encode(input: string): string {\r\n const keyStr: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n let output = \"\";\r\n let chr1: number, chr2: number, chr3: number, enc1: number, enc2: number, enc3: number, enc4: number;\r\n var i = 0;\r\n\r\n input = this.utf8Encode(input);\r\n\r\n while (i < input.length) {\r\n chr1 = input.charCodeAt(i++);\r\n chr2 = input.charCodeAt(i++);\r\n chr3 = input.charCodeAt(i++);\r\n\r\n enc1 = chr1 >> 2;\r\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\r\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\r\n enc4 = chr3 & 63;\r\n\r\n if (isNaN(chr2)) {\r\n enc3 = enc4 = 64;\r\n } else if (isNaN(chr3)) {\r\n enc4 = 64;\r\n }\r\n\r\n output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\r\n }\r\n\r\n return output.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\r\n }\r\n\r\n static utf8Encode(input: string): string {\r\n input = input.replace(/\\r\\n/g, \"\\n\");\r\n var utftext = \"\";\r\n\r\n for (var n = 0; n < input.length; n++) {\r\n var c = input.charCodeAt(n);\r\n\r\n if (c < 128) {\r\n utftext += String.fromCharCode(c);\r\n }\r\n else if ((c > 127) && (c < 2048)) {\r\n utftext += String.fromCharCode((c >> 6) | 192);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n else {\r\n utftext += String.fromCharCode((c >> 12) | 224);\r\n utftext += String.fromCharCode(((c >> 6) & 63) | 128);\r\n utftext += String.fromCharCode((c & 63) | 128);\r\n }\r\n }\r\n\r\n return utftext;\r\n }\r\n\r\n static decode(base64IdToken: string): string {\r\n var codes = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\n base64IdToken = String(base64IdToken).replace(/=+$/, \"\");\r\n var length = base64IdToken.length;\r\n if (length % 4 === 1) {\r\n throw new Error(\"The token to be decoded is not correctly encoded.\");\r\n }\r\n let h1: number, h2: number, h3: number, h4: number, bits: number, c1: number, c2: number, c3: number, decoded = \"\";\r\n for (var i = 0; i < length; i += 4) {\r\n //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits\r\n // then 6 bits per base64 encoded character\r\n h1 = codes.indexOf(base64IdToken.charAt(i));\r\n h2 = codes.indexOf(base64IdToken.charAt(i + 1));\r\n h3 = codes.indexOf(base64IdToken.charAt(i + 2));\r\n h4 = codes.indexOf(base64IdToken.charAt(i + 3));\r\n // For padding, if last two are \"=\"\r\n if (i + 2 === length - 1) {\r\n bits = h1 << 18 | h2 << 12 | h3 << 6;\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n decoded += String.fromCharCode(c1, c2);\r\n break;\r\n }\r\n // if last one is \"=\"\r\n else if (i + 1 === length - 1) {\r\n bits = h1 << 18 | h2 << 12;\r\n c1 = bits >> 16 & 255;\r\n decoded += String.fromCharCode(c1);\r\n break;\r\n }\r\n bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;\r\n // then convert to 3 byte chars\r\n c1 = bits >> 16 & 255;\r\n c2 = bits >> 8 & 255;\r\n c3 = bits & 255;\r\n decoded += String.fromCharCode(c1, c2, c3);\r\n }\r\n return decoded;\r\n }\r\n\r\n static decodeJwt(jwtToken: string): any {\r\n if (this.isEmpty(jwtToken)) {\r\n return null;\r\n }\r\n const idTokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n const matches = idTokenPartsRegex.exec(jwtToken);\r\n if (!matches || matches.length < 4) {\r\n //this._requestContext.logger.warn(\"The returned id_token is not parseable.\");\r\n return null;\r\n }\r\n const crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n }\r\n\r\n static deserialize(query: string): any {\r\n let match: Array; // Regex for replacing addition symbol with a space\r\n const pl = /\\+/g;\r\n const search = /([^&=]+)=([^&]*)/g;\r\n const decode = (s: string) => decodeURIComponent(s.replace(pl, \" \"));\r\n const obj: {} = {};\r\n match = search.exec(query);\r\n while (match) {\r\n obj[decode(match[1])] = decode(match[2]);\r\n match = search.exec(query);\r\n }\r\n return obj;\r\n }\r\n\r\n static isIntersectingScopes(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n for (let i = 0; i < scopes.length; i++) {\r\n if (cachedScopes.indexOf(scopes[i].toLowerCase()) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n static containsScope(cachedScopes: Array, scopes: Array): boolean {\r\n cachedScopes = this.convertToLowerCase(cachedScopes);\r\n return scopes.every((value: any): boolean => cachedScopes.indexOf(value.toString().toLowerCase()) >= 0);\r\n }\r\n\r\n static convertToLowerCase(scopes: Array): Array {\r\n return scopes.map(scope => scope.toLowerCase());\r\n }\r\n\r\n static removeElement(scopes: Array, scope: string): Array {\r\n return scopes.filter(value => value !== scope);\r\n }\r\n\r\n static decimalToHex(num: number): string {\r\n var hex: string = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n }\r\n\r\n static getLibraryVersion(): string {\r\n return \"0.1.9\";\r\n }\r\n\r\n /*\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n static replaceFirstPath(href: string, tenantId: string): string {\r\n var match = href.match(/^(https?\\:)\\/\\/(([^:\\/?#] *)(?:\\:([0-9]+))?)([\\/]{0,1}[^?#] *)(\\?[^#] *|)(#. *|)$/);\r\n if (match) {\r\n var urlObject = Utils.GetUrlComponents(href);\r\n var pathArray = urlObject.PathSegments;\r\n pathArray.shift();\r\n if (pathArray[0] && pathArray[0] === \"common\" || pathArray[0] === \"organizations\") {\r\n pathArray[0] = tenantId;\r\n href = urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + pathArray.join(\"/\");\r\n }\r\n }\r\n return href;\r\n }\r\n\r\n static createNewGuid(): string {\r\n // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n // pseudo-random numbers.\r\n // The algorithm is as follows:\r\n // Set the two most significant bits (bits 6 and 7) of the\r\n // clock_seq_hi_and_reserved to zero and one, respectively.\r\n // Set the four most significant bits (bits 12 through 15) of the\r\n // time_hi_and_version field to the 4-bit version number from\r\n // Section 4.1.3. Version4\r\n // Set all the other bits to randomly (or pseudo-randomly) chosen\r\n // values.\r\n // UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n // time-low = 4hexOctet\r\n // time-mid = 2hexOctet\r\n // time-high-and-version = 2hexOctet\r\n // clock-seq-and-reserved = hexOctet:\r\n // clock-seq-low = hexOctet\r\n // node = 6hexOctet\r\n // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n // y values are 8, 9, A, B\r\n\r\n const cryptoObj: Crypto = window.crypto; // for IE 11\r\n if (cryptoObj && cryptoObj.getRandomValues) {\r\n const buffer: Uint8Array = new Uint8Array(16);\r\n cryptoObj.getRandomValues(buffer);\r\n\r\n //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n\r\n //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0.\r\n\r\n return Utils.decimalToHex(buffer[0]) + Utils.decimalToHex(buffer[1])\r\n + Utils.decimalToHex(buffer[2]) + Utils.decimalToHex(buffer[3])\r\n + \"-\" + Utils.decimalToHex(buffer[4]) + Utils.decimalToHex(buffer[5])\r\n + \"-\" + Utils.decimalToHex(buffer[6]) + Utils.decimalToHex(buffer[7])\r\n + \"-\" + Utils.decimalToHex(buffer[8]) + Utils.decimalToHex(buffer[9])\r\n + \"-\" + Utils.decimalToHex(buffer[10]) + Utils.decimalToHex(buffer[11])\r\n + Utils.decimalToHex(buffer[12]) + Utils.decimalToHex(buffer[13])\r\n + Utils.decimalToHex(buffer[14]) + Utils.decimalToHex(buffer[15]);\r\n }\r\n else {\r\n const guidHolder: string = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n const hex: string = \"0123456789abcdef\";\r\n let r: number = 0;\r\n let guidResponse: string = \"\";\r\n for (let i: number = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n } else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n } else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n }\r\n\r\n /*\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n static GetUrlComponents(url: string): IUri {\r\n if (!url) {\r\n throw \"Url required\";\r\n }\r\n\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n\r\n var match = url.match(regEx);\r\n\r\n if (!match || match.length < 6) {\r\n throw \"Valid url required\";\r\n }\r\n\r\n let urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5]\r\n };\r\n\r\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n return urlComponents;\r\n }\r\n\r\n /*\r\n * Given a url or path, append a trailing slash if one doesnt exist\r\n */\r\n static CanonicalizeUri(url: string): string {\r\n if (url) {\r\n url = url.toLowerCase();\r\n }\r\n\r\n if (url && !Utils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n\r\n return url;\r\n }\r\n\r\n /*\r\n * Checks to see if the url ends with the suffix\r\n * Required because we are compiling for es5 instead of es6\r\n * @param url\r\n * @param str\r\n */\r\n static endsWith(url: string, suffix: string): boolean {\r\n if (!url || !suffix) {\r\n return false;\r\n }\r\n\r\n return url.indexOf(suffix, url.length - suffix.length) !== -1;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Utils.ts","import { IUri } from \"./IUri\";\r\nimport { Utils } from \"./Utils\";\r\nimport { ITenantDiscoveryResponse } from \"./ITenantDiscoveryResponse\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport enum AuthorityType {\r\n Aad,\r\n Adfs,\r\n B2C\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport abstract class Authority {\r\n constructor(authority: string, validateAuthority: boolean) {\r\n this.IsValidationEnabled = validateAuthority;\r\n this.CanonicalAuthority = authority;\r\n\r\n this.validateAsUri();\r\n }\r\n\r\n public abstract get AuthorityType(): AuthorityType;\r\n\r\n public IsValidationEnabled: boolean;\r\n\r\n public get Tenant(): string {\r\n return this.CanonicalAuthorityUrlComponents.PathSegments[0];\r\n }\r\n\r\n private tenantDiscoveryResponse: ITenantDiscoveryResponse;\r\n\r\n public get AuthorizationEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.AuthorizationEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get EndSessionEndpoint(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.EndSessionEndpoint.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n public get SelfSignedJwtAudience(): string {\r\n this.validateResolved();\r\n return this.tenantDiscoveryResponse.Issuer.replace(\"{tenant}\", this.Tenant);\r\n }\r\n\r\n private validateResolved() {\r\n if (!this.tenantDiscoveryResponse) {\r\n throw \"Please call ResolveEndpointsAsync first\";\r\n }\r\n }\r\n\r\n /*\r\n * A URL that is the authority set by the developer\r\n */\r\n public get CanonicalAuthority(): string {\r\n return this.canonicalAuthority;\r\n }\r\n\r\n public set CanonicalAuthority(url: string) {\r\n this.canonicalAuthority = Utils.CanonicalizeUri(url);\r\n this.canonicalAuthorityUrlComponents = null;\r\n }\r\n\r\n private canonicalAuthority: string;\r\n private canonicalAuthorityUrlComponents: IUri;\r\n\r\n public get CanonicalAuthorityUrlComponents(): IUri {\r\n if (!this.canonicalAuthorityUrlComponents) {\r\n this.canonicalAuthorityUrlComponents = Utils.GetUrlComponents(this.CanonicalAuthority);\r\n }\r\n\r\n return this.canonicalAuthorityUrlComponents;\r\n }\r\n\r\n /*\r\n * // http://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\r\n */\r\n protected get DefaultOpenIdConfigurationEndpoint(): string {\r\n return `${this.CanonicalAuthority}v2.0/.well-known/openid-configuration`;\r\n }\r\n\r\n /*\r\n * Given a string, validate that it is of the form https://domain/path\r\n */\r\n private validateAsUri() {\r\n let components;\r\n try {\r\n components = this.CanonicalAuthorityUrlComponents;\r\n } catch (e) {\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ErrorMessage.authorityUriInsecure;\r\n }\r\n\r\n if (!components.PathSegments || components.PathSegments.length < 1) {\r\n throw ErrorMessage.authorityUriInvalidPath;\r\n }\r\n }\r\n\r\n /*\r\n * Calls the OIDC endpoint and returns the response\r\n */\r\n private DiscoverEndpoints(openIdConfigurationEndpoint: string): Promise {\r\n let client = new XhrClient();\r\n return client.sendRequestAsync(openIdConfigurationEndpoint, \"GET\", /*enableCaching: */ true)\r\n .then((response: any) => {\r\n return {\r\n AuthorizationEndpoint: response.authorization_endpoint,\r\n EndSessionEndpoint: response.end_session_endpoint,\r\n Issuer: response.issuer\r\n };\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise.\r\n * Checks to see if the authority is in the cache\r\n * Discover endpoints via openid-configuration\r\n * If successful, caches the endpoint for later use in OIDC\r\n */\r\n public ResolveEndpointsAsync(): Promise {\r\n let openIdConfigurationEndpoint = \"\";\r\n return this.GetOpenIdConfigurationEndpointAsync().then(openIdConfigurationEndpointResponse => {\r\n openIdConfigurationEndpoint = openIdConfigurationEndpointResponse;\r\n return this.DiscoverEndpoints(openIdConfigurationEndpoint);\r\n }).then((tenantDiscoveryResponse: ITenantDiscoveryResponse) => {\r\n this.tenantDiscoveryResponse = tenantDiscoveryResponse;\r\n return this;\r\n });\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public abstract GetOpenIdConfigurationEndpointAsync(): Promise;\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Authority.ts","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/tslib/tslib.es6.js\n// module id = 2\n// module chunks = 0 1","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Constants {\r\n static get errorDescription(): string { return \"error_description\"; }\r\n static get error(): string { return \"error\"; }\r\n static get scope(): string { return \"scope\"; }\r\n static get acquireTokenUser(): string { return \"msal.acquireTokenUser\"; }\r\n static get clientInfo(): string { return \"client_info\"; }\r\n static get clientId(): string { return \"clientId\"; }\r\n static get authority(): string { return \"msal.authority\"; }\r\n static get idToken(): string { return \"id_token\"; }\r\n static get accessToken(): string { return \"access_token\"; }\r\n static get expiresIn(): string { return \"expires_in\"; }\r\n static get sessionState(): string { return \"session_state\"; }\r\n static get msalClientInfo(): string { return \"msal.client.info\"; }\r\n static get msalError(): string { return \"msal.error\"; }\r\n static get msalErrorDescription(): string { return \"msal.error.description\"; }\r\n static get msalSessionState(): string { return \"msal.session.state\"; }\r\n static get tokenKeys(): string { return \"msal.token.keys\"; }\r\n static get accessTokenKey(): string { return \"msal.access.token.key\"; }\r\n static get expirationKey(): string { return \"msal.expiration.key\"; }\r\n static get stateLogin(): string { return \"msal.state.login\"; }\r\n static get stateAcquireToken(): string { return \"msal.state.acquireToken\"; }\r\n static get stateRenew(): string { return \"msal.state.renew\"; }\r\n static get nonceIdToken(): string { return \"msal.nonce.idtoken\"; }\r\n static get userName(): string { return \"msal.username\"; }\r\n static get idTokenKey(): string { return \"msal.idtoken\"; }\r\n static get loginRequest(): string { return \"msal.login.request\"; }\r\n static get loginError(): string { return \"msal.login.error\"; }\r\n static get renewStatus(): string { return \"msal.token.renew.status\"; }\r\n static get msal(): string { return \"msal\"; }\r\n static get resourceDelimeter(): string { return \"|\"; }\r\n static get tokenRenewStatusCancelled(): string { return \"Canceled\"; }\r\n static get tokenRenewStatusCompleted(): string { return \"Completed\"; }\r\n static get tokenRenewStatusInProgress(): string { return \"In Progress\"; }\r\n private static _popUpWidth: number = 483;\r\n static get popUpWidth(): number { return this._popUpWidth; }\r\n static set popUpWidth(width: number) {\r\n this._popUpWidth = width;\r\n }\r\n private static _popUpHeight: number = 600;\r\n static get popUpHeight(): number { return this._popUpHeight; }\r\n static set popUpHeight(height: number) {\r\n this._popUpHeight = height;\r\n }\r\n static get login(): string { return \"LOGIN\"; }\r\n static get renewToken(): string { return \"RENEW_TOKEN\"; }\r\n static get unknown(): string { return \"UNKNOWN\"; }\r\n static get urlHash(): string { return \"msal.urlHash\"; }\r\n static get angularLoginRequest(): string { return \"msal.angular.login.request\"; }\r\n static get userIdentifier(): string { return \"userIdentifier\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorCodes {\r\n static get loginProgressError(): string { return \"login_progress_error\"; }\r\n static get acquireTokenProgressError(): string { return \"acquiretoken_progress_error\"; }\r\n static get inputScopesError(): string { return \"input_scopes_error\"; }\r\n static get endpointResolutionError(): string { return \"endpoints_resolution_error\"; }\r\n static get popUpWindowError(): string { return \"popup_window_error\"; }\r\n static get userLoginError(): string { return \"user_login_error\"; }\r\n static get userCancelledError(): string { return \"user_cancelled\"; }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorDescription {\r\n static get loginProgressError(): string { return \"Login is in progress\"; }\r\n static get acquireTokenProgressError(): string { return \"Acquire token is in progress\"; }\r\n static get inputScopesError(): string { return \"Invalid value of input scopes provided\"; }\r\n static get endpointResolutionError(): string { return \"Endpoints cannot be resolved\"; }\r\n static get popUpWindowError(): string { return \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"; }\r\n static get userLoginError(): string { return \"User login is required\"; }\r\n static get userCancelledError(): string { return \"User closed the popup window window and cancelled the flow\"; }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Constants.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport interface ILoggerCallback {\r\n (level: LogLevel, message: string, containsPii: boolean): void;\r\n}\r\n\r\nexport enum LogLevel {\r\n Error,\r\n Warning,\r\n Info,\r\n Verbose\r\n}\r\n\r\nexport class Logger {// Singleton Class\r\n\r\n /*\r\n * @hidden\r\n */\r\n private static _instance: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _correlationId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _level: LogLevel = LogLevel.Info;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _piiLoggingEnabled: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _localCallback: ILoggerCallback;\r\n\r\n constructor(localCallback: ILoggerCallback,\r\n options:\r\n {\r\n correlationId?: string,\r\n level?: LogLevel,\r\n piiLoggingEnabled?: boolean,\r\n } = {}) {\r\n const {\r\n correlationId = \"\",\r\n level = LogLevel.Info,\r\n piiLoggingEnabled = false\r\n } = options;\r\n\r\n this._localCallback = localCallback;\r\n this._correlationId = correlationId;\r\n this._level = level;\r\n this._piiLoggingEnabled = piiLoggingEnabled;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n private logMessage(logLevel: LogLevel, logMessage: string, containsPii: boolean): void {\r\n if ((logLevel > this._level) || (!this._piiLoggingEnabled && containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var log: string;\r\n if (!Utils.isEmpty(this._correlationId)) {\r\n log = timestamp + \":\" + this._correlationId + \"-\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n else {\r\n log = timestamp + \":\" + Utils.getLibraryVersion() + \"-\" + LogLevel[logLevel] + \" \" + logMessage;\r\n }\r\n this.executeCallback(logLevel, log, containsPii);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n executeCallback(level: LogLevel, message: string, containsPii: boolean) {\r\n if (this._localCallback) {\r\n this._localCallback(level, message, containsPii);\r\n }\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n error(message: string): void {\r\n this.logMessage(LogLevel.Error, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n errorPii(message: string): void {\r\n this.logMessage(LogLevel.Error, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warning(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n warningPii(message: string): void {\r\n this.logMessage(LogLevel.Warning, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n info(message: string): void {\r\n this.logMessage(LogLevel.Info, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n infoPii(message: string): void {\r\n this.logMessage(LogLevel.Info, message, true);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbose(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, false);\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n verbosePii(message: string): void {\r\n this.logMessage(LogLevel.Verbose, message, true);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Logger.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ErrorMessage {\r\n static get authorityUriInvalidPath(): string { return \"AuthorityUriInvalidPath\"; }\r\n static get authorityUriInsecure(): string { return \"AuthorityUriInsecure\"; }\r\n static get invalidAuthorityType(): string { return \"InvalidAuthorityType\"; }\r\n static get unsupportedAuthorityValidation(): string { return \"UnsupportedAuthorityValidation\"; }\r\n static get b2cAuthorityUriInvalidPath(): string { return \"B2cAuthorityUriInvalidPath\"; }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ErrorMessage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class TokenResponse {\r\n valid: boolean;\r\n parameters: Object;\r\n stateMatch: boolean;\r\n stateResponse: string;\r\n requestType: string;\r\n\r\n constructor() {\r\n this.valid = false;\r\n this.parameters = {};\r\n this.stateMatch = false;\r\n this.stateResponse = \"\";\r\n this.requestType = \"unknown\";\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/RequestInfo.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Utils } from \"./Utils\";\r\n\r\nexport class User {\r\n\r\n displayableId: string;\r\n name: string;\r\n identityProvider: string;\r\n userIdentifier: string;\r\n idToken: Object\r\n\r\n /*\r\n * @hidden\r\n */\r\n constructor(displayableId: string, name: string, identityProvider: string, userIdentifier: string, idToken:Object) {\r\n this.displayableId = displayableId;\r\n this.name = name;\r\n this.identityProvider = identityProvider;\r\n this.userIdentifier = userIdentifier;\r\n this.idToken = idToken;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n static createUser(idToken: IdToken, clientInfo: ClientInfo, authority: string): User {\r\n let uid: string;\r\n let utid: string;\r\n if (!clientInfo) {\r\n uid = \"\";\r\n utid = \"\";\r\n }\r\n else {\r\n uid = clientInfo.uid;\r\n utid = clientInfo.utid;\r\n }\r\n\r\n const userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n return new User(idToken.preferredName, idToken.name, idToken.issuer, userIdentifier, idToken.decodedIdToken);\r\n }\r\n}\n\n\n// WEBPACK FOOTER //\n// ./src/User.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { XhrClient } from \"./XHRClient\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class AadAuthority extends Authority {\r\n private static readonly AadInstanceDiscoveryEndpoint: string = \"https://login.microsoftonline.com/common/discovery/instance\";\r\n\r\n private get AadInstanceDiscoveryEndpointUrl(): string {\r\n return `${AadAuthority.AadInstanceDiscoveryEndpoint}?api-version=1.0&authorization_endpoint=${this.CanonicalAuthority}oauth2/v2.0/authorize`;\r\n }\r\n\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.Aad;\r\n }\r\n\r\n private static readonly TrustedHostList: any = {\r\n \"login.windows.net\": \"login.windows.net\",\r\n \"login.chinacloudapi.cn\": \"login.chinacloudapi.cn\",\r\n \"login.cloudgovapi.us\": \"login.cloudgovapi.us\",\r\n \"login.microsoftonline.com\": \"login.microsoftonline.com\",\r\n \"login.microsoftonline.de\": \"login.microsoftonline.de\",\r\n \"login.microsoftonline.us\": \"login.microsoftonline.us\"\r\n };\r\n\r\n /**\r\n * Returns a promise which resolves to the OIDC endpoint\r\n * Only responds with the endpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise: Promise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n let host: string = this.CanonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (this.IsInTrustedHostList(host)) {\r\n return resultPromise;\r\n }\r\n\r\n let client: XhrClient = new XhrClient();\r\n\r\n return client.sendRequestAsync(this.AadInstanceDiscoveryEndpointUrl, \"GET\", true)\r\n .then((response) => {\r\n return response.tenant_discovery_endpoint;\r\n });\r\n }\r\n\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param {string} The host to look up\r\n */\r\n public IsInTrustedHostList(host: string): boolean {\r\n return AadAuthority.TrustedHostList[host.toLowerCase()];\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AadAuthority.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * XHR client for JSON endpoints\r\n * https://www.npmjs.com/package/async-promise\r\n * @hidden\r\n */\r\nexport class XhrClient {\r\n public sendRequestAsync(url: string, method: string, enableCaching?: boolean): Promise {\r\n return new Promise((resolve, reject) => {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /*async: */ true);\r\n if (enableCaching) {\r\n // TODO: (shivb) ensure that this can be cached\r\n // xhr.setRequestHeader(\"Cache-Control\", \"Public\");\r\n }\r\n\r\n xhr.onload = (ev) => {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n } catch (e) {\r\n reject(this.handleError(xhr.responseText));\r\n }\r\n\r\n resolve(jsonResponse);\r\n };\r\n\r\n xhr.onerror = (ev) => {\r\n reject(xhr.status);\r\n };\r\n\r\n if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw \"not implemented\";\r\n }\r\n });\r\n }\r\n\r\n protected handleError(responseText: string): any {\r\n var jsonResponse;\r\n try {\r\n jsonResponse = JSON.parse(responseText);\r\n if (jsonResponse.error) {\r\n return jsonResponse.error;\r\n } else {\r\n throw responseText;\r\n }\r\n } catch (e) {\r\n return responseText;\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/XHRClient.ts","export { UserAgentApplication } from \"./UserAgentApplication\";\r\nexport { Logger } from \"./Logger\";\r\nexport { LogLevel } from \"./Logger\";\r\nexport { User } from \"./User\";\r\nexport { Constants } from \"./Constants\";\r\nexport { TokenResponse} from \"./RequestInfo\";\r\nexport {Authority} from \"./Authority\";\r\nexport {CacheResult} from \"./UserAgentApplication\";\r\n\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\nimport { AuthenticationRequestParameters } from \"./AuthenticationRequestParameters\";\r\nimport { Authority } from \"./Authority\";\r\nimport { ClientInfo } from \"./ClientInfo\";\r\nimport { Constants, ErrorCodes, ErrorDescription } from \"./Constants\";\r\nimport { IdToken } from \"./IdToken\";\r\nimport { Logger } from \"./Logger\";\r\nimport { Storage } from \"./Storage\";\r\nimport { TokenResponse } from \"./RequestInfo\";\r\nimport { User } from \"./User\";\r\nimport { Utils } from \"./Utils\";\r\nimport { AuthorityFactory } from \"./AuthorityFactory\";\r\n\r\ndeclare global {\r\n interface Window {\r\n msal: Object;\r\n CustomEvent: CustomEvent;\r\n Event: Event;\r\n activeRenewals: {};\r\n renewStates: Array;\r\n callBackMappedToRenewStates : {};\r\n callBacksMappedToRenewStates: {};\r\n openedWindows: Array;\r\n requestType: string;\r\n }\r\n}\r\n\r\n/*\r\n * @hidden\r\n */\r\nlet ResponseTypes = {\r\n id_token: \"id_token\",\r\n token: \"token\",\r\n id_token_token: \"id_token token\"\r\n};\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport interface CacheResult {\r\n errorDesc: string;\r\n token: string;\r\n error: string;\r\n}\r\n\r\n/*\r\n * A type alias of for a tokenReceivedCallback function.\r\n * @param tokenReceivedCallback.errorDesc error description returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.token token returned from STS if token request is successful.\r\n * @param tokenReceivedCallback.error error code returned from the STS if API call fails.\r\n * @param tokenReceivedCallback.tokenType tokenType returned from the STS if API call is successful. Possible values are: id_token OR access_token.\r\n */\r\nexport type tokenReceivedCallback = (errorDesc: string, token: string, error: string, tokenType: string) => void;\r\nconst resolveTokenOnlyIfOutOfIframe = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\r\n const tokenAcquisitionMethod = descriptor.value;\r\n descriptor.value = function (...args: any[]) {\r\n return this.isInIframe()\r\n ? new Promise(() => { })\r\n : tokenAcquisitionMethod.apply(this, args);\r\n };\r\n return descriptor;\r\n};\r\nexport class UserAgentApplication {\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocations = {\r\n localStorage: \"localStorage\",\r\n sessionStorage: \"sessionStorage\"\r\n };\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _cacheLocation: string;\r\n\r\n /*\r\n * Used to get the cache location\r\n */\r\n get cacheLocation(): string {\r\n return this._cacheLocation;\r\n }\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _logger: Logger;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _loginInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _acquireTokenInProgress: boolean;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _clockSkew = 300;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected _cacheStorage: Storage;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _tokenReceivedCallback: tokenReceivedCallback = null;\r\n\r\n /*\r\n * @hidden\r\n */\r\n private _user: User;\r\n\r\n /*\r\n * Client ID assigned to your app by Azure Active Directory.\r\n */\r\n clientId: string;\r\n\r\n /*\r\n * @hidden\r\n */\r\n protected authorityInstance: Authority;\r\n\r\n /*\r\n * Used to set the authority.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n */\r\n public set authority(val) {\r\n this.authorityInstance = AuthorityFactory.CreateInstance(val, this.validateAuthority);\r\n }\r\n\r\n /*\r\n * Used to get the authority.\r\n */\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n /*\r\n * Used to turn authority validation on/off.\r\n * When set to true (default), MSAL will compare the application\"s authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.\r\n */\r\n validateAuthority: boolean;\r\n\r\n /*\r\n * The redirect URI of the application, this should be same as the value in the application registration portal.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _redirectUri: string;\r\n\r\n /*\r\n * Used to redirect the user to this location after logout.\r\n * Defaults to `window.location.href`.\r\n */\r\n private _postLogoutredirectUri: string;\r\n\r\n loadFrameTimeout: number;\r\n\r\n protected _navigateToLoginRequestUrl: boolean;\r\n\r\n private _isAngular: boolean = false;\r\n\r\n private _endpoints: Map>;\r\n\r\n private _anonymousEndpoints: Array;\r\n\r\n /*\r\n * Initialize a UserAgentApplication with a given clientId and authority.\r\n * @constructor\r\n * @param {string} clientId - The clientID of your application, you should get this from the application registration portal.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<instance>/<tenant>,\\ where <instance> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenantId>/<policyName>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param _tokenReceivedCallback - The function that will get the call back once this API is completed (either successfully or with a failure).\r\n * @param {boolean} validateAuthority - boolean to turn authority validation on/off.\r\n */\r\n constructor(\r\n clientId: string,\r\n authority: string | null,\r\n tokenReceivedCallback: tokenReceivedCallback,\r\n options:\r\n {\r\n validateAuthority?: boolean,\r\n cacheLocation?: string,\r\n redirectUri?: string,\r\n postLogoutRedirectUri?: string,\r\n logger?: Logger,\r\n loadFrameTimeout?: number,\r\n navigateToLoginRequestUrl?: boolean,\r\n isAngular?: boolean,\r\n anonymousEndpoints?: Array\r\n endPoints?:Map>\r\n } = {}) {\r\n const {\r\n validateAuthority = true,\r\n cacheLocation = \"sessionStorage\",\r\n redirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n postLogoutRedirectUri = window.location.href.split(\"?\")[0].split(\"#\")[0],\r\n logger = new Logger(null),\r\n loadFrameTimeout = 6000,\r\n navigateToLoginRequestUrl = true,\r\n isAngular = false,\r\n anonymousEndpoints = new Array(),\r\n endPoints = new Map>(),\r\n } = options;\r\n\r\n this.loadFrameTimeout = loadFrameTimeout;\r\n this.clientId = clientId;\r\n this.validateAuthority = validateAuthority;\r\n this.authority = authority || \"https://login.microsoftonline.com/common\";\r\n this._tokenReceivedCallback = tokenReceivedCallback;\r\n this._redirectUri = redirectUri;\r\n this._postLogoutredirectUri = postLogoutRedirectUri;\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n this._cacheLocation = cacheLocation;\r\n this._navigateToLoginRequestUrl = navigateToLoginRequestUrl;\r\n this._isAngular = isAngular;\r\n this._anonymousEndpoints = anonymousEndpoints;\r\n this._endpoints = endPoints;\r\n if (!this._cacheLocations[cacheLocation]) {\r\n throw new Error(\"Cache Location is not valid. Provided value:\" + this._cacheLocation + \".Possible values are: \" + this._cacheLocations.localStorage + \", \" + this._cacheLocations.sessionStorage);\r\n }\r\n\r\n this._cacheStorage = new Storage(this._cacheLocation); //cache keys msal\r\n this._logger = logger;\r\n window.openedWindows = [];\r\n window.activeRenewals = {};\r\n window.renewStates = [];\r\n window.callBackMappedToRenewStates = { };\r\n window.callBacksMappedToRenewStates = { };\r\n window.msal = this;\r\n var urlHash = window.location.hash;\r\n var isCallback = this.isCallback(urlHash);\r\n\r\n if (!this._isAngular) {\r\n if (isCallback) {\r\n this.handleAuthenticationResponse.call(this, urlHash);\r\n }\r\n else {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback) {\r\n this.processCallBack(pendingCallback);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * Used to call the constructor callback with the token/error\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private processCallBack(hash: string): void {\r\n this._logger.info('Processing the callback from redirect response');\r\n const requestInfo = this.getRequestInfo(hash);\r\n this.saveTokenFromHash(requestInfo);\r\n const token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n const errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n const error = requestInfo.parameters[Constants.error];\r\n var tokenType: string;\r\n\r\n if (requestInfo.parameters[Constants.accessToken]) {\r\n tokenType = Constants.accessToken;\r\n }\r\n else {\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n this._cacheStorage.removeItem(Constants.urlHash);\r\n\r\n try {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n this._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n }\r\n\r\n \r\n /*\r\n * Initiate the login process by redirecting the user to the STS authorization endpoint.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the authentication server during the interactive authentication flow.\r\n */\r\n loginRedirect(scopes?: Array, extraQueryParameters?: string): void {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n if (this._loginInProgress) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.loginProgressError, null, ErrorCodes.loginProgressError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.idToken);\r\n return;\r\n }\r\n }\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n this._loginInProgress = true;\r\n \r\n this.authorityInstance.ResolveEndpointsAsync()\r\n .then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n var loginStartPage = this._cacheStorage.getItem(Constants.angularLoginRequest);\r\n if (!loginStartPage || loginStartPage === \"\") {\r\n loginStartPage = window.location.href;\r\n }\r\n else {\r\n this._cacheStorage.setItem(Constants.angularLoginRequest, \"\")\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, loginStartPage);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n this.promptUser(urlNavigate);\r\n });\r\n }\r\n\r\n /*\r\n * Initiate the login process by opening a popup window.\r\n * @param {Array.} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the interactive authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n loginPopup(scopes: Array, extraQueryParameters?: string): Promise {\r\n /*\r\n 1. Create navigate url\r\n 2. saves value in cache\r\n 3. redirect user to AAD\r\n */\r\n return new Promise((resolve, reject) => {\r\n if (this._loginInProgress) {\r\n reject(ErrorCodes.loginProgressError + \"|\" + ErrorDescription.loginProgressError);\r\n return;\r\n }\r\n\r\n if (scopes) {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + ErrorDescription.inputScopesError);\r\n return;\r\n }\r\n\r\n scopes = this.filterScopes(scopes);\r\n }\r\n else {\r\n scopes = [this.clientId];\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n \r\n this._loginInProgress = true;\r\n\r\n this.authorityInstance.ResolveEndpointsAsync().then(() => {\r\n const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.loginRequest, window.location.href);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, this.authority);\r\n }\r\n\r\n const urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.login;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n this._logger.infoPii(\"Navigated Popup window to:\" + urlNavigate);\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n }\r\n\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to redirect the browser to the STS authorization endpoint\r\n * @param {string} urlNavigate - URL of the authorization endpoint\r\n * @hidden\r\n */\r\n private promptUser(urlNavigate: string) {\r\n if (urlNavigate && !Utils.isEmpty(urlNavigate)) {\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n window.location.replace(urlNavigate);\r\n } else {\r\n this._logger.info(\"Navigate url is empty\");\r\n }\r\n }\r\n\r\n /*\r\n * Used to send the user to the redirect_uri after authentication is complete. The user\"s bearer token is attached to the URI fragment as an id_token/access_token field.\r\n * This function also closes the popup window after redirection.\r\n * @hidden\r\n * @ignore\r\n */\r\n private openWindow(urlNavigate: string, title: string, interval: number, instance: this, resolve?: Function, reject?: Function): Window {\r\n var popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight);\r\n if (popupWindow == null) {\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(ErrorCodes.popUpWindowError + \":\" + ErrorDescription.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.popUpWindowError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.popUpWindowError);\r\n if (reject) {\r\n reject(ErrorCodes.popUpWindowError + \"|\" + ErrorDescription.popUpWindowError);\r\n }\r\n return null;\r\n }\r\n\r\n window.openedWindows.push(popupWindow);\r\n var pollTimer = window.setInterval(() => {\r\n if (popupWindow && popupWindow.closed && instance._loginInProgress) {\r\n if (reject) {\r\n reject(ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n }\r\n window.clearInterval(pollTimer);\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpClosed', ErrorCodes.userCancelledError + \"|\" + ErrorDescription.userCancelledError);\r\n return;\r\n }\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n }\r\n\r\n try {\r\n var popUpWindowLocation = popupWindow.location;\r\n if (popUpWindowLocation.href.indexOf(this._redirectUri) !== -1) {\r\n window.clearInterval(pollTimer);\r\n instance._loginInProgress = false;\r\n instance._acquireTokenInProgress = false;\r\n this._logger.info(\"Closing popup window\");\r\n if (this._isAngular) {\r\n this.broadcast('msal:popUpHashChanged', popUpWindowLocation.hash);\r\n for (var i = 0; i < window.openedWindows.length; i++) {\r\n window.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n } catch (e) {\r\n //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app\"s root page with the token. No need to log or throw this error as it will create unnecessary traffic.\r\n }\r\n },\r\n interval);\r\n\r\n return popupWindow;\r\n }\r\n\r\n private broadcast(eventName: string, data: string) {\r\n var evt = new CustomEvent(eventName, { detail: data });\r\n window.dispatchEvent(evt);\r\n }\r\n\r\n /*\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Defaults behaviour is to redirect the user to `window.location.href`.\r\n */\r\n logout(): void {\r\n this.clearCache();\r\n this._user = null;\r\n let logout = \"\";\r\n if (this._postLogoutredirectUri) {\r\n logout = \"post_logout_redirect_uri=\" + encodeURIComponent(this._postLogoutredirectUri);\r\n }\r\n\r\n const urlNavigate = this.authority + \"/oauth2/v2.0/logout?\" + logout;\r\n this.promptUser(urlNavigate);\r\n }\r\n\r\n /*\r\n * Used to configure the popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected clearCache(): void {\r\n window.renewStates = [];\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenItems.length; i++) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[i].key));\r\n }\r\n this._cacheStorage.resetCacheItems();\r\n }\r\n\r\n clearCacheForScope(accessToken: string) {\r\n const accessTokenItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (var i = 0; i < accessTokenItems.length; i++){\r\n var token = accessTokenItems[i];\r\n if (token.value.accessToken == accessToken) {\r\n this._cacheStorage.removeItem(JSON.stringify(token.key));\r\n }\r\n }\r\n }\r\n /*\r\n * Configures popup window for login.\r\n * @ignore\r\n * @hidden\r\n */\r\n private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) {\r\n try {\r\n /*\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n const winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /*\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n const height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n const left = ((width / 2) - (popUpWidth / 2)) + winLeft;\r\n const top = ((height / 2) - (popUpHeight / 2)) + winTop;\r\n\r\n const popupWindow = window.open(urlNavigate, title, \"width=\" + popUpWidth + \", height=\" + popUpHeight + \", top=\" + top + \", left=\" + left);\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n\r\n return popupWindow;\r\n } catch (e) {\r\n this._logger.error(\"error opening popup \" + e.message);\r\n this._loginInProgress = false;\r\n this._acquireTokenInProgress = false;\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} scopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @ignore\r\n * @hidden\r\n */\r\n private validateInputScope(scopes: Array): string {\r\n if (!scopes || scopes.length < 1) {\r\n return \"Scopes cannot be passed as an empty array\";\r\n }\r\n\r\n if (!Array.isArray(scopes)) {\r\n throw new Error(\"API does not accept non-array scopes\");\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n if (scopes.length > 1) {\r\n return \"ClientId can only be provided as a single scope\";\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Used to remove openid and profile from the list of scopes passed by the developer.These scopes are added by default\r\n * @hidden\r\n */\r\n private filterScopes(scopes: Array): Array {\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"openid\";\r\n });\r\n\r\n scopes = scopes.filter(function (element) {\r\n return element !== \"profile\";\r\n });\r\n\r\n return scopes;\r\n }\r\n /*\r\n * Used to add the developer requested callback to the array of callbacks for the specified scopes. The updated array is stored on the window object\r\n * @param {string} scope - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {string} expectedState - Unique state identifier (guid).\r\n * @param {Function} resolve - The resolve function of the promise object.\r\n * @param {Function} reject - The reject function of the promise object.\r\n * @ignore\r\n * @hidden\r\n */\r\n private registerCallback(expectedState: string, scope: string, resolve: Function, reject: Function): void {\r\n window.activeRenewals[scope] = expectedState;\r\n if (!window.callBacksMappedToRenewStates[expectedState]) {\r\n window.callBacksMappedToRenewStates[expectedState] = [];\r\n }\r\n window.callBacksMappedToRenewStates[expectedState].push({ resolve: resolve, reject: reject });\r\n if (!window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState] =\r\n (errorDesc: string, token: string, error: string, tokenType: string) => {\r\n window.activeRenewals[scope] = null;\r\n for (let i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) {\r\n try {\r\n if (errorDesc || error) {\r\n window.callBacksMappedToRenewStates[expectedState][i].reject(errorDesc + \"|\" + error);\r\n }\r\n else if (token) {\r\n window.callBacksMappedToRenewStates[expectedState][i].resolve(token);\r\n }\r\n } catch (e) {\r\n this._logger.warning(e);\r\n }\r\n }\r\n window.callBacksMappedToRenewStates[expectedState] = null;\r\n window.callBackMappedToRenewStates[expectedState] = null;\r\n };\r\n }\r\n }\r\n\r\n\r\nprotected getCachedTokenInternal(scopes : Array , user: User): CacheResult\r\n{\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n return;\r\n }\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = this.authorityInstance?this.authorityInstance: AuthorityFactory.CreateInstance(this.authority, this.validateAuthority);\r\n\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n return this.getCachedToken(authenticationRequest, user);\r\n}\r\n\r\n /*\r\n * Used to get token for the specified set of scopes from the cache\r\n * @param {AuthenticationRequestParameters} authenticationRequest - Request sent to the STS to obtain an id_token/access_token\r\n * @param {User} user - User for which the scopes were requested\r\n * @hidden\r\n */\r\n private getCachedToken(authenticationRequest: AuthenticationRequestParameters, user: User): CacheResult {\r\n let accessTokenCacheItem: AccessTokenCacheItem = null;\r\n const scopes = authenticationRequest.scopes;\r\n const tokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, user ? user.userIdentifier:null); //filter by clientId and user\r\n if (tokenCacheItems.length === 0) { // No match found after initial filtering\r\n return null;\r\n }\r\n\r\n const filteredItems: Array = [];\r\n //if no authority passed\r\n if (!authenticationRequest.authority) {\r\n //filter by scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes)) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //if only one cached token found\r\n if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(accessTokenCacheItem.key.authority, this.validateAuthority);\r\n }\r\n else if (filteredItems.length > 1) {\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n else {\r\n //no match found. check if there was a single authority used\r\n const authorityList = this.getUniqueAuthority(tokenCacheItems, \"authority\");\r\n if (authorityList.length > 1) {\r\n return {\r\n errorDesc: \"Multiple authorities found in the cache. Pass authority in the API overload.\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n\r\n authenticationRequest.authorityInstance = AuthorityFactory.CreateInstance(authorityList[0], this.validateAuthority);\r\n }\r\n }\r\n else {\r\n //authority was passed in the API, filter by authority and scope\r\n for (let i = 0; i < tokenCacheItems.length; i++) {\r\n const cacheItem = tokenCacheItems[i];\r\n const cachedScopes = cacheItem.key.scopes.split(\" \");\r\n if (Utils.containsScope(cachedScopes, scopes) && cacheItem.key.authority === authenticationRequest.authority) {\r\n filteredItems.push(cacheItem);\r\n }\r\n }\r\n\r\n //no match\r\n if (filteredItems.length === 0) {\r\n return null;\r\n }\r\n //only one cachedToken Found\r\n else if (filteredItems.length === 1) {\r\n accessTokenCacheItem = filteredItems[0];\r\n }\r\n else {\r\n //more than one match found.\r\n return {\r\n errorDesc: \"The cache contains multiple tokens satisfying the requirements.Call AcquireToken again providing more requirements like authority\",\r\n token: null,\r\n error: \"multiple_matching_tokens_detected\"\r\n };\r\n }\r\n }\r\n\r\n if (accessTokenCacheItem != null) {\r\n const expired = Number(accessTokenCacheItem.value.expiresIn);\r\n // If expiration is within offset, it will force renew\r\n const offset = this._clockSkew || 300;\r\n if (expired && (expired > Utils.now() + offset)) {\r\n return {\r\n errorDesc: null,\r\n token: accessTokenCacheItem.value.accessToken,\r\n error: null\r\n };\r\n } else {\r\n this._cacheStorage.removeItem(JSON.stringify(filteredItems[0].key));\r\n return null;\r\n }\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n /*\r\n * Used to filter all cached items and return a list of unique users based on userIdentifier.\r\n * @param {Array} Users - users saved in the cache.\r\n */\r\n getAllUsers(): Array {\r\n const users: Array = [];\r\n const accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(Constants.clientId, Constants.userIdentifier);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const idToken = new IdToken(accessTokenCacheItems[i].value.idToken);\r\n const clientInfo = new ClientInfo(accessTokenCacheItems[i].value.clientInfo);\r\n const user = User.createUser(idToken, clientInfo, this.authority);\r\n users.push(user);\r\n }\r\n\r\n return this.getUniqueUsers(users);\r\n }\r\n\r\n /*\r\n * Used to filter users based on userIdentifier\r\n * @param {Array} Users - users saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueUsers(users: Array): Array {\r\n if (!users || users.length <= 1) {\r\n return users;\r\n }\r\n\r\n const flags: Array = [];\r\n const uniqueUsers: Array = [];\r\n for (let index = 0; index < users.length; ++index) {\r\n if (users[index].userIdentifier && flags.indexOf(users[index].userIdentifier) === -1) {\r\n flags.push(users[index].userIdentifier);\r\n uniqueUsers.push(users[index]);\r\n }\r\n }\r\n\r\n return uniqueUsers;\r\n }\r\n\r\n /*\r\n * Used to get a unique list of authoritues from the cache\r\n * @param {Array} accessTokenCacheItems - accessTokenCacheItems saved in the cache\r\n * @ignore\r\n * @hidden\r\n */\r\n private getUniqueAuthority(accessTokenCacheItems: Array, property: string): Array {\r\n const authorityList: Array = [];\r\n const flags: Array = [];\r\n accessTokenCacheItems.forEach(element => {\r\n if (element.key.hasOwnProperty(property) && (flags.indexOf(element.key[property]) === -1)) {\r\n flags.push(element.key[property]);\r\n authorityList.push(element.key[property]);\r\n }\r\n });\r\n return authorityList;\r\n }\r\n\r\n /*\r\n * Adds login_hint to authorization URL which is used to pre-fill the username field of sign in page for the user if known ahead of time\r\n * domain_hint can be one of users/organisations which when added skips the email based discovery process of the user\r\n * domain_req utid received as part of the clientInfo\r\n * login_req uid received as part of clientInfo\r\n * @param {string} urlNavigate - Authentication request url\r\n * @param {User} user - User for which the token is requested\r\n * @ignore\r\n * @hidden\r\n */\r\n private addHintParameters(urlNavigate: string, user: User): string {\r\n const userObject = user ? user : this.getUser();\r\n const decodedClientInfo = userObject.userIdentifier.split(\".\");\r\n const uid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[0]);\r\n const utid = Utils.base64DecodeStringUrlSafe(decodedClientInfo[1]);\r\n if (!this.urlContainsQueryStringParameter(\"login_hint\", urlNavigate) && userObject.displayableId && !Utils.isEmpty(userObject.displayableId)) {\r\n urlNavigate += \"&login_hint=\" + encodeURIComponent(user.displayableId);\r\n }\r\n\r\n if (!Utils.isEmpty(uid) && !Utils.isEmpty(utid)) {\r\n if (!this.urlContainsQueryStringParameter(\"domain_req\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n urlNavigate += \"&domain_req=\" + encodeURIComponent(utid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"login_req\", urlNavigate) && !Utils.isEmpty(uid)) {\r\n urlNavigate += \"&login_req=\" + encodeURIComponent(uid);\r\n }\r\n\r\n if (!this.urlContainsQueryStringParameter(\"domain_hint\", urlNavigate) && !Utils.isEmpty(utid)) {\r\n if (utid === \"9188040d-6c67-4c5b-b112-36a304b66dad\") {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"consumers\");\r\n } else {\r\n urlNavigate += \"&domain_hint=\" + encodeURIComponent(\"organizations\");\r\n }\r\n }\r\n }\r\n\r\n return urlNavigate;\r\n }\r\n\r\n /*\r\n * Checks if the authorization endpoint URL contains query string parameters\r\n * @ignore\r\n * @hidden\r\n */\r\n private urlContainsQueryStringParameter(name: string, url: string): boolean {\r\n // regex to detect pattern of a ? or & followed by the name parameter and an equals character\r\n const regex = new RegExp(\"[\\\\?&]\" + name + \"=\");\r\n return regex.test(url);\r\n }\r\n\r\n /*\r\n * Used to obtain an access_token by redirecting the user to the authorization endpoint.\r\n * To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://{instance}/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://{instance}/tfp/<tenant>/\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n */\r\n acquireTokenRedirect(scopes: Array): void;\r\n acquireTokenRedirect(scopes: Array, authority: string): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User): void;\r\n acquireTokenRedirect(scopes: Array, authority: string, user: User, extraQueryParameters: string): void;\r\n acquireTokenRedirect(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): void {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.inputScopesError, null, ErrorCodes.inputScopesError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n if (this._tokenReceivedCallback) {\r\n this._tokenReceivedCallback(ErrorDescription.userLoginError, null, ErrorCodes.userLoginError, Constants.accessToken);\r\n return;\r\n }\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n if (urlNavigate) {\r\n this._cacheStorage.setItem(Constants.stateAcquireToken, authenticationRequest.state);\r\n window.location.replace(urlNavigate);\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Used to acquire an access token for a new user using interactive authentication via a popup Window.\r\n * To request an id_token, pass the clientId as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\".\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.\r\n */\r\n acquireTokenPopup(scopes: Array): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User): Promise;\r\n acquireTokenPopup(scopes: Array, authority: string, user: User, extraQueryParameters: string): Promise;\r\n acquireTokenPopup(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n }\r\n\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const userObject = user ? user : this.getUser();\r\n if (this._acquireTokenInProgress) {\r\n reject(ErrorCodes.acquireTokenProgressError + \"|\" + ErrorDescription.acquireTokenProgressError);\r\n return;\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n this._acquireTokenInProgress = true;\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let acquireTokenAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n var popUpWindow = this.openWindow(\"about:blank\", \"_blank\", 1, this, resolve, reject);\r\n if (!popUpWindow) {\r\n return;\r\n }\r\n\r\n acquireTokenAuthority.ResolveEndpointsAsync().then(() => {\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n authenticationRequest.state = authenticationRequest.state;\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userObject.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(userObject));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, acquireTokenAuthority.CanonicalAuthority);\r\n }\r\n\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=select_account\" + \"&response_mode=fragment\";\r\n urlNavigate = this.addHintParameters(urlNavigate, userObject);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n if (popUpWindow) {\r\n popUpWindow.location.href = urlNavigate;\r\n }\r\n\r\n }, () => {\r\n this._logger.info(ErrorCodes.endpointResolutionError + \":\" + ErrorDescription.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalError, ErrorCodes.endpointResolutionError);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, ErrorDescription.endpointResolutionError);\r\n if (reject) {\r\n reject(ErrorCodes.endpointResolutionError + \"|\" + ErrorDescription.endpointResolutionError);\r\n }\r\n if (popUpWindow) {\r\n popUpWindow.close();\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n });\r\n }\r\n\r\n /*\r\n * Used to get the token from cache.\r\n * MSAL will return the cached token if it is not expired.\r\n * Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.\r\n * @param {Array} scopes - Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like \"openid\" and \"profile\" are sent with every request.\r\n * @param {string} authority - A URL indicating a directory that MSAL can use to obtain tokens.\r\n * - In Azure AD, it is of the form https://<tenant>/<tenant>, where <tenant> is the directory host (e.g. https://login.microsoftonline.com) and <tenant> is a identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)\r\n * - In Azure B2C, it is of the form https://<instance>/tfp/<tenant>//\r\n * - Default value is: \"https://login.microsoftonline.com/common\"\r\n * @param {User} user - The user for which the scopes are requested.The default user is the logged in user.\r\n * @param {string} extraQueryParameters - Key-value pairs to pass to the STS during the authentication flow.\r\n * @returns {Promise.} - A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.\r\n */\r\n @resolveTokenOnlyIfOutOfIframe\r\n acquireTokenSilent(scopes: Array, authority?: string, user?: User, extraQueryParameters?: string): Promise {\r\n return new Promise((resolve, reject) => {\r\n const isValidScope = this.validateInputScope(scopes);\r\n if (isValidScope && !Utils.isEmpty(isValidScope)) {\r\n reject(ErrorCodes.inputScopesError + \"|\" + isValidScope);\r\n } else {\r\n if (scopes) {\r\n scopes = this.filterScopes(scopes);\r\n }\r\n\r\n const scope = scopes.join(\" \").toLowerCase();\r\n const userObject = user ? user : this.getUser();\r\n if (!userObject) {\r\n reject(ErrorCodes.userLoginError + \"|\" + ErrorDescription.userLoginError);\r\n return;\r\n }\r\n\r\n let authenticationRequest: AuthenticationRequestParameters;\r\n let newAuthority = authority ? AuthorityFactory.CreateInstance(authority, this.validateAuthority) : this.authorityInstance;\r\n if (Utils.compareObjects(userObject, this.getUser())) {\r\n if (scopes.indexOf(this.clientId) > -1) {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri);\r\n }\r\n\r\n const cacheResult = this.getCachedToken(authenticationRequest, userObject);\r\n if (cacheResult) {\r\n if (cacheResult.token) {\r\n this._logger.info(\"Token is already in cache for scope:\" + scope);\r\n resolve(cacheResult.token);\r\n return;\r\n }\r\n else if (cacheResult.errorDesc || cacheResult.error) {\r\n this._logger.infoPii(cacheResult.errorDesc + \":\" + cacheResult.error);\r\n reject(cacheResult.errorDesc + \"|\" + cacheResult.error);\r\n return;\r\n }\r\n }\r\n else {\r\n this._logger.verbose(\"Token is not in cache for scope:\" + scope);\r\n }\r\n // cache miss\r\n return newAuthority.ResolveEndpointsAsync()\r\n .then(() => {\r\n // refresh attept with iframe\r\n //Already renewing for this scope, callback when we get the token.\r\n if (window.activeRenewals[scope]) {\r\n this._logger.verbose(\"Renew token for scope: \" + scope + \" is in progress. Registering callback\");\r\n //Active renewals contains the state for each renewal.\r\n this.registerCallback(window.activeRenewals[scope], scope, resolve, reject);\r\n }\r\n else {\r\n if (scopes && scopes.indexOf(this.clientId) > -1 && scopes.length === 1) {\r\n // App uses idToken to send to api endpoints\r\n // Default scope is tracked as clientId to store this token\r\n this._logger.verbose(\"renewing idToken\");\r\n this.renewIdToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n } else {\r\n this._logger.verbose(\"renewing accesstoken\");\r\n this.renewToken(scopes, resolve, reject, userObject, authenticationRequest, extraQueryParameters);\r\n }\r\n }\r\n }).catch((err) => {\r\n this._logger.warning(\"could not resolve endpoints\");\r\n reject(err);\r\n });\r\n }\r\n });\r\n }\r\n\r\n /*\r\n * Calling _loadFrame but with a timeout to signal failure in loadframeStatus. Callbacks are left.\r\n * registered when network errors occur and subsequent token requests for same resource are registered to the pending request.\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadIframeTimeout(urlNavigate: string, frameName: string, scope: string): void {\r\n //set iframe session to pending\r\n const expectedState = window.activeRenewals[scope];\r\n this._logger.verbose(\"Set loading state to pending for: \" + scope + \":\" + expectedState);\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusInProgress);\r\n this.loadFrame(urlNavigate, frameName);\r\n setTimeout(() => {\r\n if (this._cacheStorage.getItem(Constants.renewStatus + expectedState) === Constants.tokenRenewStatusInProgress) {\r\n // fail the iframe session if it\"s in pending state\r\n this._logger.verbose(\"Loading frame has timed out after: \" + (this.loadFrameTimeout / 1000) + \" seconds for scope \" + scope + \":\" + expectedState);\r\n if (expectedState && window.callBackMappedToRenewStates[expectedState]) {\r\n window.callBackMappedToRenewStates[expectedState](\"Token renewal operation failed due to timeout\", null, \"Token Renewal Failed\", Constants.accessToken);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.renewStatus + expectedState, Constants.tokenRenewStatusCancelled);\r\n }\r\n }, this.loadFrameTimeout);\r\n }\r\n\r\n /*\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private loadFrame(urlNavigate: string, frameName: string): void {\r\n // This trick overcomes iframe navigation in IE\r\n // IE does not load the page consistently in iframe\r\n this._logger.info(\"LoadFrame: \" + frameName);\r\n var frameCheck = frameName;\r\n setTimeout(() => {\r\n var frameHandle = this.addAdalFrame(frameCheck);\r\n if (frameHandle.src === \"\" || frameHandle.src === \"about:blank\") {\r\n frameHandle.src = urlNavigate;\r\n this._logger.infoPii(\"Frame Name : \" + frameName + \" Navigated to: \" + urlNavigate);\r\n }\r\n },\r\n 500);\r\n }\r\n\r\n /*\r\n * Adds the hidden iframe for silent token renewal.\r\n * @ignore\r\n * @hidden\r\n */\r\n private addAdalFrame(iframeId: string): HTMLIFrameElement {\r\n if (typeof iframeId === \"undefined\") {\r\n return null;\r\n }\r\n\r\n this._logger.info(\"Add msal frame to document:\" + iframeId);\r\n let adalFrame = document.getElementById(iframeId) as HTMLIFrameElement;\r\n if (!adalFrame) {\r\n if (document.createElement &&\r\n document.documentElement &&\r\n (window.navigator.userAgent.indexOf(\"MSIE 5.0\") === -1)) {\r\n const ifr = document.createElement(\"iframe\");\r\n ifr.setAttribute(\"id\", iframeId);\r\n ifr.style.visibility = \"hidden\";\r\n ifr.style.position = \"absolute\";\r\n ifr.style.width = ifr.style.height = \"0\";\r\n ifr.style.border = \"0\";\r\n adalFrame = (document.getElementsByTagName(\"body\")[0].appendChild(ifr) as HTMLIFrameElement);\r\n } else if (document.body && document.body.insertAdjacentHTML) {\r\n document.body.insertAdjacentHTML('beforeend', '');\r\n }\r\n\r\n if (window.frames && window.frames[iframeId]) {\r\n adalFrame = window.frames[iframeId];\r\n }\r\n }\r\n\r\n return adalFrame;\r\n }\r\n\r\n /*\r\n * Acquires access token using a hidden iframe.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.verbose(\"renewToken is called for scope:\" + scope);\r\n const frameHandle = this.addAdalFrame(\"msalRenewFrame\" + scope);\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n // renew happens in iframe, so it keeps javascript context\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew token Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, scope, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalRenewFrame\" + scope, scope);\r\n }\r\n\r\n /*\r\n * Renews idtoken for app\"s own backend when clientId is passed as a single scope in the scopes array.\r\n * @ignore\r\n * @hidden\r\n */\r\n private renewIdToken(scopes: Array, resolve: Function, reject: Function, user: User, authenticationRequest: AuthenticationRequestParameters, extraQueryParameters?: string): void {\r\n const scope = scopes.join(\" \").toLowerCase();\r\n this._logger.info(\"renewidToken is called\");\r\n const frameHandle = this.addAdalFrame(\"msalIdTokenFrame\");\r\n if (extraQueryParameters) {\r\n authenticationRequest.extraQueryParameters = extraQueryParameters;\r\n }\r\n\r\n const acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n this._cacheStorage.setItem(acquireTokenUserKey, JSON.stringify(user));\r\n }\r\n\r\n const authorityKey = Constants.authority + Constants.resourceDelimeter + authenticationRequest.state;\r\n if (Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n this._cacheStorage.setItem(authorityKey, authenticationRequest.authority);\r\n }\r\n\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce);\r\n this._logger.verbose(\"Renew Idtoken Expected state: \" + authenticationRequest.state);\r\n let urlNavigate = authenticationRequest.createNavigateUrl(scopes) + \"&prompt=none\";\r\n urlNavigate = this.addHintParameters(urlNavigate, user);\r\n window.renewStates.push(authenticationRequest.state);\r\n window.requestType = Constants.renewToken;\r\n this.registerCallback(authenticationRequest.state, this.clientId, resolve, reject);\r\n this._logger.infoPii(\"Navigate to:\" + urlNavigate);\r\n frameHandle.src = \"about:blank\";\r\n this.loadIframeTimeout(urlNavigate, \"msalIdTokenFrame\", this.clientId);\r\n }\r\n\r\n /*\r\n * Returns the signed in user (received from a user object created at the time of login) or null.\r\n */\r\n getUser(): User {\r\n // idToken is first call\r\n if (this._user) {\r\n return this._user;\r\n }\r\n\r\n // frame is used to get idToken\r\n const rawIdToken = this._cacheStorage.getItem(Constants.idTokenKey);\r\n const rawClientInfo = this._cacheStorage.getItem(Constants.msalClientInfo);\r\n if (!Utils.isEmpty(rawIdToken) && !Utils.isEmpty(rawClientInfo)) {\r\n const idToken = new IdToken(rawIdToken);\r\n const clientInfo = new ClientInfo(rawClientInfo);\r\n this._user = User.createUser(idToken, clientInfo, this.authority);\r\n return this._user;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from the STS. It extracts the hash, processes the token or error information and saves it in the cache. It then\r\n * calls the registered callbacks in case of redirect or resolves the promises with the result.\r\n * @param {string} [hash=window.location.hash] - Hash fragment of Url.\r\n * @hidden\r\n */\r\n private handleAuthenticationResponse(hash: string): void {\r\n if (hash == null) {\r\n hash = window.location.hash;\r\n }\r\n\r\n var self = null;\r\n var isPopup: boolean = false;\r\n var isWindowOpenerMsal = false;\r\n\r\n try {\r\n isWindowOpenerMsal = window.opener && window.opener.msal && window.opener.msal !== window.msal;\r\n } catch (err) {\r\n // err = SecurityError: Blocked a frame with origin \"[url]\" from accessing a cross-origin frame.\r\n isWindowOpenerMsal = false;\r\n }\r\n\r\n if (isWindowOpenerMsal) {\r\n self = window.opener.msal;\r\n isPopup = true;\r\n }\r\n else if (window.parent && window.parent.msal) {\r\n self = window.parent.msal;\r\n }\r\n\r\n const requestInfo = self.getRequestInfo(hash);//if(window.parent!==window), by using self, window.parent becomes equal to window in getRequestInfo method specifically\r\n let token: string = null, tokenReceivedCallback: (errorDesc: string, token: string, error: string, tokenType: string) => void = null, tokenType: string, saveToken:boolean = true;\r\n \r\n self._logger.info(\"Returned from redirect url\");\r\n \r\n if (window.parent !== window && window.parent.msal) {\r\n tokenReceivedCallback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else if (isWindowOpenerMsal) {\r\n tokenReceivedCallback = window.opener.callBackMappedToRenewStates[requestInfo.stateResponse];\r\n }\r\n else {\r\n if (self._navigateToLoginRequestUrl) {\r\n tokenReceivedCallback = null;\r\n self._cacheStorage.setItem(Constants.urlHash, hash);\r\n saveToken = false;\r\n if (window.parent === window && !isPopup) {\r\n window.location.href = self._cacheStorage.getItem(Constants.loginRequest);\r\n }\r\n return;\r\n }\r\n else {\r\n tokenReceivedCallback = self._tokenReceivedCallback;\r\n window.location.hash = '';\r\n }\r\n\r\n }\r\n\r\n self.saveTokenFromHash(requestInfo);\r\n\r\n if ((requestInfo.requestType === Constants.renewToken) && window.parent) {\r\n if (window.parent!==window) {\r\n self._logger.verbose(\"Window is in iframe, acquiring token silently\");\r\n } else {\r\n self._logger.verbose(\"acquiring token interactive in progress\");\r\n }\r\n\r\n token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.accessToken;\r\n } else if (requestInfo.requestType === Constants.login) {\r\n token = requestInfo.parameters[Constants.idToken];\r\n tokenType = Constants.idToken;\r\n }\r\n\r\n var errorDesc = requestInfo.parameters[Constants.errorDescription];\r\n var error = requestInfo.parameters[Constants.error];\r\n \r\n try {\r\n if (tokenReceivedCallback) {\r\n tokenReceivedCallback.call(self, errorDesc, token, error, tokenType);\r\n }\r\n\r\n } catch (err) {\r\n self._logger.error(\"Error occurred in token received callback function: \" + err);\r\n }\r\n if (isWindowOpenerMsal) {\r\n for (var i = 0; i < window.opener.openedWindows.length; i++) {\r\n window.opener.openedWindows[i].close();\r\n }\r\n }\r\n }\r\n\r\n /*\r\n * This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the registered callbacks with the result.\r\n * @param {string} authority authority received in the redirect response from AAD.\r\n * @param {TokenResponse} requestInfo an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @param {User} user user object for which scopes are consented for. The default user is the logged in user.\r\n * @param {ClientInfo} clientInfo clientInfo received as part of the response comprising of fields uid and utid.\r\n * @param {IdToken} idToken idToken received as part of the response.\r\n * @ignore\r\n * @private\r\n * @hidden\r\n */\r\n private saveAccessToken(authority: string, tokenResponse: TokenResponse, user: User, clientInfo: string, idToken: IdToken): void {\r\n let scope: string;\r\n let clientObj: ClientInfo = new ClientInfo(clientInfo);\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"];\r\n const consentedScopes = scope.split(\" \");\r\n const accessTokenCacheItems =\r\n this._cacheStorage.getAllAccessTokens(this.clientId, authority);\r\n for (let i = 0; i < accessTokenCacheItems.length; i++) {\r\n const accessTokenCacheItem = accessTokenCacheItems[i];\r\n if (accessTokenCacheItem.key.userIdentifier === user.userIdentifier) {\r\n const cachedScopes = accessTokenCacheItem.key.scopes.split(\" \");\r\n if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) {\r\n this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key));\r\n }\r\n }\r\n }\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.accessToken], idToken.rawIdToken, Utils.expiresIn(tokenResponse.parameters[Constants.expiresIn]).toString(), clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n } else {\r\n scope = this.clientId;\r\n const accessTokenKey = new AccessTokenKey(authority, this.clientId, scope, clientObj.uid, clientObj.utid);\r\n const accessTokenValue = new AccessTokenValue(tokenResponse.parameters[Constants.idToken], tokenResponse.parameters[Constants.idToken], idToken.expiration, clientInfo);\r\n this._cacheStorage.setItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue));\r\n }\r\n }\r\n\r\n /*\r\n * Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the user object.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected saveTokenFromHash(tokenResponse: TokenResponse): void {\r\n this._logger.info(\"State status:\" + tokenResponse.stateMatch + \"; Request type:\" + tokenResponse.requestType);\r\n this._cacheStorage.setItem(Constants.msalError, \"\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"\");\r\n var scope: string = \"\";\r\n var authorityKey: string = \"\";\r\n var acquireTokenUserKey: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(\"scope\")) {\r\n scope = tokenResponse.parameters[\"scope\"].toLowerCase();\r\n }\r\n else {\r\n scope = this.clientId;\r\n }\r\n\r\n // Record error\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.errorDescription) || tokenResponse.parameters.hasOwnProperty(Constants.error)) {\r\n this._logger.infoPii(\"Error :\" + tokenResponse.parameters[Constants.error] + \"; Error description:\" + tokenResponse.parameters[Constants.errorDescription]);\r\n this._cacheStorage.setItem(Constants.msalError, tokenResponse.parameters[\"error\"]);\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, tokenResponse.parameters[Constants.errorDescription]);\r\n if (tokenResponse.requestType === Constants.login) {\r\n this._loginInProgress = false;\r\n this._cacheStorage.setItem(Constants.loginError, tokenResponse.parameters[Constants.errorDescription] + \":\" + tokenResponse.parameters[Constants.error]);\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n if (tokenResponse.requestType === Constants.renewToken) {\r\n this._acquireTokenInProgress = false;\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n var userKey = this.getUser() !== null ? this.getUser().userIdentifier : \"\";\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + userKey + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n }\r\n\r\n } else {\r\n // It must verify the state from redirect\r\n if (tokenResponse.stateMatch) {\r\n // record tokens to storage if exists\r\n this._logger.info(\"State is right\");\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.sessionState)) {\r\n this._cacheStorage.setItem(Constants.msalSessionState, tokenResponse.parameters[Constants.sessionState]);\r\n }\r\n \r\n var idToken: IdToken;\r\n var clientInfo: string = \"\";\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.accessToken)) {\r\n this._logger.info(\"Fragment has access token\");\r\n this._acquireTokenInProgress = false;\r\n let user: User;\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n } else {\r\n idToken = new IdToken(this._cacheStorage.getItem(Constants.idTokenKey));\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n }\r\n\r\n acquireTokenUserKey = Constants.acquireTokenUser + Constants.resourceDelimeter + user.userIdentifier + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let acquireTokenUser: User;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(acquireTokenUserKey))) {\r\n acquireTokenUser = JSON.parse(this._cacheStorage.getItem(acquireTokenUserKey));\r\n if (user && acquireTokenUser && Utils.compareObjects(user, acquireTokenUser)) {\r\n this.saveAccessToken(authority, tokenResponse, user, clientInfo, idToken);\r\n this._logger.info(\r\n \"The user object received in the response is the same as the one passed in the acquireToken request\");\r\n } else {\r\n this._logger.warning(\r\n \"The user object created from the response is not the same as the one passed in the acquireToken request\");\r\n }\r\n }\r\n }\r\n\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.idToken)) {\r\n if (scope.indexOf(this.clientId) > -1) {\r\n this._logger.info(\"Fragment has id token\");\r\n this._loginInProgress = false;\r\n idToken = new IdToken(tokenResponse.parameters[Constants.idToken]);\r\n if (tokenResponse.parameters.hasOwnProperty(Constants.clientInfo)) {\r\n clientInfo = tokenResponse.parameters[Constants.clientInfo];\r\n } else {\r\n this._logger.warning(\"ClientInfo not received in the response from AAD\");\r\n }\r\n\r\n authorityKey = Constants.authority + Constants.resourceDelimeter + tokenResponse.stateResponse;\r\n let authority: string;\r\n if (!Utils.isEmpty(this._cacheStorage.getItem(authorityKey))) {\r\n authority = this._cacheStorage.getItem(authorityKey);\r\n authority = Utils.replaceFirstPath(authority, idToken.tenantId);\r\n }\r\n\r\n this._user = User.createUser(idToken, new ClientInfo(clientInfo), authority);\r\n if (idToken && idToken.nonce) {\r\n if (idToken.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) {\r\n this._user = null;\r\n this._cacheStorage.setItem(Constants.loginError, \"Nonce Mismatch. Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n this._logger.error(\"Nonce Mismatch.Expected Nonce: \" + this._cacheStorage.getItem(Constants.nonceIdToken) + \",\" + \"Actual Nonce: \" + idToken.nonce);\r\n } else {\r\n this._cacheStorage.setItem(Constants.idTokenKey, tokenResponse.parameters[Constants.idToken]);\r\n this._cacheStorage.setItem(Constants.msalClientInfo, clientInfo);\r\n\r\n // Save idToken as access token for app itself\r\n this.saveAccessToken(authority, tokenResponse, this._user, clientInfo, idToken);\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"Invalid id_token received in the response\");\r\n tokenResponse.parameters['error'] = 'invalid idToken';\r\n tokenResponse.parameters['error_description'] = 'Invalid idToken. idToken: ' + tokenResponse.parameters[Constants.idToken];\r\n this._cacheStorage.setItem(Constants.msalError, \"invalid idToken\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid idToken. idToken: \" + tokenResponse.parameters[Constants.idToken]);\r\n }\r\n }\r\n }\r\n } else {\r\n authorityKey = tokenResponse.stateResponse;\r\n acquireTokenUserKey = tokenResponse.stateResponse;\r\n this._logger.error(\"State Mismatch.Expected State: \" + this._cacheStorage.getItem(Constants.stateLogin) + \",\" + \"Actual State: \" + tokenResponse.stateResponse);\r\n tokenResponse.parameters['error'] = 'Invalid_state';\r\n tokenResponse.parameters['error_description'] = 'Invalid_state. state: ' + tokenResponse.stateResponse;\r\n this._cacheStorage.setItem(Constants.msalError, \"Invalid_state\");\r\n this._cacheStorage.setItem(Constants.msalErrorDescription, \"Invalid_state. state: \" + tokenResponse.stateResponse);\r\n }\r\n }\r\n this._cacheStorage.setItem(Constants.renewStatus + tokenResponse.stateResponse, Constants.tokenRenewStatusCompleted);\r\n this._cacheStorage.removeAcquireTokenEntries(authorityKey, acquireTokenUserKey);\r\n }\r\n\r\n /*\r\n * Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.\r\n * @param {string} hash - Hash passed from redirect page.\r\n * @returns {Boolean} - true if response contains id_token, access_token or error, false otherwise.\r\n * @hidden\r\n */\r\n isCallback(hash: string): boolean {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n return (\r\n parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)\r\n\r\n );\r\n }\r\n\r\n /*\r\n * Returns the anchor part(#) of the URL\r\n * @ignore\r\n * @hidden\r\n */\r\n private getHash(hash: string): string {\r\n if (hash.indexOf(\"#/\") > -1) {\r\n hash = hash.substring(hash.indexOf(\"#/\") + 2);\r\n } else if (hash.indexOf(\"#\") > -1) {\r\n hash = hash.substring(1);\r\n }\r\n\r\n return hash;\r\n }\r\n\r\n /*\r\n * Creates a requestInfo object from the URL fragment and returns it.\r\n * @param {string} hash - Hash passed from redirect page\r\n * @returns {TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.\r\n * @ignore\r\n * @hidden\r\n */\r\n protected getRequestInfo(hash: string): TokenResponse {\r\n hash = this.getHash(hash);\r\n const parameters = Utils.deserialize(hash);\r\n const tokenResponse = new TokenResponse();\r\n if (parameters) {\r\n tokenResponse.parameters = parameters;\r\n if (parameters.hasOwnProperty(Constants.errorDescription) ||\r\n parameters.hasOwnProperty(Constants.error) ||\r\n parameters.hasOwnProperty(Constants.accessToken) ||\r\n parameters.hasOwnProperty(Constants.idToken)) {\r\n tokenResponse.valid = true;\r\n // which call\r\n let stateResponse: string;\r\n if (parameters.hasOwnProperty(\"state\")) {\r\n stateResponse = parameters.state;\r\n } else {\r\n return tokenResponse;\r\n }\r\n\r\n tokenResponse.stateResponse = stateResponse;\r\n // async calls can fire iframe and login request at the same time if developer does not use the API as expected\r\n // incoming callback needs to be looked up to find the request type\r\n if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { // loginRedirect\r\n tokenResponse.requestType = Constants.login;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n } else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { //acquireTokenRedirect\r\n tokenResponse.requestType = Constants.renewToken;\r\n tokenResponse.stateMatch = true;\r\n return tokenResponse;\r\n }\r\n\r\n // external api requests may have many renewtoken requests for different resource\r\n if (!tokenResponse.stateMatch) {\r\n tokenResponse.requestType = window.requestType;\r\n const statesInParentContext = window.renewStates;\r\n for (let i = 0; i < statesInParentContext.length; i++) {\r\n if (statesInParentContext[i] === tokenResponse.stateResponse) {\r\n tokenResponse.stateMatch = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return tokenResponse;\r\n }\r\n\r\n /*\r\n * Extracts scope value from the state sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n private getScopeFromState(state: string): string {\r\n if (state) {\r\n const splitIndex = state.indexOf(\"|\");\r\n if (splitIndex > -1 && splitIndex + 1 < state.length) {\r\n return state.substring(splitIndex + 1);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /*\r\n * Returns whether current window is in ifram for token renewal\r\n * @ignore\r\n * @hidden\r\n */\r\n private isInIframe() {\r\n return window.parent !== window;\r\n }\r\n\r\n loginInProgress(): boolean {\r\n var pendingCallback = this._cacheStorage.getItem(Constants.urlHash);\r\n if (pendingCallback)\r\n return true;\r\n return this._loginInProgress;\r\n }\r\n\r\n private getHostFromUri(uri: string): string {\r\n // remove http:// or https:// from uri\r\n var extractedUri = String(uri).replace(/^(https?:)\\/\\//, '');\r\n extractedUri = extractedUri.split('/')[0];\r\n return extractedUri;\r\n }\r\n \r\n getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of anonymous endpoints, no need to send token to these endpoints, return null.\r\n if (this._anonymousEndpoints.length > 0) {\r\n for (var i = 0; i < this._anonymousEndpoints.length; i++) {\r\n if (endpoint.indexOf(this._anonymousEndpoints[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._endpoints.size > 0) {\r\n for (let key of Array.from(this._endpoints.keys())) {\r\n // configEndpoint is like /api/Todo requested endpoint can be /api/Todo/1\r\n if (endpoint.indexOf(key) > -1) {\r\n return this._endpoints.get(key);\r\n }\r\n }\r\n }\r\n\r\n // default resource will be clientid if nothing specified\r\n // App will use idtoken for calls to itself\r\n // check if it's staring from http or https, needs to match with app host\r\n if (endpoint.indexOf('http://') > -1 || endpoint.indexOf('https://') > -1) {\r\n if (this.getHostFromUri(endpoint) === this.getHostFromUri(this._redirectUri)) {\r\n return new Array(this.clientId);\r\n }\r\n }\r\n else {\r\n // in angular level, the url for $http interceptor call could be relative url,\r\n // if it's relative call, we'll treat it as app backend call. \r\n return new Array(this.clientId);\r\n }\r\n\r\n // if not the app's own backend or not a domain listed in the endpoints structure\r\n return null;\r\n }\r\n\r\n //These APIS are exposed for msalAngular wrapper only\r\n protected setloginInProgress(loginInProgress : boolean) {\r\n this._loginInProgress = loginInProgress;\r\n }\r\n\r\n protected getAcquireTokenInProgress(): boolean\r\n {\r\n return this._acquireTokenInProgress;\r\n }\r\n\r\n protected setAcquireTokenInProgress(acquireTokenInProgress : boolean) {\r\n this._acquireTokenInProgress = acquireTokenInProgress;\r\n }\r\n\r\n protected getLogger()\r\n {\r\n return this._logger;\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/UserAgentApplication.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenKey {\r\n\r\n authority: string;\r\n clientId: string;\r\n userIdentifier: string;\r\n scopes: string;\r\n\r\n constructor(authority: string, clientId: string, scopes: string, uid: string, utid: string) {\r\n this.authority = authority;\r\n this.clientId = clientId;\r\n this.scopes = scopes;\r\n this.userIdentifier = Utils.base64EncodeStringUrlSafe(uid) + \".\" + Utils.base64EncodeStringUrlSafe(utid);\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenKey.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenValue {\r\n\r\n accessToken: string;\r\n idToken: string;\r\n expiresIn: string;\r\n clientInfo: string;\r\n\r\n constructor(accessToken: string, idToken: string, expiresIn: string, clientInfo: string) {\r\n this.accessToken = accessToken;\r\n this.idToken = idToken;\r\n this.expiresIn = expiresIn;\r\n this.clientInfo = clientInfo;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenValue.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Authority } from \"./Authority\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AuthenticationRequestParameters {\r\n authorityInstance: Authority;\r\n clientId: string;\r\n nonce: string;\r\n state: string;\r\n correlationId: string;\r\n xClientVer: string;\r\n xClientSku: string;\r\n scopes: Array;\r\n responseType: string;\r\n promptValue: string;\r\n extraQueryParameters: string;\r\n loginHint: string;\r\n domainHint: string;\r\n redirectUri: string;\r\n public get authority(): string {\r\n return this.authorityInstance.CanonicalAuthority;\r\n }\r\n\r\n constructor(authority: Authority, clientId: string, scope: Array, responseType: string, redirectUri: string) {\r\n this.authorityInstance = authority;\r\n this.clientId = clientId;\r\n this.scopes = scope;\r\n this.responseType = responseType;\r\n this.redirectUri = redirectUri;\r\n // randomly generated values\r\n this.correlationId = Utils.createNewGuid();\r\n this.state = Utils.createNewGuid();\r\n this.nonce = Utils.createNewGuid();\r\n // telemetry information\r\n this.xClientSku = \"MSAL.JS\";\r\n this.xClientVer = Utils.getLibraryVersion();\r\n }\r\n\r\n createNavigateUrl(scopes: Array): string {\r\n if (!scopes) {\r\n scopes = [this.clientId];\r\n }\r\n\r\n if (scopes.indexOf(this.clientId) === -1) {\r\n scopes.push(this.clientId);\r\n }\r\n\r\n const str: Array = [];\r\n str.push(\"response_type=\" + this.responseType);\r\n this.translateclientIdUsedInScope(scopes);\r\n str.push(\"scope=\" + encodeURIComponent(this.parseScope(scopes)));\r\n str.push(\"client_id=\" + encodeURIComponent(this.clientId));\r\n str.push(\"redirect_uri=\" + encodeURIComponent(this.redirectUri));\r\n str.push(\"state=\" + encodeURIComponent(this.state));\r\n str.push(\"nonce=\" + encodeURIComponent(this.nonce));\r\n str.push(\"client_info=1\");\r\n str.push(`x-client-SKU=${this.xClientSku}`);\r\n str.push(`x-client-Ver=${this.xClientVer}`);\r\n\r\n if (this.extraQueryParameters) {\r\n str.push(this.extraQueryParameters);\r\n }\r\n\r\n str.push(\"client-request-id=\" + encodeURIComponent(this.correlationId));\r\n let authEndpoint: string = this.authorityInstance.AuthorizationEndpoint;\r\n\r\n // if the endpoint already has queryparams, lets add to it, otherwise add the first one\r\n if (authEndpoint.indexOf(\"?\") < 0) {\r\n authEndpoint += \"?\";\r\n } else {\r\n authEndpoint += \"&\";\r\n }\r\n\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n translateclientIdUsedInScope(scopes: Array): void {\r\n const clientIdIndex: number = scopes.indexOf(this.clientId);\r\n if (clientIdIndex >= 0) {\r\n scopes.splice(clientIdIndex, 1);\r\n if (scopes.indexOf(\"openid\") === -1) {\r\n scopes.push(\"openid\");\r\n }\r\n if (scopes.indexOf(\"profile\") === -1) {\r\n scopes.push(\"profile\");\r\n }\r\n }\r\n }\r\n\r\n parseScope(scopes: Array): string {\r\n let scopeList: string = \"\";\r\n if (scopes) {\r\n for (let i: number = 0; i < scopes.length; ++i) {\r\n scopeList += (i !== scopes.length - 1) ? scopes[i] + \" \" : scopes[i];\r\n }\r\n }\r\n\r\n return scopeList;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationRequestParameters.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class ClientInfo {\r\n\r\n private _uid: string;\r\n get uid(): string {\r\n return this._uid ? this._uid : \"\";\r\n }\r\n\r\n set uid(uid: string) {\r\n this._uid = uid;\r\n }\r\n\r\n private _utid: string;\r\n get utid(): string {\r\n return this._utid ? this._utid : \"\";\r\n }\r\n\r\n set utid(utid: string) {\r\n this._utid = utid;\r\n }\r\n\r\n constructor(rawClientInfo: string) {\r\n if (!rawClientInfo || Utils.isEmpty(rawClientInfo)) {\r\n this.uid = \"\";\r\n this.utid = \"\";\r\n return;\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = Utils.base64DecodeStringUrlSafe(rawClientInfo);\r\n const clientInfo: ClientInfo = JSON.parse(decodedClientInfo);\r\n if (clientInfo) {\r\n if (clientInfo.hasOwnProperty(\"uid\")) {\r\n this.uid = clientInfo.uid;\r\n }\r\n\r\n if (clientInfo.hasOwnProperty(\"utid\")) {\r\n this.utid = clientInfo.utid;\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(e);\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/ClientInfo.ts","/*\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the \"Software\"), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class IdToken {\r\n\r\n issuer: string;\r\n objectId: string;\r\n subject: string;\r\n tenantId: string;\r\n version: string;\r\n preferredName: string;\r\n name: string;\r\n homeObjectId: string;\r\n nonce: string;\r\n expiration: string;\r\n rawIdToken: string;\r\n decodedIdToken: Object\r\n\r\n constructor(rawIdToken: string) {\r\n if (Utils.isEmpty(rawIdToken)) {\r\n throw new Error(\"null or empty raw idtoken\");\r\n }\r\n try {\r\n this.rawIdToken = rawIdToken;\r\n this.decodedIdToken = Utils.extractIdToken(rawIdToken);\r\n if (this.decodedIdToken) {\r\n if (this.decodedIdToken.hasOwnProperty(\"iss\")) {\r\n this.issuer = this.decodedIdToken[\"iss\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"oid\")) {\r\n this.objectId = this.decodedIdToken['oid'];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"sub\")) {\r\n this.subject = this.decodedIdToken[\"sub\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"tid\")) {\r\n this.tenantId = this.decodedIdToken[\"tid\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"ver\")) {\r\n this.version = this.decodedIdToken[\"ver\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"preferred_username\")) {\r\n this.preferredName = this.decodedIdToken[\"preferred_username\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"name\")) {\r\n this.name = this.decodedIdToken[\"name\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"nonce\")) {\r\n this.nonce = this.decodedIdToken[\"nonce\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"exp\")) {\r\n this.expiration = this.decodedIdToken[\"exp\"];\r\n }\r\n\r\n if (this.decodedIdToken.hasOwnProperty(\"home_oid\")) {\r\n this.homeObjectId = this.decodedIdToken[\"home_oid\"];\r\n }\r\n }\r\n } catch (e) {\r\n throw new Error(\"Failed to parse the returned id token\");\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/IdToken.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { Constants } from \"./Constants\";\r\nimport { AccessTokenCacheItem } from \"./AccessTokenCacheItem\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class Storage {// Singleton\r\n\r\n private static _instance: Storage;\r\n private _localStorageSupported: boolean;\r\n private _sessionStorageSupported: boolean;\r\n private _cacheLocation: string;\r\n\r\n constructor(cacheLocation: string) {\r\n if (Storage._instance) {\r\n return Storage._instance;\r\n }\r\n\r\n this._cacheLocation = cacheLocation;\r\n this._localStorageSupported = typeof window[this._cacheLocation] !== \"undefined\" && window[this._cacheLocation] != null;\r\n this._sessionStorageSupported = typeof window[cacheLocation] !== \"undefined\" && window[cacheLocation] != null;\r\n Storage._instance = this;\r\n if (!this._localStorageSupported && !this._sessionStorageSupported) {\r\n throw new Error(\"localStorage and sessionStorage not supported\");\r\n }\r\n\r\n return Storage._instance;\r\n }\r\n\r\n // add value to storage\r\n setItem(key: string, value: string): void {\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string): string {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // remove value from storage\r\n removeItem(key: string): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].removeItem(key);\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n // clear storage (remove all items from it)\r\n clear(): void {\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].clear();\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n getAllAccessTokens(clientId: string, userIdentifier: string): Array {\r\n const results: Array = [];\r\n let accessTokenCacheItem: AccessTokenCacheItem;\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if (key.match(clientId) && key.match(userIdentifier)) {\r\n let value = this.getItem(key);\r\n if (value) {\r\n accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value));\r\n results.push(accessTokenCacheItem);\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n\r\n return results;\r\n }\r\n\r\n removeAcquireTokenEntries(authorityKey: string, acquireTokenUserKey: string): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key)) {\r\n if ((authorityKey != \"\" && key.indexOf(authorityKey) > -1) || (acquireTokenUserKey!= \"\" && key.indexOf(acquireTokenUserKey) > -1)) {\r\n this.removeItem(key);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n\r\n resetCacheItems(): void {\r\n const storage = window[this._cacheLocation];\r\n if (storage) {\r\n let key: string;\r\n for (key in storage) {\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.msal) !== -1) {\r\n this.setItem(key,\"\");\r\n }\r\n if (storage.hasOwnProperty(key) && key.indexOf(Constants.renewStatus) !== -1)\r\n this.removeItem(key);\r\n }\r\n } else {\r\n throw new Error(\"localStorage and sessionStorage are not supported\");\r\n }\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/Storage.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AccessTokenKey } from \"./AccessTokenKey\";\r\nimport { AccessTokenValue } from \"./AccessTokenValue\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class AccessTokenCacheItem {\r\n\r\n key: AccessTokenKey;\r\n value: AccessTokenValue;\r\n\r\n constructor(key: AccessTokenKey, value: AccessTokenValue) {\r\n this.key = key;\r\n this.value = value;\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AccessTokenCacheItem.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\n/*\r\n * @hidden\r\n */\r\nimport { Utils } from \"./Utils\";\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { B2cAuthority } from \"./B2cAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\n\r\nexport class AuthorityFactory {\r\n /*\r\n * Parse the url and determine the type of authority\r\n */\r\n private static DetectAuthorityFromUrl(authorityUrl: string): AuthorityType {\r\n authorityUrl = Utils.CanonicalizeUri(authorityUrl);\r\n let components = Utils.GetUrlComponents(authorityUrl);\r\n let pathSegments = components.PathSegments;\r\n switch (pathSegments[0]) {\r\n case \"tfp\":\r\n return AuthorityType.B2C;\r\n case \"adfs\":\r\n return AuthorityType.Adfs;\r\n default:\r\n return AuthorityType.Aad;\r\n }\r\n }\r\n\r\n /*\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (eg aad, b2c)\r\n */\r\n public static CreateInstance(authorityUrl: string, validateAuthority: boolean): Authority {\r\n let type = AuthorityFactory.DetectAuthorityFromUrl(authorityUrl);\r\n // Depending on above detection, create the right type.\r\n switch (type) {\r\n case AuthorityType.B2C:\r\n return new B2cAuthority(authorityUrl, validateAuthority);\r\n case AuthorityType.Aad:\r\n return new AadAuthority(authorityUrl, validateAuthority);\r\n default:\r\n throw ErrorMessage.invalidAuthorityType;\r\n }\r\n }\r\n\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthorityFactory.ts","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All Rights Reserved\r\n * MIT License\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this\r\n * software and associated documentation files (the 'Software'), to deal in the Software\r\n * without restriction, including without limitation the rights to use, copy, modify,\r\n * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\r\n * permit persons to whom the Software is furnished to do so, subject to the following\r\n * conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be\r\n * included in all copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\r\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\r\n * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT\r\n * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n\r\nimport { AadAuthority } from \"./AadAuthority\";\r\nimport { Authority, AuthorityType } from \"./Authority\";\r\nimport { ErrorMessage } from \"./ErrorMessage\";\r\nimport { Utils } from \"./Utils\";\r\n\r\n/*\r\n * @hidden\r\n */\r\nexport class B2cAuthority extends AadAuthority {\r\n public constructor(authority: string, validateAuthority: boolean) {\r\n super(authority, validateAuthority);\r\n let urlComponents = Utils.GetUrlComponents(authority);\r\n\r\n let pathSegments = urlComponents.PathSegments;\r\n if (pathSegments.length < 3) {\r\n throw ErrorMessage.b2cAuthorityUriInvalidPath;\r\n }\r\n\r\n this.CanonicalAuthority = `https://${urlComponents.HostNameAndPort}/${pathSegments[0]}/${pathSegments[1]}/${pathSegments[2]}/`;\r\n }\r\n\r\n public get AuthorityType(): AuthorityType {\r\n return AuthorityType.B2C;\r\n }\r\n\r\n /*\r\n * Returns a promise with the TenantDiscoveryEndpoint\r\n */\r\n public GetOpenIdConfigurationEndpointAsync(): Promise {\r\n var resultPromise = new Promise((resolve, reject) =>\r\n resolve(this.DefaultOpenIdConfigurationEndpoint));\r\n\r\n if (!this.IsValidationEnabled) {\r\n return resultPromise;\r\n }\r\n\r\n if (this.IsInTrustedHostList(this.CanonicalAuthorityUrlComponents.HostNameAndPort)) {\r\n return resultPromise;\r\n }\r\n\r\n return new Promise((resolve, reject) =>\r\n reject(ErrorMessage.unsupportedAuthorityValidation));\r\n }\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/B2cAuthority.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/lib-commonjs/Utils.js b/lib-commonjs/Utils.js index 17c53bc27c..eba8312364 100644 --- a/lib-commonjs/Utils.js +++ b/lib-commonjs/Utils.js @@ -232,7 +232,7 @@ var Utils = /** @class */ (function () { return hex; }; Utils.getLibraryVersion = function () { - return "0.1.8"; + return "0.1.9"; }; /* * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d diff --git a/lib-es6/Utils.js b/lib-es6/Utils.js index c4e28b6125..fb9611f732 100644 --- a/lib-es6/Utils.js +++ b/lib-es6/Utils.js @@ -230,7 +230,7 @@ var Utils = /** @class */ (function () { return hex; }; Utils.getLibraryVersion = function () { - return "0.1.8"; + return "0.1.9"; }; /* * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d diff --git a/package.json b/package.json index 56ba5a0de8..200250c6f2 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "type": "git", "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git" }, - "version": "0.1.8", + "version": "0.1.9", "description": "Microsoft Authentication Library for js", "keywords": [ "implicit", diff --git a/src/Utils.ts b/src/Utils.ts index 9d60e301b0..2ac2debf38 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -257,7 +257,7 @@ export class Utils { } static getLibraryVersion(): string { - return "0.1.8"; + return "0.1.9"; } /*