diff --git a/lib/msal-core/dist/msal.js.map b/lib/msal-core/dist/msal.js.map index 0d2e680826..1db3f122ec 100644 --- a/lib/msal-core/dist/msal.js.map +++ b/lib/msal-core/dist/msal.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 32e9fcc19e37513e44fd","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,EAA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AAe,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 32e9fcc19e37513e44fd","/**\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.2.2\";\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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, userState: 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 * Use to send the state parameter with authentication request\r\n */\r\n private _state: string;\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 _protectedResourceMap: Map>;\r\n\r\n private _unprotectedResources: Array;\r\n\r\n private storeAuthStateInCookie: boolean;\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 state?: string,\r\n isAngular?: boolean,\r\n unprotectedResources?: Array\r\n protectedResourceMap?:Map>,\r\n storeAuthStateInCookie?:boolean\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 state = \"\",\r\n isAngular = false,\r\n unprotectedResources = new Array(),\r\n protectedResourceMap = new Map>(),\r\n storeAuthStateInCookie = false\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\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, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce, this.storeAuthStateInCookie);\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, this._state);\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 this._cacheStorage.clearCookie();\r\n }\r\n\r\n protected 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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n getUserState (state: 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 /*\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 protected getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._protectedResourceMap.size > 0) {\r\n for (let key of Array.from(this._protectedResourceMap.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._protectedResourceMap.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,state: 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 = state && !Utils.isEmpty(state) ? Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\r\n let authEndpoint: string = 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 } else {\r\n authEndpoint += \"&\";\r\n }\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n createNavigationUrlString(scopes: Array): Array {\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\r\n return str;\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, enableCookieStorage?: boolean): void {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string, enableCookieStorage?: boolean): string {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 }\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 }\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 }\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 }\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 }\r\n }\r\n\r\n setItemCookie(cName: string, cValue: string, expires?: number): void {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n\r\n document.cookie = cookieStr;\r\n }\r\n\r\n getItemCookie(cName: string): string {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n setExpirationCookie(cookieLife: number): string {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n }\r\n\r\n clearCookie(): void {\r\n this.setItemCookie(Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants.loginRequest, '', -1);\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 32e9fcc19e37513e44fd","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,OA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C,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 32e9fcc19e37513e44fd","/**\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.2.2\";\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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, userState: 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 * Use to send the state parameter with authentication request\r\n */\r\n private _state: string;\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 _protectedResourceMap: Map>;\r\n\r\n private _unprotectedResources: Array;\r\n\r\n private storeAuthStateInCookie: boolean;\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 state?: string,\r\n isAngular?: boolean,\r\n unprotectedResources?: Array\r\n protectedResourceMap?:Map>,\r\n storeAuthStateInCookie?:boolean\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 state = \"\",\r\n isAngular = false,\r\n unprotectedResources = new Array(),\r\n protectedResourceMap = new Map>(),\r\n storeAuthStateInCookie = false\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\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, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce, this.storeAuthStateInCookie);\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, this._state);\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 this._cacheStorage.clearCookie();\r\n }\r\n\r\n protected 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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n getUserState (state: 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 /*\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 protected getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._protectedResourceMap.size > 0) {\r\n for (let key of Array.from(this._protectedResourceMap.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._protectedResourceMap.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,state: 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 = state && !Utils.isEmpty(state) ? Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\r\n let authEndpoint: string = 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 } else {\r\n authEndpoint += \"&\";\r\n }\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n createNavigationUrlString(scopes: Array): Array {\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\r\n return str;\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, enableCookieStorage?: boolean): void {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string, enableCookieStorage?: boolean): string {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 }\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 }\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 }\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 }\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 }\r\n }\r\n\r\n setItemCookie(cName: string, cValue: string, expires?: number): void {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n\r\n document.cookie = cookieStr;\r\n }\r\n\r\n getItemCookie(cName: string): string {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n setExpirationCookie(cookieLife: number): string {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n }\r\n\r\n clearCookie(): void {\r\n this.setItemCookie(Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants.loginRequest, '', -1);\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":""} diff --git a/lib/msal-core/dist/msal.min.js.map b/lib/msal-core/dist/msal.min.js.map index 22bf164d3b..98a37a3aa3 100644 --- a/lib/msal-core/dist/msal.min.js.map +++ b/lib/msal-core/dist/msal.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///msal.min.js","webpack:///webpack/bootstrap 32e9fcc19e37513e44fd","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","throw","result","done","apply","__generator","body","verb","v","op","f","TypeError","_","y","label","ops","pop","trys","push","g","sent","return","Symbol","iterator","__exportStar","__values","__read","ar","error","__spread","concat","__await","__asyncGenerator","a","q","resume","settle","fulfill","asyncIterator","__asyncDelegator","__asyncValues","__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","state","_j","isAngular","_k","unprotectedResources","_l","protectedResourceMap","Map","_m","storeAuthStateInCookie","_redirectUri","_postLogoutredirectUri","_loginInProgress","_acquireTokenInProgress","_cacheLocation","_navigateToLoginRequestUrl","_state","_unprotectedResources","_protectedResourceMap","_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","clearCookie","getUserState","stateLogin","loginRedirect","extraQueryParameters","loginProgressError","isValidScope","validateInputScope","inputScopesError","filterScopes","authenticationRequest","AuthenticationRequestParameters","loginStartPage","angularLoginRequest","setItem","loginRequest","loginError","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","createNavigationUrlString","authEndpoint","translateclientIdUsedInScope","parseScope","clientIdIndex","splice","scopeList","_uid","_utid","objectId","subject","version","homeObjectId","AccessTokenCacheItem_1","_instance","_localStorageSupported","_sessionStorageSupported","enableCookieStorage","setItemCookie","getItemCookie","clear","results","storage","AccessTokenCacheItem","cName","cValue","cookieStr","setExpirationCookie","cookie","ca","cookieLife","today","AadAuthority_1","B2cAuthority_1","DetectAuthorityFromU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N,EAAA7V,aAArBjV,GAAAorB","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.2.2\";\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/*! *****************************************************************************\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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.state, state = _h === void 0 ? \"\" : _h, _j = options.isAngular, isAngular = _j === void 0 ? false : _j, _k = options.unprotectedResources, unprotectedResources = _k === void 0 ? new Array() : _k, _l = options.protectedResourceMap, protectedResourceMap = _l === void 0 ? new Map() : _l, _m = options.storeAuthStateInCookie, storeAuthStateInCookie = _m === void 0 ? false : _m;\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, _this._state);\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, _this.storeAuthStateInCookie);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateLogin, authenticationRequest.state, _this.storeAuthStateInCookie);\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce, _this.storeAuthStateInCookie);\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, _this._state);\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 this._cacheStorage.clearCookie();\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri, _this._state);\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri, _this._state);\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\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, _this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUserState = 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 /*\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 unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n if (this._protectedResourceMap.size > 0) {\r\n for (var _i = 0, _a = Array.from(this._protectedResourceMap.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._protectedResourceMap.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, state) {\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 = state && !Utils_1.Utils.isEmpty(state) ? Utils_1.Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\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.createNavigationUrlString = 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 return str;\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, enableCookieStorage) {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n };\r\n // get one item by key from storage\r\n Storage.prototype.getItem = function (key, enableCookieStorage) {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 };\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 };\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 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 };\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 };\r\n Storage.prototype.setItemCookie = function (cName, cValue, expires) {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n document.cookie = cookieStr;\r\n };\r\n Storage.prototype.getItemCookie = function (cName) {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n };\r\n Storage.prototype.setExpirationCookie = function (cookieLife) {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n };\r\n Storage.prototype.clearCookie = function () {\r\n this.setItemCookie(Constants_1.Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants_1.Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants_1.Constants.loginRequest, '', -1);\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 32e9fcc19e37513e44fd","/**\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.2.2\";\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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, userState: 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 * Use to send the state parameter with authentication request\r\n */\r\n private _state: string;\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 _protectedResourceMap: Map>;\r\n\r\n private _unprotectedResources: Array;\r\n\r\n private storeAuthStateInCookie: boolean;\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 state?: string,\r\n isAngular?: boolean,\r\n unprotectedResources?: Array\r\n protectedResourceMap?:Map>,\r\n storeAuthStateInCookie?:boolean\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 state = \"\",\r\n isAngular = false,\r\n unprotectedResources = new Array(),\r\n protectedResourceMap = new Map>(),\r\n storeAuthStateInCookie = false\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\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, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce, this.storeAuthStateInCookie);\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, this._state);\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 this._cacheStorage.clearCookie();\r\n }\r\n\r\n protected 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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n getUserState (state: 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 /*\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 protected getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._protectedResourceMap.size > 0) {\r\n for (let key of Array.from(this._protectedResourceMap.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._protectedResourceMap.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,state: 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 = state && !Utils.isEmpty(state) ? Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\r\n let authEndpoint: string = 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 } else {\r\n authEndpoint += \"&\";\r\n }\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n createNavigationUrlString(scopes: Array): Array {\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\r\n return str;\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, enableCookieStorage?: boolean): void {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string, enableCookieStorage?: boolean): string {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 }\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 }\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 }\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 }\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 }\r\n }\r\n\r\n setItemCookie(cName: string, cValue: string, expires?: number): void {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n\r\n document.cookie = cookieStr;\r\n }\r\n\r\n getItemCookie(cName: string): string {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n setExpirationCookie(cookieLife: number): string {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n }\r\n\r\n clearCookie(): void {\r\n this.setItemCookie(Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants.loginRequest, '', -1);\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 32e9fcc19e37513e44fd","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","throw","result","done","apply","__generator","body","verb","v","op","f","TypeError","_","y","label","ops","pop","trys","push","g","sent","return","Symbol","iterator","__exportStar","__values","__read","ar","error","__spread","concat","__await","__asyncGenerator","a","q","resume","settle","fulfill","asyncIterator","__asyncDelegator","__asyncValues","__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","state","_j","isAngular","_k","unprotectedResources","_l","protectedResourceMap","Map","_m","storeAuthStateInCookie","_redirectUri","_postLogoutredirectUri","_loginInProgress","_acquireTokenInProgress","_cacheLocation","_navigateToLoginRequestUrl","_state","_unprotectedResources","_protectedResourceMap","_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","clearCookie","getUserState","stateLogin","loginRedirect","extraQueryParameters","loginProgressError","isValidScope","validateInputScope","inputScopesError","filterScopes","authenticationRequest","AuthenticationRequestParameters","loginStartPage","angularLoginRequest","setItem","loginRequest","loginError","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","createNavigationUrlString","authEndpoint","translateclientIdUsedInScope","parseScope","clientIdIndex","splice","scopeList","_uid","_utid","objectId","subject","version","homeObjectId","AccessTokenCacheItem_1","_instance","_localStorageSupported","_sessionStorageSupported","enableCookieStorage","setItemCookie","getItemCookie","clear","results","storage","AccessTokenCacheItem","cName","cValue","cookieStr","setExpirationCookie","cookie","ca","cookieLife","today","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,GAAA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EAAAvJ,EAAA,GAKA6qB,EAAA,SAAAlW,GACE,QAAAkW,GAAmBjhB,EAAmBC,GAAtC,GAAA8B,GACEgJ,EAAAtU,KAAAP,KAAM8J,EAAWC,IAAkB/J,KAC/BiJ,EAAgBQ,EAAA7H,MAAMiG,iBAAiBiC,GAEvCX,EAAeF,EAAclB,YACjC,IAAIoB,EAAaxG,OAAS,EACtB,KAAM+G,GAAAqB,aAAaigB,0BtB6zHnB,OsB1zHJnf,GAAK5B,mBAAqB,WAAWhB,EAAcf,gBAAe,IAAIiB,EAAa,GAAE,IAAIA,EAAa,GAAE,IAAIA,EAAa,GAAE,ItB0zHhH0C,EsBjyHf,MAnCkC6I,GAAAzI,UAAA8e,EAAAlW,GAahC/T,OAAAC,eAAWgqB,EAAAxpB,UAAA,iBtB0zHLL,IsB1zHN,WACE,MAAOyT,GAAA/K,cAAcihB,KtB4zHjB5pB,YAAY,EACZD,cAAc,IsBvzHb+pB,EAAAxpB,UAAAuK,oCAAP,cAAAD,GAAA7L,KACMgV,EAAgB,GAAIjH,SAAgB,SAACC,EAASC,GAChD,MAAAD,GAAQnC,EAAKoJ,qCAEf,OAAKjV,MAAKgK,oBAINhK,KAAKmV,oBAAoBnV,KAAKmK,gCAAgCjC,iBACzD8M,EAGF,GAAIjH,SAAgB,SAACC,EAASC,GACnC,MAAAA,GAAOvE,EAAAqB,aAAakgB,kCARbjW,GAUb+V,GAnCkCN,EAAA7V,aAArBjV,GAAAorB","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.2.2\";\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/*! *****************************************************************************\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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.state, state = _h === void 0 ? \"\" : _h, _j = options.isAngular, isAngular = _j === void 0 ? false : _j, _k = options.unprotectedResources, unprotectedResources = _k === void 0 ? new Array() : _k, _l = options.protectedResourceMap, protectedResourceMap = _l === void 0 ? new Map() : _l, _m = options.storeAuthStateInCookie, storeAuthStateInCookie = _m === void 0 ? false : _m;\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, _this._state);\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, _this.storeAuthStateInCookie);\r\n _this._cacheStorage.setItem(Constants_1.Constants.loginError, \"\");\r\n _this._cacheStorage.setItem(Constants_1.Constants.stateLogin, authenticationRequest.state, _this.storeAuthStateInCookie);\r\n _this._cacheStorage.setItem(Constants_1.Constants.nonceIdToken, authenticationRequest.nonce, _this.storeAuthStateInCookie);\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, _this._state);\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 this._cacheStorage.clearCookie();\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants_1.Constants.stateLogin)));\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri, _this._state);\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\r\n }\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(acquireTokenAuthority, _this.clientId, scopes, ResponseTypes.id_token_token, _this._redirectUri, _this._state);\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, _this._state);\r\n }\r\n else {\r\n authenticationRequest_1 = new AuthenticationRequestParameters_1.AuthenticationRequestParameters(newAuthority, _this.clientId, scopes, ResponseTypes.token, _this._redirectUri, _this._state);\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, _this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n UserAgentApplication.prototype.getUserState = 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 /*\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 unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n if (this._protectedResourceMap.size > 0) {\r\n for (var _i = 0, _a = Array.from(this._protectedResourceMap.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._protectedResourceMap.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, state) {\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 = state && !Utils_1.Utils.isEmpty(state) ? Utils_1.Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\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.createNavigationUrlString = 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 return str;\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, enableCookieStorage) {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n };\r\n // get one item by key from storage\r\n Storage.prototype.getItem = function (key, enableCookieStorage) {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 };\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 };\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 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 };\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 };\r\n Storage.prototype.setItemCookie = function (cName, cValue, expires) {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n document.cookie = cookieStr;\r\n };\r\n Storage.prototype.getItemCookie = function (cName) {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n };\r\n Storage.prototype.setExpirationCookie = function (cookieLife) {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n };\r\n Storage.prototype.clearCookie = function () {\r\n this.setItemCookie(Constants_1.Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants_1.Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants_1.Constants.loginRequest, '', -1);\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 32e9fcc19e37513e44fd","/**\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.2.2\";\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 = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [0, 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) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; }; }\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];\r\n return m ? m.call(o) : typeof __values === \"function\" ? __values(o) : o[Symbol.iterator]();\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 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, userState: 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 * Use to send the state parameter with authentication request\r\n */\r\n private _state: string;\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 _protectedResourceMap: Map>;\r\n\r\n private _unprotectedResources: Array;\r\n\r\n private storeAuthStateInCookie: boolean;\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 state?: string,\r\n isAngular?: boolean,\r\n unprotectedResources?: Array\r\n protectedResourceMap?:Map>,\r\n storeAuthStateInCookie?:boolean\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 state = \"\",\r\n isAngular = false,\r\n unprotectedResources = new Array(),\r\n protectedResourceMap = new Map>(),\r\n storeAuthStateInCookie = false\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._state = state;\r\n this._isAngular = isAngular;\r\n this._unprotectedResources = unprotectedResources;\r\n this._protectedResourceMap = protectedResourceMap;\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 this.storeAuthStateInCookie = storeAuthStateInCookie;\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._cacheStorage.clearCookie();\r\n this._tokenReceivedCallback.call(this, errorDesc, token, error, tokenType, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\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, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.loginError, \"\");\r\n this._cacheStorage.setItem(Constants.stateLogin, authenticationRequest.state, this.storeAuthStateInCookie);\r\n this._cacheStorage.setItem(Constants.nonceIdToken, authenticationRequest.nonce, this.storeAuthStateInCookie);\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, this._state);\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 this._cacheStorage.clearCookie();\r\n }\r\n\r\n protected 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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this.getUserState(this._cacheStorage.getItem(Constants.stateLogin)));\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(acquireTokenAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this._state);\r\n }\r\n else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.token, this._redirectUri, this._state);\r\n }\r\n } else {\r\n authenticationRequest = new AuthenticationRequestParameters(newAuthority, this.clientId, scopes, ResponseTypes.id_token_token, this._redirectUri, this._state);\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, this.storeAuthStateInCookie);\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, this.storeAuthStateInCookie)) {\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, this.storeAuthStateInCookie)) { // 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 * Extracts state value from the userState sent with the authentication request.\r\n * @returns {string} scope.\r\n * @ignore\r\n * @hidden\r\n */\r\n getUserState (state: 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 /*\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 protected getScopesForEndpoint(endpoint: string) : Array {\r\n // if user specified list of unprotectedResources, no need to send token to these endpoints, return null.\r\n if (this._unprotectedResources.length > 0) {\r\n for (var i = 0; i < this._unprotectedResources.length; i++) {\r\n if (endpoint.indexOf(this._unprotectedResources[i]) > -1) {\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n if (this._protectedResourceMap.size > 0) {\r\n for (let key of Array.from(this._protectedResourceMap.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._protectedResourceMap.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,state: 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 = state && !Utils.isEmpty(state) ? Utils.createNewGuid() + \"|\" + 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 var str = this.createNavigationUrlString(scopes);\r\n let authEndpoint: string = 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 } else {\r\n authEndpoint += \"&\";\r\n }\r\n let requestUrl: string = `${authEndpoint}${str.join(\"&\")}`;\r\n return requestUrl;\r\n }\r\n\r\n createNavigationUrlString(scopes: Array): Array {\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\r\n return str;\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, enableCookieStorage?: boolean): void {\r\n if (enableCookieStorage) {\r\n this.setItemCookie(key, value);\r\n }\r\n if (window[this._cacheLocation]) {\r\n window[this._cacheLocation].setItem(key, value);\r\n }\r\n }\r\n\r\n // get one item by key from storage\r\n getItem(key: string, enableCookieStorage?: boolean): string {\r\n if (enableCookieStorage) {\r\n return this.getItemCookie(key);\r\n }\r\n if (window[this._cacheLocation]) {\r\n return window[this._cacheLocation].getItem(key);\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 }\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 }\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 }\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 }\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 }\r\n }\r\n\r\n setItemCookie(cName: string, cValue: string, expires?: number): void {\r\n var cookieStr = cName + \"=\" + cValue + \";\";\r\n if (expires) {\r\n var expireTime = this.setExpirationCookie(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n\r\n document.cookie = cookieStr;\r\n }\r\n\r\n getItemCookie(cName: string): string {\r\n var name = cName + \"=\";\r\n var ca = document.cookie.split(';');\r\n for (var i = 0; i < ca.length; i++) {\r\n var c = ca[i];\r\n while (c.charAt(0) == ' ') {\r\n c = c.substring(1);\r\n }\r\n if (c.indexOf(name) == 0) {\r\n return c.substring(name.length, c.length);\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n setExpirationCookie(cookieLife: number): string {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLife * 24 * 60 * 60 * 1000);\r\n return expr.toUTCString();\r\n }\r\n\r\n clearCookie(): void {\r\n this.setItemCookie(Constants.nonceIdToken, '', -1);\r\n this.setItemCookie(Constants.stateLogin, '', -1);\r\n this.setItemCookie(Constants.loginRequest, '', -1);\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":""} diff --git a/lib/msal-core/docs/classes/_accesstokencacheitem_.accesstokencacheitem.html b/lib/msal-core/docs/classes/_accesstokencacheitem_.accesstokencacheitem.html index ff536a076f..1289d54a06 100644 --- a/lib/msal-core/docs/classes/_accesstokencacheitem_.accesstokencacheitem.html +++ b/lib/msal-core/docs/classes/_accesstokencacheitem_.accesstokencacheitem.html @@ -3,7 +3,7 @@ - AccessTokenCacheItem | msal + AccessTokenCacheItem | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_accesstokenkey_.accesstokenkey.html b/lib/msal-core/docs/classes/_accesstokenkey_.accesstokenkey.html index c715c4041f..edfe0e4815 100644 --- a/lib/msal-core/docs/classes/_accesstokenkey_.accesstokenkey.html +++ b/lib/msal-core/docs/classes/_accesstokenkey_.accesstokenkey.html @@ -3,7 +3,7 @@ - AccessTokenKey | msal + AccessTokenKey | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_accesstokenvalue_.accesstokenvalue.html b/lib/msal-core/docs/classes/_accesstokenvalue_.accesstokenvalue.html index 7f4aa6b285..090f41116e 100644 --- a/lib/msal-core/docs/classes/_accesstokenvalue_.accesstokenvalue.html +++ b/lib/msal-core/docs/classes/_accesstokenvalue_.accesstokenvalue.html @@ -3,7 +3,7 @@ - AccessTokenValue | msal + AccessTokenValue | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_authenticationrequestparameters_.authenticationrequestparameters.html b/lib/msal-core/docs/classes/_authenticationrequestparameters_.authenticationrequestparameters.html index 45dc1e8ea2..daf696d3fd 100644 --- a/lib/msal-core/docs/classes/_authenticationrequestparameters_.authenticationrequestparameters.html +++ b/lib/msal-core/docs/classes/_authenticationrequestparameters_.authenticationrequestparameters.html @@ -3,7 +3,7 @@ - AuthenticationRequestParameters | msal + AuthenticationRequestParameters | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_authority_.authority.html b/lib/msal-core/docs/classes/_authority_.authority.html index bbd8378db6..f8328cd999 100644 --- a/lib/msal-core/docs/classes/_authority_.authority.html +++ b/lib/msal-core/docs/classes/_authority_.authority.html @@ -3,7 +3,7 @@ - Authority | msal + Authority | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_authorityfactory_.authorityfactory.html b/lib/msal-core/docs/classes/_authorityfactory_.authorityfactory.html index 6cef93418b..51aae36516 100644 --- a/lib/msal-core/docs/classes/_authorityfactory_.authorityfactory.html +++ b/lib/msal-core/docs/classes/_authorityfactory_.authorityfactory.html @@ -3,7 +3,7 @@ - AuthorityFactory | msal + AuthorityFactory | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_b2cauthority_.b2cauthority.html b/lib/msal-core/docs/classes/_b2cauthority_.b2cauthority.html index 746a24a79f..13b5427de7 100644 --- a/lib/msal-core/docs/classes/_b2cauthority_.b2cauthority.html +++ b/lib/msal-core/docs/classes/_b2cauthority_.b2cauthority.html @@ -3,7 +3,7 @@ - B2cAuthority | msal + B2cAuthority | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_clientinfo_.clientinfo.html b/lib/msal-core/docs/classes/_clientinfo_.clientinfo.html index a57378c6c2..fca74f56e5 100644 --- a/lib/msal-core/docs/classes/_clientinfo_.clientinfo.html +++ b/lib/msal-core/docs/classes/_clientinfo_.clientinfo.html @@ -3,7 +3,7 @@ - ClientInfo | msal + ClientInfo | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_constants_.constants.html b/lib/msal-core/docs/classes/_constants_.constants.html index 1b8f205f34..710a01faad 100644 --- a/lib/msal-core/docs/classes/_constants_.constants.html +++ b/lib/msal-core/docs/classes/_constants_.constants.html @@ -3,7 +3,7 @@ - Constants | msal + Constants | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_constants_.errorcodes.html b/lib/msal-core/docs/classes/_constants_.errorcodes.html index d201a50fa8..bf3f8fe78d 100644 --- a/lib/msal-core/docs/classes/_constants_.errorcodes.html +++ b/lib/msal-core/docs/classes/_constants_.errorcodes.html @@ -3,7 +3,7 @@ - ErrorCodes | msal + ErrorCodes | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_constants_.errordescription.html b/lib/msal-core/docs/classes/_constants_.errordescription.html index 562d9c3b8a..a9f290d073 100644 --- a/lib/msal-core/docs/classes/_constants_.errordescription.html +++ b/lib/msal-core/docs/classes/_constants_.errordescription.html @@ -3,7 +3,7 @@ - ErrorDescription | msal + ErrorDescription | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_errormessage_.errormessage.html b/lib/msal-core/docs/classes/_errormessage_.errormessage.html index 515bb64c63..8911e822a1 100644 --- a/lib/msal-core/docs/classes/_errormessage_.errormessage.html +++ b/lib/msal-core/docs/classes/_errormessage_.errormessage.html @@ -3,7 +3,7 @@ - ErrorMessage | msal + ErrorMessage | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_idtoken_.idtoken.html b/lib/msal-core/docs/classes/_idtoken_.idtoken.html index 75e5cbcace..d9b666f153 100644 --- a/lib/msal-core/docs/classes/_idtoken_.idtoken.html +++ b/lib/msal-core/docs/classes/_idtoken_.idtoken.html @@ -3,7 +3,7 @@ - IdToken | msal + IdToken | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_logger_.logger.html b/lib/msal-core/docs/classes/_logger_.logger.html index 390093b13f..8b6f8b20c1 100644 --- a/lib/msal-core/docs/classes/_logger_.logger.html +++ b/lib/msal-core/docs/classes/_logger_.logger.html @@ -3,7 +3,7 @@ - Logger | msal + Logger | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_requestinfo_.tokenresponse.html b/lib/msal-core/docs/classes/_requestinfo_.tokenresponse.html index 96557e20e4..a9ad10ced6 100644 --- a/lib/msal-core/docs/classes/_requestinfo_.tokenresponse.html +++ b/lib/msal-core/docs/classes/_requestinfo_.tokenresponse.html @@ -3,7 +3,7 @@ - TokenResponse | msal + TokenResponse | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_storage_.storage.html b/lib/msal-core/docs/classes/_storage_.storage.html index 0450eb1ab0..85636f98e2 100644 --- a/lib/msal-core/docs/classes/_storage_.storage.html +++ b/lib/msal-core/docs/classes/_storage_.storage.html @@ -3,7 +3,7 @@ - Storage | msal + Storage | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_user_.user.html b/lib/msal-core/docs/classes/_user_.user.html index 71eeb605f9..d747fde58c 100644 --- a/lib/msal-core/docs/classes/_user_.user.html +++ b/lib/msal-core/docs/classes/_user_.user.html @@ -3,7 +3,7 @@ - User | msal + User | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_useragentapplication_.useragentapplication.html b/lib/msal-core/docs/classes/_useragentapplication_.useragentapplication.html index d6781c5d9b..ac3e83dcbc 100644 --- a/lib/msal-core/docs/classes/_useragentapplication_.useragentapplication.html +++ b/lib/msal-core/docs/classes/_useragentapplication_.useragentapplication.html @@ -3,7 +3,7 @@ - UserAgentApplication | msal + UserAgentApplication | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_utils_.utils.html b/lib/msal-core/docs/classes/_utils_.utils.html index fba55ab220..1e98cc1970 100644 --- a/lib/msal-core/docs/classes/_utils_.utils.html +++ b/lib/msal-core/docs/classes/_utils_.utils.html @@ -3,7 +3,7 @@ - Utils | msal + Utils | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/classes/_xhrclient_.xhrclient.html b/lib/msal-core/docs/classes/_xhrclient_.xhrclient.html index 83ba98c80a..2c68e63e55 100644 --- a/lib/msal-core/docs/classes/_xhrclient_.xhrclient.html +++ b/lib/msal-core/docs/classes/_xhrclient_.xhrclient.html @@ -3,7 +3,7 @@ - XhrClient | msal + XhrClient | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/enums/_authority_.authoritytype.html b/lib/msal-core/docs/enums/_authority_.authoritytype.html index 05bb4525a9..71c321c034 100644 --- a/lib/msal-core/docs/enums/_authority_.authoritytype.html +++ b/lib/msal-core/docs/enums/_authority_.authoritytype.html @@ -3,7 +3,7 @@ - AuthorityType | msal + AuthorityType | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/enums/_logger_.loglevel.html b/lib/msal-core/docs/enums/_logger_.loglevel.html index 308fc14603..c610a2b225 100644 --- a/lib/msal-core/docs/enums/_logger_.loglevel.html +++ b/lib/msal-core/docs/enums/_logger_.loglevel.html @@ -3,7 +3,7 @@ - LogLevel | msal + LogLevel | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/globals.html b/lib/msal-core/docs/globals.html index d6043905ff..34c39fe318 100644 --- a/lib/msal-core/docs/globals.html +++ b/lib/msal-core/docs/globals.html @@ -3,7 +3,7 @@ - msal + @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    @@ -56,7 +56,7 @@ Globals -

    msal

    +

    @azure/msal

    diff --git a/lib/msal-core/docs/index.html b/lib/msal-core/docs/index.html index 29ce6e51c3..3eb9f36257 100644 --- a/lib/msal-core/docs/index.html +++ b/lib/msal-core/docs/index.html @@ -3,7 +3,7 @@ - msal + @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    @@ -56,7 +56,7 @@ Globals -

    msal

    +

    @azure/msal

    diff --git a/lib/msal-core/docs/interfaces/_itenantdiscoveryresponse_.itenantdiscoveryresponse.html b/lib/msal-core/docs/interfaces/_itenantdiscoveryresponse_.itenantdiscoveryresponse.html index 976bd1e3a6..d940580aaa 100644 --- a/lib/msal-core/docs/interfaces/_itenantdiscoveryresponse_.itenantdiscoveryresponse.html +++ b/lib/msal-core/docs/interfaces/_itenantdiscoveryresponse_.itenantdiscoveryresponse.html @@ -3,7 +3,7 @@ - ITenantDiscoveryResponse | msal + ITenantDiscoveryResponse | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/interfaces/_iuri_.iuri.html b/lib/msal-core/docs/interfaces/_iuri_.iuri.html index 091f007b94..5c176d21d7 100644 --- a/lib/msal-core/docs/interfaces/_iuri_.iuri.html +++ b/lib/msal-core/docs/interfaces/_iuri_.iuri.html @@ -3,7 +3,7 @@ - IUri | msal + IUri | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/interfaces/_logger_.iloggercallback.html b/lib/msal-core/docs/interfaces/_logger_.iloggercallback.html index 4888bd2c24..407589a541 100644 --- a/lib/msal-core/docs/interfaces/_logger_.iloggercallback.html +++ b/lib/msal-core/docs/interfaces/_logger_.iloggercallback.html @@ -3,7 +3,7 @@ - ILoggerCallback | msal + ILoggerCallback | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/interfaces/_useragentapplication_.__global.window.html b/lib/msal-core/docs/interfaces/_useragentapplication_.__global.window.html index 24dafce362..4d9e58ffb4 100644 --- a/lib/msal-core/docs/interfaces/_useragentapplication_.__global.window.html +++ b/lib/msal-core/docs/interfaces/_useragentapplication_.__global.window.html @@ -3,7 +3,7 @@ - Window | msal + Window | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/interfaces/_useragentapplication_.cacheresult.html b/lib/msal-core/docs/interfaces/_useragentapplication_.cacheresult.html index 08178409b7..1449c4cc40 100644 --- a/lib/msal-core/docs/interfaces/_useragentapplication_.cacheresult.html +++ b/lib/msal-core/docs/interfaces/_useragentapplication_.cacheresult.html @@ -3,7 +3,7 @@ - CacheResult | msal + CacheResult | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_aadauthority_.html b/lib/msal-core/docs/modules/_aadauthority_.html index d59f87d40b..128d77a494 100644 --- a/lib/msal-core/docs/modules/_aadauthority_.html +++ b/lib/msal-core/docs/modules/_aadauthority_.html @@ -3,7 +3,7 @@ - "AadAuthority" | msal + "AadAuthority" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_accesstokencacheitem_.html b/lib/msal-core/docs/modules/_accesstokencacheitem_.html index 8c1da6ab43..76a591e847 100644 --- a/lib/msal-core/docs/modules/_accesstokencacheitem_.html +++ b/lib/msal-core/docs/modules/_accesstokencacheitem_.html @@ -3,7 +3,7 @@ - "AccessTokenCacheItem" | msal + "AccessTokenCacheItem" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_accesstokenkey_.html b/lib/msal-core/docs/modules/_accesstokenkey_.html index f5fad256f1..414378d9c5 100644 --- a/lib/msal-core/docs/modules/_accesstokenkey_.html +++ b/lib/msal-core/docs/modules/_accesstokenkey_.html @@ -3,7 +3,7 @@ - "AccessTokenKey" | msal + "AccessTokenKey" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_accesstokenvalue_.html b/lib/msal-core/docs/modules/_accesstokenvalue_.html index db3e1c553a..613c885238 100644 --- a/lib/msal-core/docs/modules/_accesstokenvalue_.html +++ b/lib/msal-core/docs/modules/_accesstokenvalue_.html @@ -3,7 +3,7 @@ - "AccessTokenValue" | msal + "AccessTokenValue" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_authenticationrequestparameters_.html b/lib/msal-core/docs/modules/_authenticationrequestparameters_.html index 00882df7c9..3fb663f7b1 100644 --- a/lib/msal-core/docs/modules/_authenticationrequestparameters_.html +++ b/lib/msal-core/docs/modules/_authenticationrequestparameters_.html @@ -3,7 +3,7 @@ - "AuthenticationRequestParameters" | msal + "AuthenticationRequestParameters" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_authority_.html b/lib/msal-core/docs/modules/_authority_.html index 2f7e9152f0..ede09e3af8 100644 --- a/lib/msal-core/docs/modules/_authority_.html +++ b/lib/msal-core/docs/modules/_authority_.html @@ -3,7 +3,7 @@ - "Authority" | msal + "Authority" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_authorityfactory_.html b/lib/msal-core/docs/modules/_authorityfactory_.html index 02f0c8e03c..f07a0bc7f2 100644 --- a/lib/msal-core/docs/modules/_authorityfactory_.html +++ b/lib/msal-core/docs/modules/_authorityfactory_.html @@ -3,7 +3,7 @@ - "AuthorityFactory" | msal + "AuthorityFactory" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_b2cauthority_.html b/lib/msal-core/docs/modules/_b2cauthority_.html index 17a57a9cd3..03e866f438 100644 --- a/lib/msal-core/docs/modules/_b2cauthority_.html +++ b/lib/msal-core/docs/modules/_b2cauthority_.html @@ -3,7 +3,7 @@ - "B2cAuthority" | msal + "B2cAuthority" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_clientinfo_.html b/lib/msal-core/docs/modules/_clientinfo_.html index 7bcf8f5333..749637a41a 100644 --- a/lib/msal-core/docs/modules/_clientinfo_.html +++ b/lib/msal-core/docs/modules/_clientinfo_.html @@ -3,7 +3,7 @@ - "ClientInfo" | msal + "ClientInfo" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_constants_.html b/lib/msal-core/docs/modules/_constants_.html index ca7afa2330..c1cea5c895 100644 --- a/lib/msal-core/docs/modules/_constants_.html +++ b/lib/msal-core/docs/modules/_constants_.html @@ -3,7 +3,7 @@ - "Constants" | msal + "Constants" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_errormessage_.html b/lib/msal-core/docs/modules/_errormessage_.html index d22eb98c5e..5084181f15 100644 --- a/lib/msal-core/docs/modules/_errormessage_.html +++ b/lib/msal-core/docs/modules/_errormessage_.html @@ -3,7 +3,7 @@ - "ErrorMessage" | msal + "ErrorMessage" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_idtoken_.html b/lib/msal-core/docs/modules/_idtoken_.html index 53ec6c3eca..615695fe2c 100644 --- a/lib/msal-core/docs/modules/_idtoken_.html +++ b/lib/msal-core/docs/modules/_idtoken_.html @@ -3,7 +3,7 @@ - "IdToken" | msal + "IdToken" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_index_.html b/lib/msal-core/docs/modules/_index_.html index c946a7ac27..9607831d8c 100644 --- a/lib/msal-core/docs/modules/_index_.html +++ b/lib/msal-core/docs/modules/_index_.html @@ -3,7 +3,7 @@ - "index" | msal + "index" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_itenantdiscoveryresponse_.html b/lib/msal-core/docs/modules/_itenantdiscoveryresponse_.html index b5bdb09ad0..105dffde9f 100644 --- a/lib/msal-core/docs/modules/_itenantdiscoveryresponse_.html +++ b/lib/msal-core/docs/modules/_itenantdiscoveryresponse_.html @@ -3,7 +3,7 @@ - "ITenantDiscoveryResponse" | msal + "ITenantDiscoveryResponse" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_iuri_.html b/lib/msal-core/docs/modules/_iuri_.html index d62ce9b674..364b3addaf 100644 --- a/lib/msal-core/docs/modules/_iuri_.html +++ b/lib/msal-core/docs/modules/_iuri_.html @@ -3,7 +3,7 @@ - "IUri" | msal + "IUri" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_logger_.html b/lib/msal-core/docs/modules/_logger_.html index 488e18874e..4f10bbb5c2 100644 --- a/lib/msal-core/docs/modules/_logger_.html +++ b/lib/msal-core/docs/modules/_logger_.html @@ -3,7 +3,7 @@ - "Logger" | msal + "Logger" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_requestinfo_.html b/lib/msal-core/docs/modules/_requestinfo_.html index 7548dbaa3f..f284fced21 100644 --- a/lib/msal-core/docs/modules/_requestinfo_.html +++ b/lib/msal-core/docs/modules/_requestinfo_.html @@ -3,7 +3,7 @@ - "RequestInfo" | msal + "RequestInfo" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_storage_.html b/lib/msal-core/docs/modules/_storage_.html index d979ed315b..fe42966d11 100644 --- a/lib/msal-core/docs/modules/_storage_.html +++ b/lib/msal-core/docs/modules/_storage_.html @@ -3,7 +3,7 @@ - "Storage" | msal + "Storage" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_user_.html b/lib/msal-core/docs/modules/_user_.html index a41ed016d1..431cde9ca7 100644 --- a/lib/msal-core/docs/modules/_user_.html +++ b/lib/msal-core/docs/modules/_user_.html @@ -3,7 +3,7 @@ - "User" | msal + "User" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_useragentapplication_.__global.html b/lib/msal-core/docs/modules/_useragentapplication_.__global.html index 09e46b6627..26c6c0d352 100644 --- a/lib/msal-core/docs/modules/_useragentapplication_.__global.html +++ b/lib/msal-core/docs/modules/_useragentapplication_.__global.html @@ -3,7 +3,7 @@ - __global | msal + __global | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_useragentapplication_.html b/lib/msal-core/docs/modules/_useragentapplication_.html index 546466cbab..6a550b0903 100644 --- a/lib/msal-core/docs/modules/_useragentapplication_.html +++ b/lib/msal-core/docs/modules/_useragentapplication_.html @@ -3,7 +3,7 @@ - "UserAgentApplication" | msal + "UserAgentApplication" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_utils_.html b/lib/msal-core/docs/modules/_utils_.html index 36c2321330..4b12ba70e2 100644 --- a/lib/msal-core/docs/modules/_utils_.html +++ b/lib/msal-core/docs/modules/_utils_.html @@ -3,7 +3,7 @@ - "Utils" | msal + "Utils" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal
    diff --git a/lib/msal-core/docs/modules/_xhrclient_.html b/lib/msal-core/docs/modules/_xhrclient_.html index b9bfdead4c..0e0b3c8020 100644 --- a/lib/msal-core/docs/modules/_xhrclient_.html +++ b/lib/msal-core/docs/modules/_xhrclient_.html @@ -3,7 +3,7 @@ - "XHRClient" | msal + "XHRClient" | @azure/msal @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - msal + @azure/msal