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

Initial commit

parents
{"version":3,"file":"BrowserConfigurationAuthError.d.ts","sourceRoot":"","sources":["../../src/error/BrowserConfigurationAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChD,CAAC;AAEF;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,SAAS;gBAE5C,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAOpD;;OAEG;IACH,MAAM,CAAC,2BAA2B,IAAI,6BAA6B;IAKnE;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,6BAA6B;IAK7E;;;OAGG;IACH,MAAM,CAAC,8BAA8B,CAAC,oBAAoB,EAAE,MAAM,GAAG,6BAA6B;IAIlG;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,6BAA6B;IAK1E;;OAEG;IACH,MAAM,CAAC,gCAAgC,IAAI,6BAA6B;IAQxE,MAAM,CAAC,sCAAsC,IAAI,6BAA6B;IAI9E;;OAEG;IACH,MAAM,CAAC,wBAAwB,IAAI,6BAA6B;CAGnE"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { __extends } from '../_virtual/_tslib.js';
import { AuthError } from '@azure/msal-common';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* BrowserAuthErrorMessage class containing string constants used by error codes and messages.
*/
var BrowserConfigurationAuthErrorMessage = {
redirectUriNotSet: {
code: "redirect_uri_empty",
desc: "A redirect URI is required for all calls, and none has been set."
},
postLogoutUriNotSet: {
code: "post_logout_uri_empty",
desc: "A post logout redirect has not been set."
},
storageNotSupportedError: {
code: "storage_not_supported",
desc: "Given storage configuration option was not supported."
},
noRedirectCallbacksSet: {
code: "no_redirect_callbacks",
desc: "No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. " +
"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."
},
invalidCallbackObject: {
code: "invalid_callback_object",
desc: "The object passed for the callback was invalid. " +
"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics."
},
stubPcaInstanceCalled: {
code: "stubbed_public_client_application_called",
desc: "Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors"
},
inMemRedirectUnavailable: {
code: "in_mem_redirect_unavailable",
desc: "Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."
},
entropyNotProvided: {
code: "entropy_not_provided",
desc: "The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option."
}
};
/**
* Browser library error class thrown by the MSAL.js library for SPAs
*/
var BrowserConfigurationAuthError = /** @class */ (function (_super) {
__extends(BrowserConfigurationAuthError, _super);
function BrowserConfigurationAuthError(errorCode, errorMessage) {
var _this = _super.call(this, errorCode, errorMessage) || this;
_this.name = "BrowserConfigurationAuthError";
Object.setPrototypeOf(_this, BrowserConfigurationAuthError.prototype);
return _this;
}
/**
* Creates an error thrown when the redirect uri is empty (not set by caller)
*/
BrowserConfigurationAuthError.createRedirectUriEmptyError = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code, BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);
};
/**
* Creates an error thrown when the post-logout redirect uri is empty (not set by caller)
*/
BrowserConfigurationAuthError.createPostLogoutRedirectUriEmptyError = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code, BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);
};
/**
* Creates error thrown when given storage location is not supported.
* @param givenStorageLocation
*/
BrowserConfigurationAuthError.createStorageNotSupportedError = function (givenStorageLocation) {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc + " Given Location: " + givenStorageLocation);
};
/**
* Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().
*/
BrowserConfigurationAuthError.createRedirectCallbacksNotSetError = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);
};
/**
* Creates error thrown when the stub instance of PublicClientApplication is called.
*/
BrowserConfigurationAuthError.createStubPcaInstanceCalledError = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code, BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);
};
/*
* Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.
*/
BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);
};
/**
* Creates an error thrown when a crypto interface that requires entropy is initialized without entropy
*/
BrowserConfigurationAuthError.createEntropyNotProvided = function () {
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);
};
return BrowserConfigurationAuthError;
}(AuthError));
export { BrowserConfigurationAuthError, BrowserConfigurationAuthErrorMessage };
//# sourceMappingURL=BrowserConfigurationAuthError.js.map
{"version":3,"file":"BrowserConfigurationAuthError.js","sources":["../../src/error/BrowserConfigurationAuthError.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError } from \"@azure/msal-common\";\n\n/**\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\n */\nexport const BrowserConfigurationAuthErrorMessage = {\n redirectUriNotSet: {\n code: \"redirect_uri_empty\",\n desc: \"A redirect URI is required for all calls, and none has been set.\"\n },\n postLogoutUriNotSet: {\n code: \"post_logout_uri_empty\",\n desc: \"A post logout redirect has not been set.\"\n },\n storageNotSupportedError: {\n code: \"storage_not_supported\",\n desc: \"Given storage configuration option was not supported.\"\n },\n noRedirectCallbacksSet: {\n code: \"no_redirect_callbacks\",\n desc: \"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. \" +\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\n },\n invalidCallbackObject: {\n code: \"invalid_callback_object\",\n desc: \"The object passed for the callback was invalid. \" +\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\n },\n stubPcaInstanceCalled: {\n code: \"stubbed_public_client_application_called\",\n desc: \"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors\"\n },\n inMemRedirectUnavailable: {\n code: \"in_mem_redirect_unavailable\",\n desc: \"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true.\"\n },\n entropyNotProvided: {\n code: \"entropy_not_provided\",\n desc: \"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option.\"\n }\n};\n\n/**\n * Browser library error class thrown by the MSAL.js library for SPAs\n */\nexport class BrowserConfigurationAuthError extends AuthError {\n\n constructor(errorCode: string, errorMessage?: string) {\n super(errorCode, errorMessage);\n this.name = \"BrowserConfigurationAuthError\";\n\n Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);\n }\n\n /**\n * Creates an error thrown when the redirect uri is empty (not set by caller)\n */\n static createRedirectUriEmptyError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code,\n BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);\n }\n\n /**\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\n */\n static createPostLogoutRedirectUriEmptyError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code,\n BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);\n }\n\n /**\n * Creates error thrown when given storage location is not supported.\n * @param givenStorageLocation \n */\n static createStorageNotSupportedError(givenStorageLocation: string): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, `${BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc} Given Location: ${givenStorageLocation}`);\n }\n\n /**\n * Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().\n */\n static createRedirectCallbacksNotSetError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, \n BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);\n }\n\n /**\n * Creates error thrown when the stub instance of PublicClientApplication is called.\n */\n static createStubPcaInstanceCalledError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code,\n BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);\n }\n\n /*\n * Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.\n */\n static createInMemoryRedirectUnavailableError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);\n }\n \n /**\n * Creates an error thrown when a crypto interface that requires entropy is initialized without entropy\n */\n static createEntropyNotProvided(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAOA;;;IAGa,oCAAoC,GAAG;IAChD,iBAAiB,EAAE;QACf,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,kEAAkE;KAC3E;IACD,mBAAmB,EAAE;QACjB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,0CAA0C;KACnD;IACD,wBAAwB,EAAE;QACtB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,uDAAuD;KAChE;IACD,sBAAsB,EAAE;QACpB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,qIAAqI;YACvI,0HAA0H;KACjI;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,kDAAkD;YACtD,0HAA0H;KAC/H;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,0CAA0C;QAChD,IAAI,EAAE,gLAAgL;KACzL;IACD,wBAAwB,EAAE;QACtB,IAAI,EAAE,6BAA6B;QACnC,IAAI,EAAE,uRAAuR;KAChS;IACD,kBAAkB,EAAE;QAChB,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,oHAAoH;KAC7H;EACH;AAEF;;;;IAGmD,iDAAS;IAExD,uCAAY,SAAiB,EAAE,YAAqB;QAApD,YACI,kBAAM,SAAS,EAAE,YAAY,CAAC,SAIjC;QAHG,KAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAE5C,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,6BAA6B,CAAC,SAAS,CAAC,CAAC;;KACxE;;;;IAKM,yDAA2B,GAAlC;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,iBAAiB,CAAC,IAAI,EAChG,oCAAoC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;KACpE;;;;IAKM,mEAAqC,GAA5C;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,mBAAmB,CAAC,IAAI,EAClG,oCAAoC,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;KACtE;;;;;IAMM,4DAA8B,GAArC,UAAsC,oBAA4B;QAC9D,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,wBAAwB,CAAC,IAAI,EAAK,oCAAoC,CAAC,wBAAwB,CAAC,IAAI,yBAAoB,oBAAsB,CAAC,CAAC;KACjO;;;;IAKM,gEAAkC,GAAzC;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,sBAAsB,CAAC,IAAI,EACrG,oCAAoC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;KACzE;;;;IAKM,8DAAgC,GAAvC;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,qBAAqB,CAAC,IAAI,EACpG,oCAAoC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;KACxE;;;;IAKM,oEAAsC,GAA7C;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,wBAAwB,CAAC,IAAI,EAAE,oCAAoC,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;KACpL;;;;IAKM,sDAAwB,GAA/B;QACI,OAAO,IAAI,6BAA6B,CAAC,oCAAoC,CAAC,kBAAkB,CAAC,IAAI,EAAE,oCAAoC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACxK;IACL,oCAAC;AAAD,CA9DA,CAAmD,SAAS;;;;"}
\ No newline at end of file
import { AuthError } from "@azure/msal-common";
export declare type OSError = {
error: number;
protocol_error: string;
properties: object;
status: string;
retryable?: boolean;
};
export declare enum NativeStatusCode {
USER_INTERACTION_REQUIRED = "USER_INTERACTION_REQUIRED",
USER_CANCEL = "USER_CANCEL",
NO_NETWORK = "NO_NETWORK",
TRANSIENT_ERROR = "TRANSIENT_ERROR",
PERSISTENT_ERROR = "PERSISTENT_ERROR",
DISABLED = "DISABLED",
ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE"
}
export declare const NativeAuthErrorMessage: {
extensionError: {
code: string;
};
userSwitch: {
code: string;
desc: string;
};
tokensNotFoundInCache: {
code: string;
desc: string;
};
};
export declare class NativeAuthError extends AuthError {
ext: OSError | undefined;
constructor(errorCode: string, description: string, ext?: OSError);
/**
* These errors should result in a fallback to the 'standard' browser based auth flow.
*/
isFatal(): boolean;
/**
* Create the appropriate error object based on the WAM status code.
* @param code
* @param description
* @param ext
* @returns
*/
static createError(code: string, description: string, ext?: OSError): AuthError;
/**
* Creates user switch error when the user chooses a different account in the native broker prompt
* @returns
*/
static createUserSwitchError(): NativeAuthError;
/**
* Creates a tokens not found error when the internal cache look up fails
* @returns NativeAuthError: tokensNotFoundInCache
*/
static createTokensNotFoundInCacheError(): NativeAuthError;
}
//# sourceMappingURL=NativeAuthError.d.ts.map
\ No newline at end of file
{"version":3,"file":"NativeAuthError.d.ts","sourceRoot":"","sources":["../../src/error/NativeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAgC,MAAM,oBAAoB,CAAC;AAG7E,oBAAY,OAAO,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,oBAAY,gBAAgB;IACxB,yBAAyB,8BAA8B;IACvD,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;IACrB,mBAAmB,wBAAwB;CAC9C;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;CAYlC,CAAC;AAEF,qBAAa,eAAgB,SAAQ,SAAS;IAC1C,GAAG,EAAE,OAAO,GAAG,SAAS,CAAC;gBAEb,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO;IAQjE;;OAEG;IACH,OAAO,IAAI,OAAO;IAalB;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS;IAiB/E;;;OAGG;IACH,MAAM,CAAC,qBAAqB,IAAI,eAAe;IAI/C;;;OAGG;IACH,MAAM,CAAC,gCAAgC,IAAI,eAAe;CAG7D"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { __extends } from '../_virtual/_tslib.js';
import { InteractionRequiredAuthError, AuthError } from '@azure/msal-common';
import { BrowserAuthError } from './BrowserAuthError.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var NativeStatusCode;
(function (NativeStatusCode) {
NativeStatusCode["USER_INTERACTION_REQUIRED"] = "USER_INTERACTION_REQUIRED";
NativeStatusCode["USER_CANCEL"] = "USER_CANCEL";
NativeStatusCode["NO_NETWORK"] = "NO_NETWORK";
NativeStatusCode["TRANSIENT_ERROR"] = "TRANSIENT_ERROR";
NativeStatusCode["PERSISTENT_ERROR"] = "PERSISTENT_ERROR";
NativeStatusCode["DISABLED"] = "DISABLED";
NativeStatusCode["ACCOUNT_UNAVAILABLE"] = "ACCOUNT_UNAVAILABLE";
})(NativeStatusCode || (NativeStatusCode = {}));
var NativeAuthErrorMessage = {
extensionError: {
code: "ContentError"
},
userSwitch: {
code: "user_switch",
desc: "User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."
},
tokensNotFoundInCache: {
code: "tokens_not_found_in_internal_memory_cache",
desc: "Tokens not cached in MSAL JS internal memory, please make the WAM request"
}
};
var NativeAuthError = /** @class */ (function (_super) {
__extends(NativeAuthError, _super);
function NativeAuthError(errorCode, description, ext) {
var _this = _super.call(this, errorCode, description) || this;
Object.setPrototypeOf(_this, NativeAuthError.prototype);
_this.name = "NativeAuthError";
_this.ext = ext;
return _this;
}
/**
* These errors should result in a fallback to the 'standard' browser based auth flow.
*/
NativeAuthError.prototype.isFatal = function () {
if (this.ext && this.ext.status && (this.ext.status === NativeStatusCode.PERSISTENT_ERROR || this.ext.status === NativeStatusCode.DISABLED)) {
return true;
}
switch (this.errorCode) {
case NativeAuthErrorMessage.extensionError.code:
return true;
default:
return false;
}
};
/**
* Create the appropriate error object based on the WAM status code.
* @param code
* @param description
* @param ext
* @returns
*/
NativeAuthError.createError = function (code, description, ext) {
if (ext && ext.status) {
switch (ext.status) {
case NativeStatusCode.ACCOUNT_UNAVAILABLE:
return InteractionRequiredAuthError.createNativeAccountUnavailableError();
case NativeStatusCode.USER_INTERACTION_REQUIRED:
return new InteractionRequiredAuthError(code, description);
case NativeStatusCode.USER_CANCEL:
return BrowserAuthError.createUserCancelledError();
case NativeStatusCode.NO_NETWORK:
return BrowserAuthError.createNoNetworkConnectivityError();
}
}
return new NativeAuthError(code, description, ext);
};
/**
* Creates user switch error when the user chooses a different account in the native broker prompt
* @returns
*/
NativeAuthError.createUserSwitchError = function () {
return new NativeAuthError(NativeAuthErrorMessage.userSwitch.code, NativeAuthErrorMessage.userSwitch.desc);
};
/**
* Creates a tokens not found error when the internal cache look up fails
* @returns NativeAuthError: tokensNotFoundInCache
*/
NativeAuthError.createTokensNotFoundInCacheError = function () {
return new NativeAuthError(NativeAuthErrorMessage.tokensNotFoundInCache.code, NativeAuthErrorMessage.tokensNotFoundInCache.desc);
};
return NativeAuthError;
}(AuthError));
export { NativeAuthError, NativeAuthErrorMessage, NativeStatusCode };
//# sourceMappingURL=NativeAuthError.js.map
{"version":3,"file":"NativeAuthError.js","sources":["../../src/error/NativeAuthError.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError, InteractionRequiredAuthError } from \"@azure/msal-common\";\nimport { BrowserAuthError } from \"./BrowserAuthError\";\n\nexport type OSError = {\n error: number;\n protocol_error: string;\n properties: object;\n status: string;\n retryable?: boolean;\n};\n\nexport enum NativeStatusCode {\n USER_INTERACTION_REQUIRED = \"USER_INTERACTION_REQUIRED\",\n USER_CANCEL = \"USER_CANCEL\",\n NO_NETWORK = \"NO_NETWORK\",\n TRANSIENT_ERROR = \"TRANSIENT_ERROR\",\n PERSISTENT_ERROR = \"PERSISTENT_ERROR\",\n DISABLED = \"DISABLED\",\n ACCOUNT_UNAVAILABLE = \"ACCOUNT_UNAVAILABLE\"\n}\n\nexport const NativeAuthErrorMessage = {\n extensionError: {\n code: \"ContentError\"\n },\n userSwitch: {\n code: \"user_switch\",\n desc: \"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again.\"\n },\n tokensNotFoundInCache: {\n code: \"tokens_not_found_in_internal_memory_cache\",\n desc: \"Tokens not cached in MSAL JS internal memory, please make the WAM request\"\n }\n};\n\nexport class NativeAuthError extends AuthError {\n ext: OSError | undefined;\n\n constructor(errorCode: string, description: string, ext?: OSError) {\n super(errorCode, description);\n\n Object.setPrototypeOf(this, NativeAuthError.prototype);\n this.name = \"NativeAuthError\";\n this.ext = ext;\n }\n\n /**\n * These errors should result in a fallback to the 'standard' browser based auth flow.\n */\n isFatal(): boolean {\n if (this.ext && this.ext.status && (this.ext.status === NativeStatusCode.PERSISTENT_ERROR || this.ext.status === NativeStatusCode.DISABLED)) {\n return true;\n }\n\n switch (this.errorCode) {\n case NativeAuthErrorMessage.extensionError.code:\n return true;\n default:\n return false;\n }\n }\n\n /**\n * Create the appropriate error object based on the WAM status code.\n * @param code\n * @param description\n * @param ext\n * @returns\n */\n static createError(code: string, description: string, ext?: OSError): AuthError {\n if (ext && ext.status) {\n switch (ext.status) {\n case NativeStatusCode.ACCOUNT_UNAVAILABLE:\n return InteractionRequiredAuthError.createNativeAccountUnavailableError();\n case NativeStatusCode.USER_INTERACTION_REQUIRED:\n return new InteractionRequiredAuthError(code, description);\n case NativeStatusCode.USER_CANCEL:\n return BrowserAuthError.createUserCancelledError();\n case NativeStatusCode.NO_NETWORK:\n return BrowserAuthError.createNoNetworkConnectivityError();\n }\n }\n\n return new NativeAuthError(code, description, ext);\n }\n\n /**\n * Creates user switch error when the user chooses a different account in the native broker prompt\n * @returns\n */\n static createUserSwitchError(): NativeAuthError {\n return new NativeAuthError(NativeAuthErrorMessage.userSwitch.code, NativeAuthErrorMessage.userSwitch.desc);\n }\n\n /**\n * Creates a tokens not found error when the internal cache look up fails\n * @returns NativeAuthError: tokensNotFoundInCache\n */\n static createTokensNotFoundInCacheError(): NativeAuthError {\n return new NativeAuthError(NativeAuthErrorMessage.tokensNotFoundInCache.code, NativeAuthErrorMessage.tokensNotFoundInCache.desc);\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;IAgBY;AAAZ,WAAY,gBAAgB;IACxB,2EAAuD,CAAA;IACvD,+CAA2B,CAAA;IAC3B,6CAAyB,CAAA;IACzB,uDAAmC,CAAA;IACnC,yDAAqC,CAAA;IACrC,yCAAqB,CAAA;IACrB,+DAA2C,CAAA;AAC/C,CAAC,EARW,gBAAgB,KAAhB,gBAAgB,QAQ3B;IAEY,sBAAsB,GAAG;IAClC,cAAc,EAAE;QACZ,IAAI,EAAE,cAAc;KACvB;IACD,UAAU,EAAE;QACR,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,oKAAoK;KAC7K;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,2CAA2C;QACjD,IAAI,EAAE,2EAA2E;KACpF;EACH;;IAEmC,mCAAS;IAG1C,yBAAY,SAAiB,EAAE,WAAmB,EAAE,GAAa;QAAjE,YACI,kBAAM,SAAS,EAAE,WAAW,CAAC,SAKhC;QAHG,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;QACvD,KAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,KAAI,CAAC,GAAG,GAAG,GAAG,CAA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I,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;KACpI;IACL,sBAAC;AAAD,CAlEA,CAAqC,SAAS;;;;"}
\ No newline at end of file
import { ICrypto, Logger } from "@azure/msal-common";
import { InteractionType } from "../utils/BrowserConstants";
import { EventCallbackFunction, EventError, EventPayload } from "./EventMessage";
import { EventType } from "./EventType";
export declare class EventHandler {
private eventCallbacks;
private logger;
private browserCrypto;
private listeningToStorageEvents;
constructor(logger: Logger, browserCrypto: ICrypto);
/**
* Adds event callbacks to array
* @param callback
*/
addEventCallback(callback: EventCallbackFunction): string | null;
/**
* Removes callback with provided id from callback array
* @param callbackId
*/
removeEventCallback(callbackId: string): void;
/**
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
enableAccountStorageEvents(): void;
/**
* Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
disableAccountStorageEvents(): void;
/**
* Emits events by calling callback with event message
* @param eventType
* @param interactionType
* @param payload
* @param error
*/
emitEvent(eventType: EventType, interactionType?: InteractionType, payload?: EventPayload, error?: EventError): void;
/**
* Emit account added/removed events when cached accounts are changed in a different tab or frame
*/
private handleAccountCacheChange;
}
//# sourceMappingURL=EventHandler.d.ts.map
\ No newline at end of file
{"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../src/event/EventHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,EAA+B,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,YAAY;IAErB,OAAO,CAAC,cAAc,CAAqC;IAC3D,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,wBAAwB,CAAU;gBAE9B,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO;IAQlD;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI;IAYhE;;;OAGG;IACH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAK7C;;OAEG;IACH,0BAA0B,IAAI,IAAI;IAclC;;OAEG;IACH,2BAA2B,IAAI,IAAI;IAcnC;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI;IAmBpH;;OAEG;IACH,OAAO,CAAC,wBAAwB;CAuBnC"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { AccountEntity, CacheManager } from '@azure/msal-common';
import { EventType } from './EventType.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var EventHandler = /** @class */ (function () {
function EventHandler(logger, browserCrypto) {
this.eventCallbacks = new Map();
this.logger = logger;
this.browserCrypto = browserCrypto;
this.listeningToStorageEvents = false;
this.handleAccountCacheChange = this.handleAccountCacheChange.bind(this);
}
/**
* Adds event callbacks to array
* @param callback
*/
EventHandler.prototype.addEventCallback = function (callback) {
if (typeof window !== "undefined") {
var callbackId = this.browserCrypto.createNewGuid();
this.eventCallbacks.set(callbackId, callback);
this.logger.verbose("Event callback registered with id: " + callbackId);
return callbackId;
}
return null;
};
/**
* Removes callback with provided id from callback array
* @param callbackId
*/
EventHandler.prototype.removeEventCallback = function (callbackId) {
this.eventCallbacks.delete(callbackId);
this.logger.verbose("Event callback " + callbackId + " removed.");
};
/**
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
EventHandler.prototype.enableAccountStorageEvents = function () {
if (typeof window === "undefined") {
return;
}
if (!this.listeningToStorageEvents) {
this.logger.verbose("Adding account storage listener.");
this.listeningToStorageEvents = true;
window.addEventListener("storage", this.handleAccountCacheChange);
}
else {
this.logger.verbose("Account storage listener already registered.");
}
};
/**
* Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
EventHandler.prototype.disableAccountStorageEvents = function () {
if (typeof window === "undefined") {
return;
}
if (this.listeningToStorageEvents) {
this.logger.verbose("Removing account storage listener.");
window.removeEventListener("storage", this.handleAccountCacheChange);
this.listeningToStorageEvents = false;
}
else {
this.logger.verbose("No account storage listener registered.");
}
};
/**
* Emits events by calling callback with event message
* @param eventType
* @param interactionType
* @param payload
* @param error
*/
EventHandler.prototype.emitEvent = function (eventType, interactionType, payload, error) {
var _this = this;
if (typeof window !== "undefined") {
var message_1 = {
eventType: eventType,
interactionType: interactionType || null,
payload: payload || null,
error: error || null,
timestamp: Date.now()
};
this.logger.info("Emitting event: " + eventType);
this.eventCallbacks.forEach(function (callback, callbackId) {
_this.logger.verbose("Emitting event to callback " + callbackId + ": " + eventType);
callback.apply(null, [message_1]);
});
}
};
/**
* Emit account added/removed events when cached accounts are changed in a different tab or frame
*/
EventHandler.prototype.handleAccountCacheChange = function (e) {
try {
var cacheValue = e.newValue || e.oldValue;
if (!cacheValue) {
return;
}
var parsedValue = JSON.parse(cacheValue);
if (typeof parsedValue !== "object" || !AccountEntity.isAccountEntity(parsedValue)) {
return;
}
var accountEntity = CacheManager.toObject(new AccountEntity(), parsedValue);
var accountInfo = accountEntity.getAccountInfo();
if (!e.oldValue && e.newValue) {
this.logger.info("Account was added to cache in a different window");
this.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);
}
else if (!e.newValue && e.oldValue) {
this.logger.info("Account was removed from cache in a different window");
this.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);
}
}
catch (e) {
return;
}
};
return EventHandler;
}());
export { EventHandler };
//# sourceMappingURL=EventHandler.js.map
{"version":3,"file":"EventHandler.js","sources":["../../src/event/EventHandler.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, Logger, AccountEntity, CacheManager } from \"@azure/msal-common\";\nimport { InteractionType } from \"../utils/BrowserConstants\";\nimport { EventCallbackFunction, EventError, EventMessage, EventPayload } from \"./EventMessage\";\nimport { EventType } from \"./EventType\";\n\nexport class EventHandler {\n // Callback for subscribing to events\n private eventCallbacks: Map<string, EventCallbackFunction>;\n private logger: Logger;\n private browserCrypto: ICrypto;\n private listeningToStorageEvents: boolean;\n\n constructor(logger: Logger, browserCrypto: ICrypto) {\n this.eventCallbacks = new Map();\n this.logger = logger;\n this.browserCrypto = browserCrypto;\n this.listeningToStorageEvents = false;\n this.handleAccountCacheChange = this.handleAccountCacheChange.bind(this);\n }\n\n /**\n * Adds event callbacks to array\n * @param callback\n */\n addEventCallback(callback: EventCallbackFunction): string | null {\n if (typeof window !== \"undefined\") {\n const callbackId = this.browserCrypto.createNewGuid();\n this.eventCallbacks.set(callbackId, callback);\n this.logger.verbose(`Event callback registered with id: ${callbackId}`);\n \n return callbackId;\n }\n \n return null;\n }\n\n /**\n * Removes callback with provided id from callback array\n * @param callbackId\n */\n removeEventCallback(callbackId: string): void {\n this.eventCallbacks.delete(callbackId);\n this.logger.verbose(`Event callback ${callbackId} removed.`);\n }\n\n /**\n * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\n */\n enableAccountStorageEvents(): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (!this.listeningToStorageEvents) {\n this.logger.verbose(\"Adding account storage listener.\");\n this.listeningToStorageEvents = true;\n window.addEventListener(\"storage\", this.handleAccountCacheChange);\n } else {\n this.logger.verbose(\"Account storage listener already registered.\");\n }\n }\n\n /**\n * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\n */\n disableAccountStorageEvents(): void {\n if (typeof window === \"undefined\") {\n return;\n }\n\n if (this.listeningToStorageEvents) {\n this.logger.verbose(\"Removing account storage listener.\");\n window.removeEventListener(\"storage\", this.handleAccountCacheChange);\n this.listeningToStorageEvents = false;\n } else {\n this.logger.verbose(\"No account storage listener registered.\");\n }\n }\n\n /**\n * Emits events by calling callback with event message\n * @param eventType\n * @param interactionType\n * @param payload\n * @param error\n */\n emitEvent(eventType: EventType, interactionType?: InteractionType, payload?: EventPayload, error?: EventError): void {\n if (typeof window !== \"undefined\") {\n const message: EventMessage = {\n eventType: eventType,\n interactionType: interactionType || null,\n payload: payload || null,\n error: error || null,\n timestamp: Date.now()\n };\n\n this.logger.info(`Emitting event: ${eventType}`);\n\n this.eventCallbacks.forEach((callback: EventCallbackFunction, callbackId: string) => {\n this.logger.verbose(`Emitting event to callback ${callbackId}: ${eventType}`);\n callback.apply(null, [message]);\n });\n }\n }\n\n /**\n * Emit account added/removed events when cached accounts are changed in a different tab or frame\n */\n private handleAccountCacheChange(e: StorageEvent): void {\n try {\n const cacheValue = e.newValue || e.oldValue;\n if (!cacheValue) {\n return;\n }\n const parsedValue = JSON.parse(cacheValue);\n if (typeof parsedValue !== \"object\" || !AccountEntity.isAccountEntity(parsedValue)) {\n return;\n }\n const accountEntity = CacheManager.toObject<AccountEntity>(new AccountEntity(), parsedValue);\n const accountInfo = accountEntity.getAccountInfo();\n if (!e.oldValue && e.newValue) {\n this.logger.info(\"Account was added to cache in a different window\");\n this.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);\n } else if (!e.newValue && e.oldValue) {\n this.logger.info(\"Account was removed from cache in a different window\");\n this.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);\n }\n } catch (e) {\n return;\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;IAiBI,sBAAY,MAAc,EAAE,aAAsB;QAC9C,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,w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AChF,OAAO;aACV;YACD,IAAM,aAAa,GAAG,YAAY,CAAC,QAAQ,CAAgB,IAAI,aAAa,EAAE,EAAE,WAAW,CAAC,CAAC;YAC7F,IAAM,WAAW,GAAG,aAAa,CAAC,cAAc,EAAE,CAAC;YACnD,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,EAAE;gBAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;gBACrE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;aACnE;iBAAM,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,EAAE;gBAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;gBACzE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;aACrE;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,OAAO;SACV;KACJ;IACL,mBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
import { AuthenticationResult, AuthError, AccountInfo } from "@azure/msal-common";
import { EventType } from "./EventType";
import { InteractionStatus, InteractionType } from "../utils/BrowserConstants";
import { PopupRequest, RedirectRequest, SilentRequest, SsoSilentRequest, EndSessionRequest } from "..";
export declare type EventMessage = {
eventType: EventType;
interactionType: InteractionType | null;
payload: EventPayload;
error: EventError;
timestamp: number;
};
export declare type PopupEvent = {
popupWindow: Window;
};
export declare type EventPayload = AccountInfo | PopupRequest | RedirectRequest | SilentRequest | SsoSilentRequest | EndSessionRequest | AuthenticationResult | PopupEvent | null;
export declare type EventError = AuthError | Error | null;
export declare type EventCallbackFunction = (message: EventMessage) => void;
export declare class EventMessageUtils {
/**
* Gets interaction status from event message
* @param message
* @param currentStatus
*/
static getInteractionStatusFromEvent(message: EventMessage, currentStatus?: InteractionStatus): InteractionStatus | null;
}
//# sourceMappingURL=EventMessage.d.ts.map
\ No newline at end of file
{"version":3,"file":"EventMessage.d.ts","sourceRoot":"","sources":["../../src/event/EventMessage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAEvG,oBAAY,YAAY,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACxC,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,oBAAY,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,UAAU,GAAG,IAAI,CAAC;AAE1K,oBAAY,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC;AAElD,oBAAY,qBAAqB,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAEpE,qBAAa,iBAAiB;IAE1B;;;;OAIG;IACH,MAAM,CAAC,6BAA6B,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,GAAC,IAAI;CAmDzH"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { EventType } from './EventType.js';
import { InteractionType, InteractionStatus } from '../utils/BrowserConstants.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var EventMessageUtils = /** @class */ (function () {
function EventMessageUtils() {
}
/**
* Gets interaction status from event message
* @param message
* @param currentStatus
*/
EventMessageUtils.getInteractionStatusFromEvent = function (message, currentStatus) {
switch (message.eventType) {
case EventType.LOGIN_START:
return InteractionStatus.Login;
case EventType.SSO_SILENT_START:
return InteractionStatus.SsoSilent;
case EventType.ACQUIRE_TOKEN_START:
if (message.interactionType === InteractionType.Redirect || message.interactionType === InteractionType.Popup) {
return InteractionStatus.AcquireToken;
}
break;
case EventType.HANDLE_REDIRECT_START:
return InteractionStatus.HandleRedirect;
case EventType.LOGOUT_START:
return InteractionStatus.Logout;
case EventType.SSO_SILENT_SUCCESS:
case EventType.SSO_SILENT_FAILURE:
if (currentStatus && currentStatus !== InteractionStatus.SsoSilent) {
// Prevent this event from clearing any status other than ssoSilent
break;
}
return InteractionStatus.None;
case EventType.LOGOUT_END:
if (currentStatus && currentStatus !== InteractionStatus.Logout) {
// Prevent this event from clearing any status other than logout
break;
}
return InteractionStatus.None;
case EventType.HANDLE_REDIRECT_END:
if (currentStatus && currentStatus !== InteractionStatus.HandleRedirect) {
// Prevent this event from clearing any status other than handleRedirect
break;
}
return InteractionStatus.None;
case EventType.LOGIN_SUCCESS:
case EventType.LOGIN_FAILURE:
case EventType.ACQUIRE_TOKEN_SUCCESS:
case EventType.ACQUIRE_TOKEN_FAILURE:
if (message.interactionType === InteractionType.Redirect || message.interactionType === InteractionType.Popup) {
if (currentStatus && currentStatus !== InteractionStatus.Login && currentStatus !== InteractionStatus.AcquireToken) {
// Prevent this event from clearing any status other than login or acquireToken
break;
}
return InteractionStatus.None;
}
break;
}
return null;
};
return EventMessageUtils;
}());
export { EventMessageUtils };
//# sourceMappingURL=EventMessage.js.map
{"version":3,"file":"EventMessage.js","sources":["../../src/event/EventMessage.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, AuthError, AccountInfo } from \"@azure/msal-common\";\nimport { EventType } from \"./EventType\";\nimport { InteractionStatus, InteractionType } from \"../utils/BrowserConstants\";\nimport { PopupRequest, RedirectRequest, SilentRequest, SsoSilentRequest, EndSessionRequest } from \"..\";\n\nexport type EventMessage = {\n eventType: EventType;\n interactionType: InteractionType | null;\n payload: EventPayload;\n error: EventError;\n timestamp: number;\n};\n\nexport type PopupEvent = {\n popupWindow: Window;\n};\n\nexport type EventPayload = AccountInfo | PopupRequest | RedirectRequest | SilentRequest | SsoSilentRequest | EndSessionRequest | AuthenticationResult | PopupEvent | null;\n\nexport type EventError = AuthError | Error | null;\n\nexport type EventCallbackFunction = (message: EventMessage) => void;\n\nexport class EventMessageUtils {\n\n /**\n * Gets interaction status from event message\n * @param message\n * @param currentStatus\n */\n static getInteractionStatusFromEvent(message: EventMessage, currentStatus?: InteractionStatus): InteractionStatus|null {\n switch (message.eventType) {\n case EventType.LOGIN_START:\n return InteractionStatus.Login;\n case EventType.SSO_SILENT_START:\n return InteractionStatus.SsoSilent;\n case EventType.ACQUIRE_TOKEN_START:\n if (message.interactionType === InteractionType.Redirect || message.interactionType === InteractionType.Popup) {\n return InteractionStatus.AcquireToken;\n }\n break;\n case EventType.HANDLE_REDIRECT_START:\n return InteractionStatus.HandleRedirect;\n case EventType.LOGOUT_START:\n return InteractionStatus.Logout;\n case EventType.SSO_SILENT_SUCCESS:\n case EventType.SSO_SILENT_FAILURE:\n if (currentStatus && currentStatus !== InteractionStatus.SsoSilent) {\n // Prevent this event from clearing any status other than ssoSilent\n break;\n }\n return InteractionStatus.None;\n case EventType.LOGOUT_END:\n if (currentStatus && currentStatus !== InteractionStatus.Logout) {\n // Prevent this event from clearing any status other than logout\n break;\n }\n return InteractionStatus.None;\n case EventType.HANDLE_REDIRECT_END:\n if (currentStatus && currentStatus !== InteractionStatus.HandleRedirect) {\n // Prevent this event from clearing any status other than handleRedirect\n break;\n }\n return InteractionStatus.None;\n case EventType.LOGIN_SUCCESS:\n case EventType.LOGIN_FAILURE:\n case EventType.ACQUIRE_TOKEN_SUCCESS:\n case EventType.ACQUIRE_TOKEN_FAILURE:\n if (message.interactionType === InteractionType.Redirect || message.interactionType === InteractionType.Popup) {\n if (currentStatus && currentStatus !== InteractionStatus.Login && currentStatus !== InteractionStatus.AcquireToken) {\n // Prevent this event from clearing any status other than login or acquireToken\n break;\n }\n return InteractionStatus.None;\n }\n break;\n default:\n break;\n }\n return null;\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;IA4BA;KA0DC;;;;;;IAnDU,+CAA6B,GAApC,UAAqC,OAAqB,EAAE,aAAiC;QACzF,QAAQ,OAAO,CAAC,SAAS;YACrB,KAAK,SAAS,CAAC,WAAW;gBACtB,OAAO,iBAAiB,CAAC,KAAK,CAAC;YACnC,KAAK,SAAS,CAAC,gBAAgB;gBAC3B,OAAO,iBAAiB,CAAC,SAAS,CAAC;YACvC,KAAK,SAAS,CAAC,mBAAmB;gBAC9B,IAAI,OAAO,CAAC,eAAe,KAAK,eAAe,CAAC,QAAQ,IAAI,OAAO,CAAC,eAAe,KAAK,eAAe,CAAC,KAAK,EAAE;oBAC3G,OAAO,iBAAiB,CAAC,YAAY,CAAC;iBACzC;gBACD,MAAM;YACV,KAAK,SAAS,CAAC,qBAAqB;gBAChC,OAAO,iBAAiB,CAAC,cAAc,CAAC;YAC5C,KAAK,SAAS,CAAC,YAAY;gBACvB,OAAO,iBAAiB,CAAC,MAAM,CAAC;YACpC,KAAK,SAAS,CAAC,kBAAkB,CAAC;YAClC,KAAK,SAAS,CAAC,kBAAkB;gBAC7B,IAAI,aAAa,IAAI,aAAa,KAAK,iBAAiB,CAAC,SAAS,EAAE;;oBAEhE,MAAM;iBACT;gBACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;YAClC,KAAK,SAAS,CAAC,UAAU;gBACrB,IAAI,aAAa,IAAI,aAAa,KAAK,iBAAiB,CAAC,MAAM,EAAE;;oBAE7D,MAAM;iBACT;gBACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;YAClC,KAAK,SAAS,CAAC,mBAAmB;gBAC9B,IAAI,aAAa,IAAI,aAAa,KAAK,iBAAiB,CAAC,cAAc,EAAE;;oBAErE,MAAM;iBACT;gBACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;YAClC,KAAK,SAAS,CAAC,aAAa,CAAC;YAC7B,KAAK,SAAS,CAAC,aAAa,CAAC;YAC7B,KAAK,SAAS,CAAC,qBAAqB,CAAC;YACrC,KAAK,SAAS,CAAC,qBAAqB;gBAChC,IAAI,OAAO,CAAC,eAAe,KAAK,eAAe,CAAC,QAAQ,IAAI,OAAO,CAAC,eAAe,KAAK,eAAe,CAAC,KAAK,EAAE;oBAC3G,IAAI,aAAa,IAAI,aAAa,KAAK,iBAAiB,CAAC,KAAK,IAAI,aAAa,KAAK,iBAAiB,CAAC,YAAY,EAAE;;wBAEhH,MAAM;qBACT;oBACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;iBACjC;gBACD,MAAM;SAGb;QACD,OAAO,IAAI,CAAC;KACf;IACL,wBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
export declare enum EventType {
INITIALIZE_START = "msal:initializeStart",
INITIALIZE_END = "msal:initializeEnd",
ACCOUNT_ADDED = "msal:accountAdded",
ACCOUNT_REMOVED = "msal:accountRemoved",
LOGIN_START = "msal:loginStart",
LOGIN_SUCCESS = "msal:loginSuccess",
LOGIN_FAILURE = "msal:loginFailure",
ACQUIRE_TOKEN_START = "msal:acquireTokenStart",
ACQUIRE_TOKEN_SUCCESS = "msal:acquireTokenSuccess",
ACQUIRE_TOKEN_FAILURE = "msal:acquireTokenFailure",
ACQUIRE_TOKEN_NETWORK_START = "msal:acquireTokenFromNetworkStart",
SSO_SILENT_START = "msal:ssoSilentStart",
SSO_SILENT_SUCCESS = "msal:ssoSilentSuccess",
SSO_SILENT_FAILURE = "msal:ssoSilentFailure",
ACQUIRE_TOKEN_BY_CODE_START = "msal:acquireTokenByCodeStart",
ACQUIRE_TOKEN_BY_CODE_SUCCESS = "msal:acquireTokenByCodeSuccess",
ACQUIRE_TOKEN_BY_CODE_FAILURE = "msal:acquireTokenByCodeFailure",
HANDLE_REDIRECT_START = "msal:handleRedirectStart",
HANDLE_REDIRECT_END = "msal:handleRedirectEnd",
POPUP_OPENED = "msal:popupOpened",
LOGOUT_START = "msal:logoutStart",
LOGOUT_SUCCESS = "msal:logoutSuccess",
LOGOUT_FAILURE = "msal:logoutFailure",
LOGOUT_END = "msal:logoutEnd"
}
//# sourceMappingURL=EventType.d.ts.map
\ No newline at end of file
{"version":3,"file":"EventType.d.ts","sourceRoot":"","sources":["../../src/event/EventType.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS;IACjB,gBAAgB,yBAAyB;IACzC,cAAc,uBAAuB;IACrC,aAAa,sBAAsB;IACnC,eAAe,wBAAwB;IACvC,WAAW,oBAAoB;IAC/B,aAAa,sBAAsB;IACnC,aAAa,sBAAsB;IACnC,mBAAmB,2BAA2B;IAC9C,qBAAqB,6BAA6B;IAClD,qBAAqB,6BAA6B;IAClD,2BAA2B,sCAAsC;IACjE,gBAAgB,wBAAwB;IACxC,kBAAkB,0BAA0B;IAC5C,kBAAkB,0BAA0B;IAC5C,2BAA2B,iCAAiC;IAC5D,6BAA6B,mCAAmC;IAChE,6BAA6B,mCAAmC;IAChE,qBAAqB,6BAA6B;IAClD,mBAAmB,2BAA2B;IAC9C,YAAY,qBAAqB;IACjC,YAAY,qBAAqB;IACjC,cAAc,uBAAuB;IACrC,cAAc,uBAAuB;IACrC,UAAU,mBAAmB;CAChC"}
\ 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.
*/
var EventType;
(function (EventType) {
EventType["INITIALIZE_START"] = "msal:initializeStart";
EventType["INITIALIZE_END"] = "msal:initializeEnd";
EventType["ACCOUNT_ADDED"] = "msal:accountAdded";
EventType["ACCOUNT_REMOVED"] = "msal:accountRemoved";
EventType["LOGIN_START"] = "msal:loginStart";
EventType["LOGIN_SUCCESS"] = "msal:loginSuccess";
EventType["LOGIN_FAILURE"] = "msal:loginFailure";
EventType["ACQUIRE_TOKEN_START"] = "msal:acquireTokenStart";
EventType["ACQUIRE_TOKEN_SUCCESS"] = "msal:acquireTokenSuccess";
EventType["ACQUIRE_TOKEN_FAILURE"] = "msal:acquireTokenFailure";
EventType["ACQUIRE_TOKEN_NETWORK_START"] = "msal:acquireTokenFromNetworkStart";
EventType["SSO_SILENT_START"] = "msal:ssoSilentStart";
EventType["SSO_SILENT_SUCCESS"] = "msal:ssoSilentSuccess";
EventType["SSO_SILENT_FAILURE"] = "msal:ssoSilentFailure";
EventType["ACQUIRE_TOKEN_BY_CODE_START"] = "msal:acquireTokenByCodeStart";
EventType["ACQUIRE_TOKEN_BY_CODE_SUCCESS"] = "msal:acquireTokenByCodeSuccess";
EventType["ACQUIRE_TOKEN_BY_CODE_FAILURE"] = "msal:acquireTokenByCodeFailure";
EventType["HANDLE_REDIRECT_START"] = "msal:handleRedirectStart";
EventType["HANDLE_REDIRECT_END"] = "msal:handleRedirectEnd";
EventType["POPUP_OPENED"] = "msal:popupOpened";
EventType["LOGOUT_START"] = "msal:logoutStart";
EventType["LOGOUT_SUCCESS"] = "msal:logoutSuccess";
EventType["LOGOUT_FAILURE"] = "msal:logoutFailure";
EventType["LOGOUT_END"] = "msal:logoutEnd";
})(EventType || (EventType = {}));
export { EventType };
//# sourceMappingURL=EventType.js.map
{"version":3,"file":"EventType.js","sources":["../../src/event/EventType.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport enum EventType {\n INITIALIZE_START = \"msal:initializeStart\",\n INITIALIZE_END = \"msal:initializeEnd\",\n ACCOUNT_ADDED = \"msal:accountAdded\",\n ACCOUNT_REMOVED = \"msal:accountRemoved\",\n LOGIN_START = \"msal:loginStart\",\n LOGIN_SUCCESS = \"msal:loginSuccess\",\n LOGIN_FAILURE = \"msal:loginFailure\",\n ACQUIRE_TOKEN_START = \"msal:acquireTokenStart\",\n ACQUIRE_TOKEN_SUCCESS = \"msal:acquireTokenSuccess\",\n ACQUIRE_TOKEN_FAILURE = \"msal:acquireTokenFailure\",\n ACQUIRE_TOKEN_NETWORK_START = \"msal:acquireTokenFromNetworkStart\",\n SSO_SILENT_START = \"msal:ssoSilentStart\",\n SSO_SILENT_SUCCESS = \"msal:ssoSilentSuccess\",\n SSO_SILENT_FAILURE = \"msal:ssoSilentFailure\",\n ACQUIRE_TOKEN_BY_CODE_START = \"msal:acquireTokenByCodeStart\",\n ACQUIRE_TOKEN_BY_CODE_SUCCESS = \"msal:acquireTokenByCodeSuccess\",\n ACQUIRE_TOKEN_BY_CODE_FAILURE = \"msal:acquireTokenByCodeFailure\",\n HANDLE_REDIRECT_START = \"msal:handleRedirectStart\",\n HANDLE_REDIRECT_END = \"msal:handleRedirectEnd\",\n POPUP_OPENED = \"msal:popupOpened\",\n LOGOUT_START = \"msal:logoutStart\",\n LOGOUT_SUCCESS = \"msal:logoutSuccess\",\n LOGOUT_FAILURE = \"msal:logoutFailure\",\n LOGOUT_END = \"msal:logoutEnd\"\n}\n"],"names":[],"mappings":";;AAAA;;;;IAKY;AAAZ,WAAY,SAAS;IACjB,sDAAyC,CAAA;IACzC,kDAAqC,CAAA;IACrC,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,2DAA8C,CAAA;IAC9C,+DAAkD,CAAA;IAClD,+DAAkD,CAAA;IAClD,8EAAiE,CAAA;IACjE,qDAAwC,CAAA;IACxC,yDAA4C,CAAA;IAC5C,yDAA4C,CAAA;IAC5C,yEAA4D,CAAA;IAC5D,6EAAgE,CAAA;IAChE,6EAAgE,CAAA;IAChE,+DAAkD,CAAA;IAClD,2DAA8C,CAAA;IAC9C,8CAAiC,CAAA;IACjC,8CAAiC,CAAA;IACjC,kDAAqC,CAAA;IACrC,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;AACjC,CAAC,EAzBW,SAAS,KAAT,SAAS;;;;"}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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