Commit 3a84cbd5 authored by Ahmet Turan Koçak's avatar Ahmet Turan Koçak
Browse files

Initial commit

parents
{"version":3,"file":"BrowserStringUtils.js","sources":["../../src/utils/BrowserStringUtils.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Constants } from \"@azure/msal-common\";\n\n/**\n * Utility functions for strings in a browser. See here for implementation details:\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64\n */\nexport class BrowserStringUtils {\n\n /**\n * Converts string to Uint8Array\n * @param sDOMStr \n */\n static stringToUtf8Arr (sDOMStr: string): Uint8Array {\n let nChr;\n let nArrLen = 0;\n const nStrLen = sDOMStr.length;\n /* mapping... */\n for (let nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {\n nChr = sDOMStr.charCodeAt(nMapIdx);\n nArrLen += nChr < 0x80 ? 1 : nChr < 0x800 ? 2 : nChr < 0x10000 ? 3 : nChr < 0x200000 ? 4 : nChr < 0x4000000 ? 5 : 6;\n }\n\n const aBytes = new Uint8Array(nArrLen);\n\n /* transcription... */\n\n for (let nIdx = 0, nChrIdx = 0; nIdx < nArrLen; nChrIdx++) {\n nChr = sDOMStr.charCodeAt(nChrIdx);\n if (nChr < 128) {\n /* one byte */\n aBytes[nIdx++] = nChr;\n } else if (nChr < 0x800) {\n /* two bytes */\n aBytes[nIdx++] = 192 + (nChr >>> 6);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x10000) {\n /* three bytes */\n aBytes[nIdx++] = 224 + (nChr >>> 12);\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x200000) {\n /* four bytes */\n aBytes[nIdx++] = 240 + (nChr >>> 18);\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else if (nChr < 0x4000000) {\n /* five bytes */\n aBytes[nIdx++] = 248 + (nChr >>> 24);\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n } else /* if (nChr <= 0x7fffffff) */ {\n /* six bytes */\n aBytes[nIdx++] = 252 + (nChr >>> 30);\n aBytes[nIdx++] = 128 + (nChr >>> 24 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\n aBytes[nIdx++] = 128 + (nChr & 63);\n }\n }\n\n return aBytes; \n }\n\n /**\n * Converst string to ArrayBuffer\n * @param dataString \n */\n static stringToArrayBuffer(dataString: string): ArrayBuffer {\n const data = new ArrayBuffer(dataString.length);\n const dataView = new Uint8Array(data);\n for (let i: number = 0; i < dataString.length; i++) {\n dataView[i] = dataString.charCodeAt(i);\n }\n return data;\n }\n\n /**\n * Converts Uint8Array to a string\n * @param aBytes \n */\n static utf8ArrToString (aBytes: Uint8Array): string {\n let sView = Constants.EMPTY_STRING;\n for (let nPart, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {\n nPart = aBytes[nIdx];\n sView += String.fromCharCode(\n nPart > 251 && nPart < 254 && nIdx + 5 < nLen ? /* six bytes */\n /* (nPart - 252 << 30) may be not so safe in ECMAScript! So...: */\n (nPart - 252) * 1073741824 + (aBytes[++nIdx] - 128 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\n : nPart > 247 && nPart < 252 && nIdx + 4 < nLen ? /* five bytes */\n (nPart - 248 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\n : nPart > 239 && nPart < 248 && nIdx + 3 < nLen ? /* four bytes */\n (nPart - 240 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\n : nPart > 223 && nPart < 240 && nIdx + 2 < nLen ? /* three bytes */\n (nPart - 224 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\n : nPart > 191 && nPart < 224 && nIdx + 1 < nLen ? /* two bytes */\n (nPart - 192 << 6) + aBytes[++nIdx] - 128\n : /* nPart < 127 ? */ /* one byte */\n nPart\n );\n }\n return sView;\n }\n\n /**\n * Returns stringified jwk.\n * @param jwk \n */\n static getSortedObjectString(obj: object): string {\n return JSON.stringify(obj, Object.keys(obj).sort());\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;AAOA;;;;;IAIA;KA4GC;;;;;IAtGU,kCAAe,GAAtB,UAAwB,OAAe;QACnC,IAAI,IAAI,CAAC;QACT,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,IAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;;QAE/B,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE;YAChD,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACnC,OAAO,IAAI,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,QAAQ,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;SACvH;QAED,IAAM,MAAM,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;;QAIvC,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,OAAO,GAAG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M,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG;sBACpI,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI;wBAC3C,CAAC,KAAK,GAAG,GAAG,IAAI,EAAE,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG;0BACrG,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI;4BAC3C,CAAC,KAAK,GAAG,GAAG,IAAI,EAAE,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG;8BACtE,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,GAAG,IAAI,IAAI,GAAG,CAAC,GAAG,IAAI;gCAC3C,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG;;oCAEzC,KAAK,CAC5B,CAAC;SACL;QACD,OAAO,KAAK,CAAC;KAChB;;;;;IAMM,wCAAqB,GAA5B,UAA6B,GAAW;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;KACvD;IACL,yBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
import { INetworkModule } from "@azure/msal-common";
import { InteractionType } from "./BrowserConstants";
/**
* Utility class for browser specific functions
*/
export declare class BrowserUtils {
/**
* Clears hash from window url.
*/
static clearHash(contentWindow: Window): void;
/**
* Replaces current hash with hash from provided url
*/
static replaceHash(url: string): void;
/**
* Returns boolean of whether the current window is in an iframe or not.
*/
static isInIframe(): boolean;
/**
* Returns boolean of whether or not the current window is a popup opened by msal
*/
static isInPopup(): boolean;
/**
* Returns current window URL as redirect uri
*/
static getCurrentUri(): string;
/**
* Gets the homepage url for the current window location.
*/
static getHomepage(): string;
/**
* Returns best compatible network client object.
*/
static getBrowserNetworkClient(): INetworkModule;
/**
* Throws error if we have completed an auth and are
* attempting another auth request inside an iframe.
*/
static blockReloadInHiddenIframes(): void;
/**
* Block redirect operations in iframes unless explicitly allowed
* @param interactionType Interaction type for the request
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
*/
static blockRedirectInIframe(interactionType: InteractionType, allowRedirectInIframe: boolean): void;
/**
* Block redirectUri loaded in popup from calling AcquireToken APIs
*/
static blockAcquireTokenInPopups(): void;
/**
* Throws error if token requests are made in non-browser environment
* @param isBrowserEnvironment Flag indicating if environment is a browser.
*/
static blockNonBrowserEnvironment(isBrowserEnvironment: boolean): void;
/**
* Throws error if native brokering is enabled but initialize hasn't been called
* @param allowNativeBroker
* @param initialized
*/
static blockNativeBrokerCalledBeforeInitialized(allowNativeBroker: boolean, initialized: boolean): void;
/**
* Returns boolean of whether current browser is an Internet Explorer or Edge browser.
*/
static detectIEOrEdge(): boolean;
}
//# sourceMappingURL=BrowserUtils.d.ts.map
\ No newline at end of file
{"version":3,"file":"BrowserUtils.d.ts","sourceRoot":"","sources":["../../src/utils/BrowserUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,cAAc,EAAa,MAAM,oBAAoB,CAAC;AAI1E,OAAO,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AAEvE;;GAEG;AACH,qBAAa,YAAY;IAIrB;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAS7C;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMrC;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,OAAO;IAI5B;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,OAAO;IAS3B;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,MAAM;IAM5B;;OAEG;IACH,MAAM,CAAC,uBAAuB,IAAI,cAAc;IAQhD;;;OAGG;IACH,MAAM,CAAC,0BAA0B,IAAI,IAAI;IAQzC;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,eAAe,EAAE,eAAe,EAAE,qBAAqB,EAAE,OAAO,GAAG,IAAI;IAQpG;;OAEG;IACH,MAAM,CAAC,yBAAyB,IAAI,IAAI;IAOxC;;;OAGG;IACH,MAAM,CAAC,0BAA0B,CAAC,oBAAoB,EAAE,OAAO,GAAG,IAAI;IAMtE;;;;OAIG;IACH,MAAM,CAAC,wCAAwC,CAAC,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,IAAI;IAMvG;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,OAAO;CASnC"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { Constants, UrlString } from '@azure/msal-common';
import { FetchClient } from '../network/FetchClient.js';
import { XhrClient } from '../network/XhrClient.js';
import { BrowserAuthError } from '../error/BrowserAuthError.js';
import { BrowserConstants, InteractionType } from './BrowserConstants.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Utility class for browser specific functions
*/
var BrowserUtils = /** @class */ (function () {
function BrowserUtils() {
}
// #region Window Navigation and URL management
/**
* Clears hash from window url.
*/
BrowserUtils.clearHash = function (contentWindow) {
// Office.js sets history.replaceState to null
contentWindow.location.hash = Constants.EMPTY_STRING;
if (typeof contentWindow.history.replaceState === "function") {
// Full removes "#" from url
contentWindow.history.replaceState(null, Constants.EMPTY_STRING, "" + contentWindow.location.origin + contentWindow.location.pathname + contentWindow.location.search);
}
};
/**
* Replaces current hash with hash from provided url
*/
BrowserUtils.replaceHash = function (url) {
var urlParts = url.split("#");
urlParts.shift(); // Remove part before the hash
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
};
/**
* Returns boolean of whether the current window is in an iframe or not.
*/
BrowserUtils.isInIframe = function () {
return window.parent !== window;
};
/**
* Returns boolean of whether or not the current window is a popup opened by msal
*/
BrowserUtils.isInPopup = function () {
return typeof window !== "undefined" && !!window.opener &&
window.opener !== window &&
typeof window.name === "string" &&
window.name.indexOf(BrowserConstants.POPUP_NAME_PREFIX + ".") === 0;
};
// #endregion
/**
* Returns current window URL as redirect uri
*/
BrowserUtils.getCurrentUri = function () {
return window.location.href.split("?")[0].split("#")[0];
};
/**
* Gets the homepage url for the current window location.
*/
BrowserUtils.getHomepage = function () {
var currentUrl = new UrlString(window.location.href);
var urlComponents = currentUrl.getUrlComponents();
return urlComponents.Protocol + "//" + urlComponents.HostNameAndPort + "/";
};
/**
* Returns best compatible network client object.
*/
BrowserUtils.getBrowserNetworkClient = function () {
if (window.fetch && window.Headers) {
return new FetchClient();
}
else {
return new XhrClient();
}
};
/**
* Throws error if we have completed an auth and are
* attempting another auth request inside an iframe.
*/
BrowserUtils.blockReloadInHiddenIframes = function () {
var isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);
// return an error if called from the hidden iframe created by the msal js silent calls
if (isResponseHash && BrowserUtils.isInIframe()) {
throw BrowserAuthError.createBlockReloadInHiddenIframeError();
}
};
/**
* Block redirect operations in iframes unless explicitly allowed
* @param interactionType Interaction type for the request
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
*/
BrowserUtils.blockRedirectInIframe = function (interactionType, allowRedirectInIframe) {
var isIframedApp = BrowserUtils.isInIframe();
if (interactionType === InteractionType.Redirect && isIframedApp && !allowRedirectInIframe) {
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
throw BrowserAuthError.createRedirectInIframeError(isIframedApp);
}
};
/**
* Block redirectUri loaded in popup from calling AcquireToken APIs
*/
BrowserUtils.blockAcquireTokenInPopups = function () {
// Popups opened by msal popup APIs are given a name that starts with "msal."
if (BrowserUtils.isInPopup()) {
throw BrowserAuthError.createBlockAcquireTokenInPopupsError();
}
};
/**
* Throws error if token requests are made in non-browser environment
* @param isBrowserEnvironment Flag indicating if environment is a browser.
*/
BrowserUtils.blockNonBrowserEnvironment = function (isBrowserEnvironment) {
if (!isBrowserEnvironment) {
throw BrowserAuthError.createNonBrowserEnvironmentError();
}
};
/**
* Throws error if native brokering is enabled but initialize hasn't been called
* @param allowNativeBroker
* @param initialized
*/
BrowserUtils.blockNativeBrokerCalledBeforeInitialized = function (allowNativeBroker, initialized) {
if (allowNativeBroker && !initialized) {
throw BrowserAuthError.createNativeBrokerCalledBeforeInitialize();
}
};
/**
* Returns boolean of whether current browser is an Internet Explorer or Edge browser.
*/
BrowserUtils.detectIEOrEdge = function () {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
var msie11 = ua.indexOf("Trident/");
var msedge = ua.indexOf("Edge/");
var isIE = msie > 0 || msie11 > 0;
var isEdge = msedge > 0;
return isIE || isEdge;
};
return BrowserUtils;
}());
export { BrowserUtils };
//# sourceMappingURL=BrowserUtils.js.map
{"version":3,"file":"BrowserUtils.js","sources":["../../src/utils/BrowserUtils.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Constants, INetworkModule, UrlString } from \"@azure/msal-common\";\nimport { FetchClient } from \"../network/FetchClient\";\nimport { XhrClient } from \"../network/XhrClient\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { InteractionType, BrowserConstants } from \"./BrowserConstants\";\n\n/**\n * Utility class for browser specific functions\n */\nexport class BrowserUtils {\n\n // #region Window Navigation and URL management\n\n /**\n * Clears hash from window url.\n */\n static clearHash(contentWindow: Window): void {\n // Office.js sets history.replaceState to null\n contentWindow.location.hash = Constants.EMPTY_STRING;\n if (typeof contentWindow.history.replaceState === \"function\") {\n // Full removes \"#\" from url\n contentWindow.history.replaceState(null, Constants.EMPTY_STRING, `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);\n }\n }\n\n /**\n * Replaces current hash with hash from provided url\n */\n static replaceHash(url: string): void {\n const urlParts = url.split(\"#\");\n urlParts.shift(); // Remove part before the hash\n window.location.hash = urlParts.length > 0 ? urlParts.join(\"#\") : Constants.EMPTY_STRING;\n }\n\n /**\n * Returns boolean of whether the current window is in an iframe or not.\n */\n static isInIframe(): boolean {\n return window.parent !== window;\n }\n\n /**\n * Returns boolean of whether or not the current window is a popup opened by msal\n */\n static isInPopup(): boolean {\n return typeof window !== \"undefined\" && !!window.opener && \n window.opener !== window && \n typeof window.name === \"string\" && \n window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0;\n }\n\n // #endregion\n\n /**\n * Returns current window URL as redirect uri\n */\n static getCurrentUri(): string {\n return window.location.href.split(\"?\")[0].split(\"#\")[0];\n }\n\n /**\n * Gets the homepage url for the current window location.\n */\n static getHomepage(): string {\n const currentUrl = new UrlString(window.location.href);\n const urlComponents = currentUrl.getUrlComponents();\n return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;\n }\n\n /**\n * Returns best compatible network client object. \n */\n static getBrowserNetworkClient(): INetworkModule {\n if (window.fetch && window.Headers) {\n return new FetchClient();\n } else {\n return new XhrClient();\n }\n }\n\n /**\n * Throws error if we have completed an auth and are \n * attempting another auth request inside an iframe.\n */\n static blockReloadInHiddenIframes(): void {\n const isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);\n // return an error if called from the hidden iframe created by the msal js silent calls\n if (isResponseHash && BrowserUtils.isInIframe()) {\n throw BrowserAuthError.createBlockReloadInHiddenIframeError();\n }\n }\n\n /**\n * Block redirect operations in iframes unless explicitly allowed\n * @param interactionType Interaction type for the request\n * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe\n */\n static blockRedirectInIframe(interactionType: InteractionType, allowRedirectInIframe: boolean): void {\n const isIframedApp = BrowserUtils.isInIframe();\n if (interactionType === InteractionType.Redirect && isIframedApp && !allowRedirectInIframe) {\n // If we are not in top frame, we shouldn't redirect. This is also handled by the service.\n throw BrowserAuthError.createRedirectInIframeError(isIframedApp);\n }\n }\n\n /**\n * Block redirectUri loaded in popup from calling AcquireToken APIs\n */\n static blockAcquireTokenInPopups(): void {\n // Popups opened by msal popup APIs are given a name that starts with \"msal.\"\n if (BrowserUtils.isInPopup()) {\n throw BrowserAuthError.createBlockAcquireTokenInPopupsError();\n }\n }\n\n /**\n * Throws error if token requests are made in non-browser environment\n * @param isBrowserEnvironment Flag indicating if environment is a browser.\n */\n static blockNonBrowserEnvironment(isBrowserEnvironment: boolean): void {\n if (!isBrowserEnvironment) {\n throw BrowserAuthError.createNonBrowserEnvironmentError();\n }\n }\n\n /**\n * Throws error if native brokering is enabled but initialize hasn't been called\n * @param allowNativeBroker \n * @param initialized \n */\n static blockNativeBrokerCalledBeforeInitialized(allowNativeBroker: boolean, initialized: boolean): void {\n if (allowNativeBroker && !initialized) {\n throw BrowserAuthError.createNativeBrokerCalledBeforeInitialize();\n }\n }\n\n /**\n * Returns boolean of whether current browser is an Internet Explorer or Edge browser.\n */\n static detectIEOrEdge(): boolean {\n const ua = window.navigator.userAgent;\n const msie = ua.indexOf(\"MSIE \");\n const msie11 = ua.indexOf(\"Trident/\");\n const msedge = ua.indexOf(\"Edge/\");\n const isIE = msie > 0 || msie11 > 0;\n const isEdge = msedge > 0;\n return isIE || isEdge;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAWA;;;;IAGA;KA2IC;;;;;IApIU,sBAAS,GAAhB,UAAiB,aAAqB;;QAElC,aAAa,CAAC,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,YAAY,CAAC;QACrD,IAAI,OAAO,aAAa,CAAC,OAAO,CAAC,YAAY,KAAK,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C,SAAS,CAAC,SAAS,CAAC;QACtC,IAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACjC,IAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,IAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnC,IAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;QACpC,IAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;QAC1B,OAAO,IAAI,IAAI,MAAM,CAAC;KACzB;IACL,mBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
/**
* Utility class for math specific functions in browser.
*/
export declare class MathUtils {
/**
* Decimal to Hex
*
* @param num
*/
static decimalToHex(num: number): string;
}
//# sourceMappingURL=MathUtils.d.ts.map
\ No newline at end of file
{"version":3,"file":"MathUtils.d.ts","sourceRoot":"","sources":["../../src/utils/MathUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,SAAS;IAElB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAO3C"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Utility class for math specific functions in browser.
*/
var MathUtils = /** @class */ (function () {
function MathUtils() {
}
/**
* Decimal to Hex
*
* @param num
*/
MathUtils.decimalToHex = function (num) {
var hex = num.toString(16);
while (hex.length < 2) {
hex = "0" + hex;
}
return hex;
};
return MathUtils;
}());
export { MathUtils };
//# sourceMappingURL=MathUtils.js.map
{"version":3,"file":"MathUtils.js","sources":["../../src/utils/MathUtils.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Utility class for math specific functions in browser.\n */\nexport class MathUtils {\n\n /**\n * Decimal to Hex\n *\n * @param num\n */\n static decimalToHex(num: number): string {\n let hex: string = num.toString(16);\n while (hex.length < 2) {\n hex = \"0\" + hex;\n }\n return hex;\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;AAKA;;;;IAGA;KAcC;;;;;;IAPU,sBAAY,GAAnB,UAAoB,GAAW;QAC3B,IAAI,GAAG,GAAW,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;SACnB;QACD,OAAO,GAAG,CAAC;KACd;IACL,gBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "@azure/msal-browser",
"author": {
"name": "Microsoft",
"email": "nugetaad@microsoft.com",
"url": "https://www.microsoft.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
},
"version": "2.32.1",
"description": "Microsoft Authentication Library for js",
"keywords": [
"implicit",
"authorization code",
"PKCE",
"js",
"AAD",
"msal",
"oauth"
],
"sideEffects": false,
"main": "./dist/index.cjs.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"engines": {
"node": ">=0.8.0"
},
"beachball": {
"disallowedChangeTypes": [
"major"
]
},
"directories": {
"test": "test"
},
"files": [
"dist",
"lib/msal-browser.js",
"lib/msal-browser.js.map",
"lib/msal-browser.min.js"
],
"scripts": {
"cdn": "npm run build:all && npm run cdn:upload && npm run cdn:sri",
"cdn:upload": "node ./cdn-upload.js",
"cdn:sri": "node ./cdn-sri.js",
"clean": "shx rm -rf dist lib",
"clean:coverage": "rimraf ../../.nyc_output/*",
"lint": "cd ../../ && npm run lint:browser",
"lint:fix": "npm run lint -- -- --fix",
"test": "jest",
"test:coverage": "jest --coverage",
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
"build:all": "npm run build:common && npm run build",
"build:common": "cd ../msal-common && npm run build",
"build:modules": "rollup -c",
"build:modules:watch": "rollup -cw",
"build": "npm run clean && npm run build:modules",
"link:localDeps": "npx lerna bootstrap --scope @azure/msal-common --scope @azure/msal-browser",
"prepack": "npm run build:all"
},
"devDependencies": {
"@azure/storage-blob": "^12.2.1",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.23",
"@types/sinon": "^7.5.0",
"dotenv": "^8.2.0",
"fake-indexeddb": "^3.1.3",
"husky": "^3.0.9",
"jest": "^27.0.4",
"jsdom": "^20.0.0",
"jsdom-global": "^3.0.2",
"rimraf": "^3.0.0",
"rollup": "^2.46.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"shx": "^0.3.2",
"sinon": "^7.5.0",
"ssri": "^8.0.1",
"ts-jest": "^27.0.2",
"tslib": "^1.10.0",
"tslint": "^5.20.0",
"typescript": "^3.8.3"
},
"dependencies": {
"@azure/msal-common": "^9.0.1"
}
,"_resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-2.32.1.tgz"
,"_integrity": "sha512-2G3B12ZEIpiimi6/Yqq7KLk4ud1zZWoHvVd2kJ2VthN1HjMsZjdMUxeHkwMWaQ6RzO6mv9rZiuKmRX64xkXW9g=="
,"_from": "@azure/msal-browser@^2.26.0"
}
\ No newline at end of file
MIT License
Copyright (c) Microsoft Corporation. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
# Microsoft Authentication Library for JavaScript (MSAL.js) Common Protocols Package
[![npm version](https://img.shields.io/npm/v/@azure/msal-common.svg?style=flat)](https://www.npmjs.com/package/@azure/msal-common/)
[![npm version](https://img.shields.io/npm/dm/@azure/msal-common.svg)](https://nodei.co/npm/@azure/msal-common/)
[![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-common)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
| <a href="https://docs.microsoft.com/azure/active-directory/develop/guidedsetups/active-directory-javascriptspa" target="_blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html" target="_blank">Library Reference</a> |
| --- | --- | --- |
1. [About](#about)
2. [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/FAQ.md)
1. [Changelog](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/CHANGELOG.md)
1. [Releases](#releases)
1. [Prerequisites and Usage](#prerequisites-and-usage)
1. [Installation](#installation)
1. [Security Reporting](#security-reporting)
1. [License](#license)
1. [Code of Conduct](#we-value-and-adhere-to-the-microsoft-open-source-code-of-conduct)
## About
The MSAL library for JavaScript enables client-side JavaScript applications to authenticate users using [Azure AD](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-overview) work and school accounts (AAD), Microsoft personal accounts (MSA) and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through [Azure AD B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-overview#identity-providers) service. It also enables your app to get tokens to access [Microsoft Cloud](https://www.microsoft.com/enterprise) services such as [Microsoft Graph](https://graph.microsoft.io).
The `@azure/msal-common` package described by the code in this folder serves as a common package dependency for the `@azure/msal-browser` package (and in the future, the msal-node package). Be aware that this is an internal library, and is subject to frequent change. **It is not meant for production consumption by itself.**
## FAQ
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/FAQ.md).
## Releases
*Expect us to detail our major and minor releases moving forward, while leaving out our patch releases. Patch release notes can be found in our change log.*
| Date | Release | Announcement | Main features |
| ------| ------- | ---------| --------- |
| August 4, 2020 | @azure/msal-common v1.1.0 | [Release Notes](https://https://github.com/AzureAD/microsoft-authentication-library-for-js/releases/tag/msal-common-v1.1.0)
| July 20, 2020 | @azure/msal-common v1.0.0 | [Release Notes](https://github.com/AzureAD/microsoft-authentication-library-for-js/releases/tag/msal-common-v1.0.0) | Full release version of the `@azure/msal-common` |
| May 11, 2020 | @azure/msal-common v1.0.0-beta | Beta version of the `@azure/msal-common` package |
| January 17, 2020 | @azure/msal-common v1.0.0-alpha | No release notes yet | Alpha version of the `@azure/msal-common` package with authorization code flow for SPAs working in dev. |
## Prerequisites and Usage
This library is not meant for production use. Please use one of these packages specific to the platform you are developing for:
- [MSAL for Single Page Applications (SPAs)](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser)
- [MSAL for Node.js](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node)
## Installation
### Via NPM:
npm install @azure/msal-common
## Security Reporting
If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/en-us/security/dd252948) and subscribing to Security Advisory Alerts.
## License
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License");
## We Value and Adhere to the Microsoft Open Source Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
/*! @azure/msal-common v9.0.1 2022-12-07 */
'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export { __assign, __awaiter, __extends, __generator, __spreadArrays };
//# sourceMappingURL=_tslib.js.map
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
import { TokenClaims } from "./TokenClaims";
/**
* Account object with the following signature:
* - homeAccountId - Home account identifier for this account object
* - environment - Entity which issued the token represented by the domain of the issuer (e.g. login.microsoftonline.com)
* - tenantId - Full tenant or organizational id that this account belongs to
* - username - preferred_username claim of the id_token that represents this account
* - localAccountId - Local, tenant-specific account identifer for this account object, usually used in legacy cases
* - name - Full name for the account, including given name and family name
* - idToken - raw ID token
* - idTokenClaims - Object contains claims from ID token
* - localAccountId - The user's account ID
* - nativeAccountId - The user's native account ID
*/
export declare type AccountInfo = {
homeAccountId: string;
environment: string;
tenantId: string;
username: string;
localAccountId: string;
name?: string;
idToken?: string;
idTokenClaims?: TokenClaims & {
[key: string]: string | number | string[] | object | undefined | unknown;
};
nativeAccountId?: string;
};
export declare type ActiveAccountFilters = {
homeAccountId: string;
localAccountId: string;
};
//# sourceMappingURL=AccountInfo.d.ts.map
\ No newline at end of file
{"version":3,"file":"AccountInfo.d.ts","sourceRoot":"","sources":["../../src/account/AccountInfo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C;;;;;;;;;;;;GAYG;AACH,oBAAY,WAAW,GAAG;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,WAAW,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;KAAE,CAAC;IAC3G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC"}
\ No newline at end of file
import { TokenClaims } from "./TokenClaims";
import { ICrypto } from "../crypto/ICrypto";
/**
* JWT Token representation class. Parses token string and generates claims object.
*/
export declare class AuthToken {
rawToken: string;
claims: TokenClaims;
constructor(rawToken: string, crypto: ICrypto);
/**
* Extract token by decoding the rawToken
*
* @param encodedToken
*/
static extractTokenClaims(encodedToken: string, crypto: ICrypto): TokenClaims;
/**
* Determine if the token's max_age has transpired
*/
static checkMaxAge(authTime: number, maxAge: number): void;
}
//# sourceMappingURL=AuthToken.d.ts.map
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment