{"version":3,"sources":["webpack:///./node_modules/@azure/msal-browser/dist/index.es.js"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","__","this","constructor","create","__assign","assign","t","s","i","n","arguments","length","apply","__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","__generator","body","f","y","g","_","label","sent","trys","ops","verb","Symbol","iterator","v","op","TypeError","pop","push","__read","o","m","r","ar","error","__spread","concat","extendStatics$1","__extends$1","__assign$1","__awaiter$1","__generator$1","__spreadArrays","il","k","a","j","jl","HeaderNames","PersistentCacheKeys","AADAuthorityConstants","AADServerParamKeys","ClaimsRequestKeys","Constants","LIBRARY_NAME","SKU","CACHE_PREFIX","DEFAULT_AUTHORITY","DEFAULT_AUTHORITY_HOST","ADFS","AAD_INSTANCE_DISCOVERY_ENDPT","RESOURCE_DELIM","NO_ACCOUNT","CLAIMS","CONSUMER_UTID","OPENID_SCOPE","PROFILE_SCOPE","OFFLINE_ACCESS_SCOPE","CODE_RESPONSE_TYPE","CODE_GRANT_TYPE","RT_GRANT_TYPE","FRAGMENT_RESPONSE_MODE","S256_CODE_CHALLENGE_METHOD","URL_FORM_CONTENT_TYPE","AUTHORIZATION_PENDING","NOT_DEFINED","EMPTY_STRING","FORWARD_SLASH","SSOTypes","PromptValue","LOGIN","SELECT_ACCOUNT","CONSENT","NONE","SID","LOGIN_HINT","ResponseMode","GrantType","CacheAccountType","Separators","CredentialType","CacheSchemaType","CacheType","CodeChallengeMethodValues","PLAIN","S256","AuthenticationScheme","APP_METADATA","ClientInfo","THE_FAMILY_ID","SERVER_TELEM_CONSTANTS","SCHEMA_VERSION","MAX_HEADER_BYTES","CACHE_KEY","CATEGORY_SEPARATOR","VALUE_SEPARATOR","OVERFLOW_TRUE","OVERFLOW_FALSE","UNKNOWN_ERROR","PasswordGrantConstants","ThrottlingConstants","DEFAULT_THROTTLE_TIME_SECONDS","DEFAULT_MAX_THROTTLE_TIME_SECONDS","THROTTLING_PREFIX","Errors","INVALID_GRANT_ERROR","CLIENT_MISMATCH_ERROR","LogLevel","AuthErrorMessage","unexpectedError","code","desc","AuthError","_super","errorCode","errorMessage","suberror","_this","errorString","subError","name","createUnexpectedError","errDesc","Error","DEFAULT_CRYPTO_IMPLEMENTATION","createNewGuid","notImplErr","base64Decode","base64Encode","generatePkceCodes","_a","getPublicKeyThumbprint","signJwt","ClientAuthErrorMessage","clientInfoDecodingError","clientInfoEmptyError","tokenParsingError","nullOrEmptyToken","endpointResolutionError","hashNotDeserialized","blankGuidGenerated","invalidStateError","stateMismatchError","stateNotFoundError","nonceMismatchError","nonceNotFoundError","noTokensFoundError","multipleMatchingTokens","multipleMatchingAccounts","multipleMatchingAppMetadata","tokenRequestCannotBeMade","appendEmptyScopeError","removeEmptyScopeError","appendScopeSetError","emptyInputScopeSetError","DeviceCodePollingCancelled","DeviceCodeExpired","NoAccountInSilentRequest","invalidCacheRecord","invalidCacheEnvironment","noAccountFound","CachePluginError","noCryptoObj","invalidCacheType","unexpectedAccountType","unexpectedCredentialType","invalidAssertion","invalidClientCredential","tokenRefreshRequired","userTimeoutReached","tokenClaimsRequired","noAuthorizationCodeFromServer","ClientAuthError","createClientInfoDecodingError","caughtError","createClientInfoEmptyError","createTokenParsingError","caughtExtractionError","createTokenNullOrEmptyError","invalidRawTokenString","createEndpointDiscoveryIncompleteError","errDetail","createHashNotDeserializedError","hashParamObj","createInvalidStateError","invalidState","createStateMismatchError","createStateNotFoundError","missingState","createNonceMismatchError","createNonceNotFoundError","missingNonce","createNoTokensFoundError","createMultipleMatchingTokensInCacheError","createMultipleMatchingAccountsInCacheError","createMultipleMatchingAppMetadataInCacheError","createTokenRequestCannotBeMadeError","createAppendEmptyScopeToSetError","givenScope","createRemoveEmptyScopeFromSetError","createAppendScopeSetError","appendError","createEmptyInputScopeSetError","givenScopeSet","createDeviceCodeCancelledError","createDeviceCodeExpiredError","createNoAccountInSilentRequestError","createNullOrUndefinedCacheRecord","createInvalidCacheEnvironmentError","createNoAccountFoundError","createCachePluginError","createNoCryptoObjectError","operationName","createInvalidCacheTypeError","createUnexpectedAccountTypeError","createUnexpectedCredentialTypeError","createInvalidAssertionError","createInvalidCredentialError","createRefreshRequiredError","createUserTimeoutReachedError","createTokenClaimsRequiredError","createNoAuthCodeInServerResponseError","StringUtils","decodeAuthToken","authToken","isEmpty","tokenPartsRegex","matches","exec","JSON","stringify","crackedToken","header","JWSPayload","JWSSig","str","startsWith","search","indexOf","endsWith","lastIndexOf","queryStringToObject","query","match","pl","decode","decodeURIComponent","replace","obj","trimArrayEntries","arr","map","entry","trim","removeEmptyStringsFromArray","filter","jsonParseHelper","parse","matchPattern","pattern","input","regex","RegExp","test","AuthorityType","Logger","loggerOptions","packageName","packageVersion","level","Info","defaultLoggerCallback","localCallback","loggerCallback","piiLoggingEnabled","logLevel","clone","logMessage","options","containsPii","timestamp","Date","toUTCString","logHeader","correlationId","log","executeCallback","message","errorPii","warning","Warning","warningPii","info","infoPii","verbose","Verbose","verbosePii","isPiiLoggingEnabled","version","CredentialEntity","generateAccountId","generateAccountIdForCacheKey","homeAccountId","environment","generateCredentialId","generateCredentialIdForCacheKey","credentialType","clientId","realm","familyId","generateTarget","generateTargetForCacheKey","target","generateCredentialKey","generateCredentialCacheKey","generateType","ID_TOKEN","ACCESS_TOKEN","REFRESH_TOKEN","getCredentialType","key","toLowerCase","credentialKey","join","CACHE_KEY_SEPARATOR","accountId","clientOrFamilyId","credentialId","scopes","ClientConfigurationErrorMessage","redirectUriNotSet","postLogoutUriNotSet","claimsRequestParsingError","authorityUriInsecure","urlParseError","urlEmptyError","emptyScopesError","nonArrayScopesError","clientIdSingleScopeError","invalidPrompt","invalidClaimsRequest","tokenRequestEmptyError","logoutRequestEmptyError","invalidCodeChallengeMethod","invalidCodeChallengeParams","knownAuthoritiesAndCloudDiscoveryMetadata","invalidCloudDiscoveryMetadata","untrustedAuthority","resourceRequestParametersRequired","ClientConfigurationError","createRedirectUriEmptyError","createPostLogoutRedirectUriEmptyError","createClaimsRequestParsingError","claimsRequestParseError","createInsecureAuthorityUriError","urlString","createUrlParseError","createUrlEmptyError","createScopesNonArrayError","inputScopes","createEmptyScopesArrayError","createClientIdSingleScopeError","createInvalidPromptError","promptValue","createInvalidClaimsRequestError","createEmptyLogoutRequestError","createEmptyTokenRequestError","createInvalidCodeChallengeMethodError","createInvalidCodeChallengeParamsError","createKnownAuthoritiesCloudDiscoveryMetadataError","createInvalidCloudDiscoveryMetadataError","createUntrustedAuthorityError","createResourceRequestParametersRequiredError","ScopeSet","scopeArr","filteredInput","validateInputScopes","Set","forEach","scope","add","fromString","inputScopeString","split","containsScope","lowerCaseScopes","printScopesLowerCase","lowerCaseScopesSet","has","containsScopeSet","scopeSet","size","asArray","every","containsOnlyDefaultScopes","defaultScopeCount","appendScope","newScope","appendScopes","newScopes","removeScope","delete","removeDefaultScopes","unionScopeSets","otherScopes","unionScopes","intersectingScopeSets","sizeOtherScopes","getScopeCount","sizeThisScopes","sizeUnionScopes","array","val","printScopes","ProtocolMode","UrlString","url","_urlString","getHash","canonicalizeUri","defineProperty","get","enumerable","configurable","slice","validateAsUri","components","getUrlComponents","HostNameAndPort","PathSegments","Protocol","urlRemoveQueryStringParameter","removeHashFromUrl","replaceTenantPath","tenantId","urlObject","pathArray","COMMON","ORGANIZATIONS","constructAuthorityUriFromObject","parseHash","regEx","urlComponents","AbsolutePath","QueryString","pathSegments","substring","getDomainFromUrl","getAbsoluteUrl","relativeUrl","baseUrl","baseComponents","hashString","hashIndex1","hashIndex2","getDeserializedHash","hash","parsedHash","deserializedHash","hashContainsKnownProperties","parameters","error_description","state","TrustedAuthority","setTrustedAuthoritiesFromConfig","knownAuthorities","cloudDiscoveryMetadata","getTrustedHostList","createCloudDiscoveryMetadataFromKnownAuthorities","parsedMetadata","saveCloudDiscoveryMetadata","metadata","setTrustedAuthoritiesFromNetwork","authorityToVerify","networkInterface","instanceDiscoveryEndpoint","response","host","sendGetRequestAsync","IsInTrustedHostList","authorities","aliases","authority","TrustedHostList","authorityDomain","preferred_cache","preferred_network","keys","getCloudDiscoveryMetadata","Authority","protocolMode","canonicalAuthority","_canonicalAuthority","authorityProtocolMode","canonicalAuthorityUrlComponents","Adfs","Default","set","_canonicalAuthorityUrlComponents","discoveryComplete","replaceTenant","tenantDiscoveryResponse","authorization_endpoint","token_endpoint","end_session_endpoint","issuer","tenant","authorityType","OIDC","discoverEndpoints","openIdConfigurationEndpoint","validateAndSetPreferredNetwork","preferredNetwork","resolveEndpointsAsync","openIdConfigEndpoint","defaultOpenIdConfigurationEndpoint","isAuthorityAlias","generateEnvironmentFromAuthority","reqEnvironment","buildClientInfo","rawClientInfo","crypto","decodedClientInfo","AccountEntity","generateAccountKey","generateAccountCacheKey","username","localAccountId","ADFS_ACCOUNT_TYPE","MSAV1_ACCOUNT_TYPE","MSA","MSSTS_ACCOUNT_TYPE","MSSTS","GENERIC_ACCOUNT_TYPE","GENERIC","getAccountInfo","idTokenClaims","accountInterface","accountKey","createAccount","clientInfo","idToken","oboAssertion","cloudGraphHostName","msGraphHost","_b","_c","_d","_e","_f","account","env","claims","tid","oid","sub","preferred_username","emails","createGenericAccount","upn","generateHomeAccountId","serverClientInfo","authType","logger","cryptoObj","uid","utid","CLIENT_INFO_SEPARATOR","isAccountEntity","entity","accountInfoIsEqual","accountA","accountB","AuthToken","rawToken","extractTokenClaims","encodedToken","decodedToken","base64TokenPayload","base64Decoded","err","CacheManager","cryptoImpl","getAllAccounts","currentAccounts","getAccountsFilteredBy","accountValues","numAccounts","allAccounts","accountEntity","toObject","accountInfo","readIdTokenFromCache","secret","saveCacheRecord","cacheRecord","setAccount","setIdTokenCredential","accessToken","saveAccessToken","refreshToken","setRefreshTokenCredential","appMetadata","setAppMetadata","credential","currentTokenCache","getCredentialsFilteredBy","currentScopes","currentAccessTokens","accessTokens","tokenEntity","tokenScopeSet","removeCredential","setAccessTokenCredential","accountFilter","getAccountsFilteredByInternal","allCacheKeys","getKeys","matchingAccounts","cacheKey","getAccount","matchHomeAccountId","matchEnvironment","matchRealm","getCredentialsFilteredByInternal","matchingCredentials","idTokens","refreshTokens","credType","getSpecificCredential","matchOboAssertion","matchCredentialType","matchClientId","matchFamilyId","matchTarget","getAppMetadataFilteredBy","getAppMetadataFilteredByInternal","matchingAppMetadata","isAppMetadata","getAppMetadata","removeAllAccounts","removeAccount","removeAccountContext","removeItem","ACCOUNT","cacheEntity","CREDENTIAL","removeAppMetadata","readCacheRecord","cachedAccount","readAccountFromCache","cachedIdToken","cachedAccessToken","readAccessTokenFromCache","cachedRefreshToken","readRefreshTokenFromCache","cachedAppMetadata","readAppMetadataFromCache","idTokenFilter","credentialCache","numIdTokens","accessTokenFilter","numAccessTokens","familyRT","id","undefined","refreshTokenFilter","numRefreshTokens","appMetadataFilter","appMetadataEntries","numAppMetadata","isAppMetadataFOCI","cloudMetadata","entityScopeSet","requestTargetScopeSet","getIdTokenCredential","getAccessTokenCredential","getRefreshTokenCredential","json","propertyName","DefaultStorageClass","setServerTelemetry","getServerTelemetry","setThrottlingCache","getThrottlingCache","containsKey","clear","DEFAULT_TOKEN_RENEWAL_OFFSET_SEC","DEFAULT_SYSTEM_OPTIONS","tokenRenewalOffsetSeconds","DEFAULT_LOGGER_IMPLEMENTATION","DEFAULT_NETWORK_IMPLEMENTATION","sendPostRequestAsync","DEFAULT_LIBRARY_INFO","sku","cpu","os","DEFAULT_CLIENT_CREDENTIALS","clientSecret","clientAssertion","buildClientConfiguration","userAuthOptions","authOptions","userSystemOptions","systemOptions","userLoggerOption","storageImplementation","storageInterface","networkImplementation","cryptoImplementation","cryptoInterface","clientCredentials","libraryInfo","serverTelemetryManager","persistencePlugin","serializableCache","buildAuthOptions","clientCapabilities","AAD","KeyLocation","ServerError","ThrottlingUtils","generateThrottlingStorageKey","thumbprint","preProcess","cacheManager","throttleTime","now","THROTTLING","errorCodes","postProcess","checkResponseStatus","checkResponseForRetryAfter","thumbprintValue","calculateThrottleTime","parseInt","headers","RETRY_AFTER","error_codes","status","currentSeconds","Math","floor","min","removeThrottle","homeAccountIdentifier","NetworkManager","networkClient","sendPostRequest","tokenEndpoint","BaseClient","configuration","config","cryptoUtils","networkManager","createDefaultTokenRequestHeaders","createDefaultLibraryHeaders","CONTENT_TYPE","X_MS_LIB_CAPABILITY","X_MS_LIB_CAPABILITY_VALUE","X_CLIENT_CURR_TELEM","generateCurrentRequestHeaderValue","X_CLIENT_LAST_TELEM","generateLastRequestHeaderValue","X_CLIENT_SKU","X_CLIENT_VER","X_CLIENT_OS","X_CLIENT_CPU","executePostToTokenEndpoint","queryString","clearTelemetryCache","updateAuthority","updatedAuthority","RequestValidator","validateRedirectUri","redirectUri","validatePrompt","prompt","validateClaims","validateCodeChallengeParams","codeChallenge","codeChallengeMethod","validateCodeChallengeMethod","sanitizeEQParams","eQParams","queryParams","RequestParameterBuilder","Map","addResponseTypeCode","RESPONSE_TYPE","encodeURIComponent","addResponseMode","responseMode","RESPONSE_MODE","QUERY","addScopes","addOidcScopes","requestScopes","SCOPE","addClientId","CLIENT_ID","addRedirectUri","REDIRECT_URI","addPostLogoutRedirectUri","POST_LOGOUT_URI","addIdTokenHint","idTokenHint","ID_TOKEN_HINT","addDomainHint","domainHint","DOMAIN_HINT","addLoginHint","loginHint","addSid","sid","addClaims","mergedClaims","addClientCapabilitiesToClaims","addCorrelationId","CLIENT_REQUEST_ID","addLibraryInfo","addPrompt","PROMPT","addState","STATE","addNonce","nonce","NONCE","addCodeChallengeParams","CODE_CHALLENGE","CODE_CHALLENGE_METHOD","addAuthorizationCode","CODE","addDeviceCode","DEVICE_CODE","addRefreshToken","addCodeVerifier","codeVerifier","CODE_VERIFIER","addClientSecret","CLIENT_SECRET","addClientAssertion","CLIENT_ASSERTION","addClientAssertionType","clientAssertionType","CLIENT_ASSERTION_TYPE","addOboAssertion","OBO_ASSERTION","addRequestTokenUse","tokenUse","REQUESTED_TOKEN_USE","addGrantType","grantType","GRANT_TYPE","addClientInfo","addExtraQueryParameters","eQparams","XMS_CC","values","addUsername","addPassword","password","addPopToken","cnfString","TOKEN_TYPE","POP","REQ_CNF","createQueryString","queryParameterArray","TimeUtils","nowSeconds","round","getTime","isTokenExpired","expiresOn","offset","expirationSec","Number","offsetCurrentTimeSec","IdTokenEntity","createIdTokenEntity","idTokenEntity","isIdTokenEntity","AccessTokenEntity","createAccessTokenEntity","extExpiresOn","tokenType","atEntity","currentTime","cachedAt","toString","extendedExpiresOn","BEARER","isAccessTokenEntity","RefreshTokenEntity","createRefreshTokenEntity","rtEntity","isRefreshTokenEntity","InteractionRequiredAuthErrorMessage","InteractionRequiredAuthSubErrorMessage","InteractionRequiredAuthError","isInteractionRequiredError","isInteractionRequiredErrorCode","isInteractionRequiredSubError","isInteractionRequiredErrorDesc","some","irErrorCode","CacheRecord","accessTokenEntity","refreshTokenEntity","appMetadataEntity","ProtocolUtils","setRequestState","userState","meta","libraryState","generateLibraryState","stateObj","ts","stateString","parseRequestState","splitState","libraryStateString","libraryStateObj","userRequestState","BrowserCacheLocation","HTTP_REQUEST_TYPE","TemporaryCacheKeys","ApiId","InteractionType","PopTokenGenerator","generateCnf","resourceRequestMethod","resourceRequestUri","kidThumbprint","reqCnf","kid","xms_ksl","SW","signPopToken","tokenClaims","resourceUrlString","resourceUrlComponents","cnf","at","toUpperCase","u","q","AppMetadataEntity","generateAppMetadataKey","generateAppMetadataCacheKey","appMetaDataKeyArray","createAppMetadataEntity","isAppMetadataEntity","TokenCacheContext","tokenCache","hasChanged","cache","ResponseHandler","cacheStorage","validateServerAuthorizationCodeResponse","serverResponseHash","cachedState","client_info","validateTokenResponse","serverResponse","errString","correlation_id","trace_id","handleServerTokenResponse","serverTokenResponse","authCodePayload","handlingRefreshTokenResponse","idTokenObj","requestStateObj","cacheContext","id_token","generateCacheRecord","beforeCacheAccess","generateAuthenticationResult","afterCacheAccess","generateAccountEntity","access_token","responseScopes","tokenExpirationSeconds","expires_in","extendedTokenExpirationSeconds","ext_expires_in","token_type","refresh_token","foci","cloud_graph_host_name","msGraphhost","msgraph_host","fromTokenCache","requestState","popTokenGenerator","uniqueId","fromCache","AuthorizationCodeClient","getAuthCodeUrl","request","createAuthCodeUrlQueryString","authorizationEndpoint","acquireToken","responseHandler","executeTokenRequest","handleFragmentResponse","hashFragment","hashUrlString","serverParams","getLogoutUri","logoutRequest","createLogoutUrlQueryString","endSessionEndpoint","requestBody","createTokenRequestBody","parameterBuilder","assertion","assertionType","AUTHORIZATION_CODE_GRANT","authenticationScheme","extraScopesToConsent","extraQueryParameters","postLogoutRedirectUri","RefreshTokenClient","DeviceCodeClient","deviceCodeResponse","getDeviceCode","deviceCodeCallback","acquireTokenWithDeviceCode","executePostRequestToDeviceCodeEndpoint","deviceCodeEndpoint","userCode","deviceCode","verificationUri","expiresIn","interval","user_code","device_code","verification_uri","userSpecifiedTimeout","deviceCodeExpirationTime","pollingIntervalMilli","timeout","intervalId","setInterval","error_1","cancel","clearInterval","requestParameters","DEVICE_CODE_GRANT","acquireTokenByRefreshToken","isFOCI","noFamilyRTInCache","clientMismatchErrorWithFamilyRT","acquireTokenWithCachedRefreshToken","refreshTokenRequest","REFRESH_TOKEN_GRANT","SilentFlowClient","ClientCredentialClient","cachedAuthenticationResult","skipCache","getCachedAuthenticationResult","tokenResponse","CLIENT_CREDENTIALS_GRANT","OnBehalfOfClient","idTokenObject","JWT_BEARER","ON_BEHALF_OF","e_1","refreshTokenClient","acquireCachedToken","isRefreshRequired","incrementCacheHits","generateResultFromCacheRecord","forceRefresh","AuthorityFactory","UsernamePasswordClient","RESOURCE_OWNER_PASSWORD_GRANT","createDiscoveredInstance","authorityUri","acquireTokenAuthority","createInstance","authorityUrl","ServerTelemetryEntity","failedRequests","errors","cacheHits","isServerTelemetryEntity","validateKey","validateEntity","ThrottlingEntity","isThrottlingEntity","StubbedNetworkModule","ServerTelemetryManager","telemetryRequest","apiId","telemetryCacheKey","forceRefreshInt","platformFields","lastRequests","getLastRequests","maxErrors","maxErrorsToSend","errorCount","overflow","cacheFailedRequest","initialValue","numErrorsFlushed","serverTelemEntity","serverTelemetryEntity","dataSize","BrowserConstants","INTERACTION_IN_PROGRESS_VALUE","POPUP_WIDTH","POPUP_HEIGHT","POLL_INTERVAL_MS","MSAL_SKU","DEFAULT_REQUEST","KEY_FORMAT_JWK","MathUtils","decimalToHex","num","hex","GuidGenerator","generateGuid","buffer","Uint8Array","getRandomValues","guidHolder","guidResponse","random","isGuid","guid","regexGuid","BrowserStringUtils","stringToUtf8Arr","sDOMStr","nChr","nArrLen","nStrLen","nMapIdx","charCodeAt","aBytes","nIdx","nChrIdx","stringToArrayBuffer","dataString","data","ArrayBuffer","dataView","utf8ArrToString","sView","nPart","nLen","String","fromCharCode","Base64Encode","urlEncode","encode","urlEncodeArr","inputArr","base64EncArr","inputUtf8Arr","eqLen","sB64Enc","nMod3","nUint24","uint6ToB64","nUint6","Base64Decode","encodedString","base64DecToArr","base64String","nBlockSize","nInLen","nOutLen","ceil","nMod4","nOutIdx","nInIdx","b64ToUint6","charNum","BrowserAuthErrorMessage","pkceNotGenerated","cryptoDoesNotExist","httpMethodNotImplementedError","emptyNavigateUriError","hashEmptyError","hashDoesNotContainStateError","unableToParseStateError","stateInteractionTypeMismatchError","interactionInProgress","popUpWindowError","emptyWindowError","userCancelledError","monitorPopupTimeoutError","monitorIframeTimeoutError","redirectInIframeError","blockTokenRequestsInHiddenIframeError","iframeClosedPrematurelyError","silentSSOInsufficientInfoError","noAccountError","silentPromptValueError","noTokenRequestCacheError","unableToParseTokenRequestCacheError","noCachedAuthorityError","authRequestNotSet","notInBrowserEnvironment","databaseNotOpen","BrowserAuthError","createPkceNotGeneratedError","createCryptoNotAvailableError","createHttpMethodNotImplementedError","method","createEmptyNavigationUriError","createEmptyHashError","hashValue","createHashDoesNotContainStateError","createUnableToParseStateError","createStateInteractionTypeMismatchError","createInteractionInProgressError","createPopupWindowError","createEmptyWindowCreatedError","createUserCancelledError","createMonitorPopupTimeoutError","createMonitorIframeTimeoutError","createRedirectInIframeError","windowParentCheck","createBlockReloadInHiddenIframeError","createIframeClosedPrematurelyError","createSilentSSOInsufficientInfoError","createNoAccountError","createSilentPromptValueError","givenPrompt","createUnableToParseTokenRequestCacheError","createNoTokenRequestCacheError","createAuthRequestNotSetError","createNoCachedAuthorityError","createNonBrowserEnvironmentError","createDatabaseNotOpenError","RANDOM_BYTE_ARR_LENGTH","PkceGenerator","generateCodes","generateCodeVerifier","generateCodeChallengeFromVerifier","verifier","challenge","pkceCodeVerifierB64","pkceCodeVerifier","pkceHashedCodeVerifier","sha256Digest","PKCS1_V15_KEYGEN_ALG","S256_HASH_ALG","MODULUS_LENGTH","PUBLIC_EXPONENT","BrowserCrypto","hasCryptoAPI","_keygenAlgorithmOptions","modulusLength","publicExponent","hasIECrypto","getMSCryptoDigest","getSubtleCryptoDigest","dataBuffer","window","generateKeyPair","extractable","usages","msCryptoGenerateKey","subtle","generateKey","exportJwk","msCryptoExportJwk","exportKey","importJwk","keyString","keyBuffer","getJwkString","msCryptoImportKey","importKey","sign","msCryptoSign","hasBrowserCrypto","algorithm","digest","digestOperation","addEventListener","msGenerateKey","msExportKey","resultBuffer","resultString","msImportKey","msSign","jwk","sort","DatabaseStorage","dbName","tableName","dbOpen","open","openDB","indexedDB","event","createObjectStore","db","transaction","objectStore","dbGet","put","payload","dbPut","CryptoOps","browserCrypto","b64Encode","b64Decode","guidGenerator","pkceGenerator","DB_NAME","TABLE_NAME","DB_VERSION","keyPair","publicKeyJwk","pubKeyThumprintObj","publicJwkString","publicJwkBuffer","publicJwkHash","privateKeyJwk","unextractablePrivateKey","EXTRACTABLE","POP_KEY_USAGES","publicKey","kty","privateKey","requestMethod","requestUri","cachedKeyPair","publicKeyJwkString","encodedHeader","encodedPayload","tokenString","tokenBuffer","signatureBuffer","encodedSignature","alg","type","BrowserConfigurationAuthErrorMessage","storageNotSupportedError","noRedirectCallbacksSet","invalidCallbackObject","stubPcaInstanceCalled","inMemRedirectUnavailable","BrowserConfigurationAuthError","createStorageNotSupportedError","givenStorageLocation","createInvalidCallbackObjectError","callbackObject","createRedirectCallbacksNotSetError","createStubPcaInstanceCalledError","createInMemoryRedirectUnavailableError","BrowserStorage","cacheLocation","validateWindowStorage","windowStorage","LocalStorage","SessionStorage","storageSupported","getItem","setItem","MemoryStorage","cacheKeys","BrowserProtocolUtils","extractBrowserRequestState","parseServerResponseFromHash","locationHash","BrowserCacheManager","cacheConfig","COOKIE_LIFE_MULTIPLIER","browserStorage","setupBrowserStorage","internalStorage","migrateCacheEntries","idTokenKey","clientInfoKey","CLIENT_INFO","errorKey","ERROR","errorDescKey","ERROR_DESC","idTokenValue","clientInfoValue","errorValue","errorDescValue","keysToMigrate","index","migrateCacheEntry","newKey","setTemporaryCache","validateAndParseJson","jsonValue","parsedJson","parsedAccount","parsedIdToken","accessTokenKey","parsedAccessToken","refreshTokenKey","parsedRefreshToken","appMetadataKey","serverTelemetryKey","serverTelemetry","throttlingCacheKey","parsedThrottlingCache","throttlingCache","getTemporaryCache","generateCacheKey","storeAuthStateInCookie","itemCookie","getItemCookie","setItemCookie","clearItemCookie","cookieName","cookieValue","expires","cookieStr","expireTime","getCookieExpirationTime","document","cookie","cookieList","charAt","cookieLifeDays","today","expr","getCache","setCache","generatedKey","ADAL_ID_TOKEN","generateAuthorityKey","stateId","AUTHORITY","generateNonceKey","NONCE_IDTOKEN","generateStateKey","REQUEST_STATE","getCachedAuthority","stateCacheKey","authorityCacheKey","updateCacheEntries","authorityInstance","nonceCacheKey","resetRequestCache","REQUEST_PARAMS","ORIGIN_URI","URL_HASH","INTERACTION_STATUS_KEY","cleanRequestByState","stateKey","cleanRequestByInteractionType","interactionType","parsedState","cacheCodeRequest","authCodeRequest","encodedValue","getCachedRequest","encodedTokenRequest","parsedRequest","cachedAuthority","DEFAULT_BROWSER_CACHE_MANAGER","cacheOptions","FetchClient","fetch","GET","getFetchHeaders","getHeaderDict","reqBody","POST","Headers","optionsHeaders","append","headerDict","XhrClient","sendRequestAsync","xhr","XMLHttpRequest","setXhrHeaders","onload","responseText","jsonResponse","networkResponse","onerror","send","headers_1","setRequestHeader","headerString","getAllResponseHeaders","headerArr","parts","headerName","shift","headerVal","BrowserUtils","navigateWindow","urlNavigate","navigationTimeout","noHistory","location","setTimeout","clearHash","history","replaceState","pathname","replaceHash","urlParts","isInIframe","parent","getCurrentUri","href","getHomepage","currentUrl","getBrowserNetworkClient","blockReloadInHiddenIframes","isResponseHash","blockRedirectInIframe","allowRedirectInIframe","isIframedApp","Redirect","blockNonBrowserEnvironment","isBrowserEnvironment","detectIEOrEdge","ua","navigator","userAgent","msie","msie11","msedge","isIE","isEdge","DEFAULT_POPUP_TIMEOUT_MS","DEFAULT_IFRAME_TIMEOUT_MS","DEFAULT_REDIRECT_TIMEOUT_MS","buildConfiguration","userInputAuth","auth","userInputCache","userInputSystem","system","DEFAULT_AUTH_OPTIONS","navigateToLoginRequestUrl","DEFAULT_CACHE_OPTIONS","DEFAULT_LOGGER_OPTIONS","DEFAULT_BROWSER_SYSTEM_OPTIONS","loadFrameTimeout","windowHashTimeout","iframeHashTimeout","navigateFrameWait","redirectNavigationTimeout","asyncPopups","overlayedConfig","EventType","InteractionHandler","authCodeModule","storageImpl","authModule","handleCodeResponse","networkModule","authCodeResponse","nonceKey","cachedNonce","cloud_instance_host_name","updateTokenEndpointAuthority","cloudInstanceHostname","cloudInstanceAuthorityUri","cloudInstanceAuthority","RedirectHandler","initiateAuthRequest","requestUrl","params","redirectStartPage","onRedirectNavigate","navigate","redirectTimeout","PopupHandler","unloadWindow","bind","openPopup","popup","monitorPopupForHash","popupWindow","maxTicks","ticks","closed","cleanPopup","contentHash","openSizedPopup","focus","currentWindow","winLeft","screenLeft","screenX","winTop","screenTop","screenY","width","innerWidth","documentElement","clientWidth","height","innerHeight","clientHeight","left","max","top","Popup","close","preventDefault","removeEventListener","SilentHandler","loadFrame","loadFrameSync","monitorIframeForHash","iframe","nowMark","performance","timeoutMark","removeHiddenIframe","contentWindow","frameHandle","createHiddenIframe","src","authFrame","createElement","style","visibility","position","border","setAttribute","getElementsByTagName","appendChild","parentNode","removeChild","name$1","version$1","ClientApplication","defaultAuthority","activeLocalAccountId","eventCallbacks","handleRedirectPromise","loggedInAccounts","emitEvent","HANDLE_REDIRECT_START","handleRedirectResponse","isLoggingIn","LOGIN_SUCCESS","ACQUIRE_TOKEN_SUCCESS","HANDLE_REDIRECT_END","catch","ACQUIRE_TOKEN_FAILURE","LOGIN_FAILURE","responseHash","loginRequestUrl","loginRequestUrlNormalized","currentUrlNormalized","handleHashResult","homepage","getRedirectResponseHash","validateAndExtractStateFromHash","handleHash","cachedHash","platformStateObj","cachedRequest","currentAuthority","authClient","interactionHandler","initializeServerTelemetryManager","createAuthCodeClient","acquireTokenRedirect","isLoggedIn","validRequest","navigateUrl","e_2","preflightBrowserEnvironmentCheck","ACQUIRE_TOKEN_START","LOGIN_START","preflightInteractiveRequest","initializeAuthorizationCodeRequest","acquireTokenPopup","acquireTokenPopupAsync","popupParameters","e_3","ssoSilent","silentTokenResult","e_4","Silent","SSO_SILENT_START","acquireTokenByIframe","SSO_SILENT_SUCCESS","SSO_SILENT_FAILURE","silentRequest","e_5","initializeAuthorizationRequest","silentTokenHelper","e_6","isServerError","isInvalidGrantError","ACQUIRE_TOKEN_NETWORK_START","initializeBaseRequest","acquireTokenSilent_silentFlow","createRefreshTokenClient","silentHandler","msalFrame","logout","validLogoutRequest","logoutUri","e_7","initializeLogoutRequest","LOGOUT_START","LOGOUT_SUCCESS","getActiveAccount","setActiveAccount","LOGOUT_FAILURE","getAccountByUsername","userName","accountObj","getAccountByHomeId","getAccountByLocalId","getRedirectUri","requestRedirectUri","getPostLogoutRedirectUri","requestPostLogoutRedirectUri","getDiscoveredDefaultAuthority","clientConfig","getClientConfiguration","createSilentFlowClient","requestAuthority","discoveredAuthority","validatedRequest","telemetryPayload","browserState","FRAGMENT","adalIdTokenString","adalIdToken","generatedPkceParams","eventType","message_1","callback","callbackId","addEventCallback","removeEventCallback","getLogger","setLogger","PublicClientApplication","loginRedirect","loginPopup","acquireTokenSilent","silentAuthClient","cachedToken","tokenRenewalResult","tokenRenewalError_1"],"mappings":"wHAAA;;;;;;;;;;;;;;;;AAkBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,KACzFP,EAAcC,EAAGC,IAG5B,SAASS,EAAUV,EAAGC,GAElB,SAASU,IAAOC,KAAKC,YAAcb,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEO,UAAkB,OAANN,EAAaC,OAAOY,OAAOb,IAAMU,EAAGJ,UAAYN,EAAEM,UAAW,IAAII,GAGnF,IAAII,EAAW,WAQX,OAPAA,EAAWb,OAAOc,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAIb,KADTY,EAAIG,UAAUF,GACAD,EAAOhB,OAAOK,UAAUC,eAAeC,KAAKS,EAAGZ,KAAIW,EAAEX,GAAKY,EAAEZ,IAE9E,OAAOW,GAEJF,EAASQ,MAAMX,KAAMS,YAGhC,SAASG,EAAUC,EAASC,EAAYC,EAAGC,GACvC,SAASC,EAAMC,GAAS,OAAOA,aAAiBH,EAAIG,EAAQ,IAAIH,GAAE,SAAUI,GAAWA,EAAQD,MAC/F,OAAO,IAAKH,IAAMA,EAAIK,WAAU,SAAUD,EAASE,GAC/C,SAASC,EAAUJ,GAAS,IAAMK,EAAKP,EAAUQ,KAAKN,IAAW,MAAOO,GAAKJ,EAAOI,IACpF,SAASC,EAASR,GAAS,IAAMK,EAAKP,EAAU,SAASE,IAAW,MAAOO,GAAKJ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K8oD,UAAU1F,GAAU2H,oBAAqBjvB,GAAgB4vB,OAAQprB,GACtEv2B,EAAG3H,MAAQ,EACf,KAAK,EAGD,OAFA2H,EAAGzH,KAAKS,KAAK,CAAC,EAAG,EAAG,CAAE,IACtBurB,EAAyBtuB,KAAKuqD,iCAAiC1uB,GAAM2wB,8BAA+BT,EAAct4C,eAC3G,CAAC,EAAazT,KAAKkuD,uBAAuB5/B,EAAwBy9B,EAAchsC,YAC3F,KAAK,EAED,OADAyvC,EAAmBzlD,EAAG1H,OACf,CAAC,EAAamtD,EAAiB3qB,mBAAmBknB,IAC7D,KAAK,EAGD,OAFA0D,EAAc1lD,EAAG1H,OACjBrC,KAAK8oD,UAAU1F,GAAU+F,sBAAuBrtB,GAAgB4vB,OAAQ+D,GACjE,CAAC,EAAcA,GAC1B,KAAK,EACK1lD,EAAG1H,OACT0H,EAAG3H,MAAQ,EACf,KAAK,EAED,OADA2H,EAAGzH,KAAKS,KAAK,CAAC,EAAG,EAAG,CAAE,IACf,CAAC,EAAa/C,KAAKyjC,2BAA2BsoB,IACzD,KAAK,EAGD,OAFA2D,EAAqB3lD,EAAG1H,OACxBrC,KAAK8oD,UAAU1F,GAAU+F,sBAAuBrtB,GAAgB4vB,OAAQgE,GACjE,CAAC,EAAcA,GAC1B,KAAK,EAGD,MAFAC,EAAsB5lD,EAAG1H,OACzBrC,KAAK8oD,UAAU1F,GAAUkG,sBAAuBxtB,GAAgB4vB,OAAQ,KAAMiE,GACxEA,EACV,KAAK,EAAG,MAAO,CAAC,EAAa,GAC7B,KAAK,EAAG,MAAO,CAAC,WAKzBP,EAvGiC,CAwG1C5G","file":"js/chunk-vendors~72a12953.0f3f51be.js","sourcesContent":["/*! @azure/msal-browser v2.9.0 2021-01-12 */\n'use strict';\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\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) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __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}\n\n/*! @azure/msal-common v2.1.0 2021-01-12 */\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics$1 = function(d, b) {\r\n extendStatics$1 = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics$1(d, b);\r\n};\r\n\r\nfunction __extends$1(d, b) {\r\n extendStatics$1(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$1 = function() {\r\n __assign$1 = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign$1.apply(this, arguments);\r\n};\r\n\r\nfunction __awaiter$1(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\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) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator$1(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar Constants = {\r\n LIBRARY_NAME: \"MSAL.JS\",\r\n SKU: \"msal.js.common\",\r\n // Prefix for all library cache entries\r\n CACHE_PREFIX: \"msal\",\r\n // default authority\r\n DEFAULT_AUTHORITY: \"https://login.microsoftonline.com/common/\",\r\n DEFAULT_AUTHORITY_HOST: \"login.microsoftonline.com\",\r\n // ADFS String\r\n ADFS: \"adfs\",\r\n // Default AAD Instance Discovery Endpoint\r\n AAD_INSTANCE_DISCOVERY_ENDPT: \"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=\",\r\n // Resource delimiter - used for certain cache entries\r\n RESOURCE_DELIM: \"|\",\r\n // Placeholder for non-existent account ids/objects\r\n NO_ACCOUNT: \"NO_ACCOUNT\",\r\n // Claims\r\n CLAIMS: \"claims\",\r\n // Consumer UTID\r\n CONSUMER_UTID: \"9188040d-6c67-4c5b-b112-36a304b66dad\",\r\n // Default scopes\r\n OPENID_SCOPE: \"openid\",\r\n PROFILE_SCOPE: \"profile\",\r\n OFFLINE_ACCESS_SCOPE: \"offline_access\",\r\n // Default response type for authorization code flow\r\n CODE_RESPONSE_TYPE: \"code\",\r\n CODE_GRANT_TYPE: \"authorization_code\",\r\n RT_GRANT_TYPE: \"refresh_token\",\r\n FRAGMENT_RESPONSE_MODE: \"fragment\",\r\n S256_CODE_CHALLENGE_METHOD: \"S256\",\r\n URL_FORM_CONTENT_TYPE: \"application/x-www-form-urlencoded;charset=utf-8\",\r\n AUTHORIZATION_PENDING: \"authorization_pending\",\r\n NOT_DEFINED: \"not_defined\",\r\n EMPTY_STRING: \"\",\r\n FORWARD_SLASH: \"/\"\r\n};\r\n/**\r\n * Request header names\r\n */\r\nvar HeaderNames;\r\n(function (HeaderNames) {\r\n HeaderNames[\"CONTENT_TYPE\"] = \"Content-Type\";\r\n HeaderNames[\"X_CLIENT_CURR_TELEM\"] = \"x-client-current-telemetry\";\r\n HeaderNames[\"X_CLIENT_LAST_TELEM\"] = \"x-client-last-telemetry\";\r\n HeaderNames[\"RETRY_AFTER\"] = \"Retry-After\";\r\n HeaderNames[\"X_MS_LIB_CAPABILITY\"] = \"x-ms-lib-capability\";\r\n HeaderNames[\"X_MS_LIB_CAPABILITY_VALUE\"] = \"retry-after, h429\";\r\n})(HeaderNames || (HeaderNames = {}));\r\n/**\r\n * Persistent cache keys MSAL which stay while user is logged in.\r\n */\r\nvar PersistentCacheKeys;\r\n(function (PersistentCacheKeys) {\r\n PersistentCacheKeys[\"ID_TOKEN\"] = \"idtoken\";\r\n PersistentCacheKeys[\"CLIENT_INFO\"] = \"client.info\";\r\n PersistentCacheKeys[\"ADAL_ID_TOKEN\"] = \"adal.idtoken\";\r\n PersistentCacheKeys[\"ERROR\"] = \"error\";\r\n PersistentCacheKeys[\"ERROR_DESC\"] = \"error.description\";\r\n})(PersistentCacheKeys || (PersistentCacheKeys = {}));\r\n/**\r\n * String constants related to AAD Authority\r\n */\r\nvar AADAuthorityConstants;\r\n(function (AADAuthorityConstants) {\r\n AADAuthorityConstants[\"COMMON\"] = \"common\";\r\n AADAuthorityConstants[\"ORGANIZATIONS\"] = \"organizations\";\r\n AADAuthorityConstants[\"CONSUMERS\"] = \"consumers\";\r\n})(AADAuthorityConstants || (AADAuthorityConstants = {}));\r\n/**\r\n * Keys in the hashParams sent by AAD Server\r\n */\r\nvar AADServerParamKeys;\r\n(function (AADServerParamKeys) {\r\n AADServerParamKeys[\"CLIENT_ID\"] = \"client_id\";\r\n AADServerParamKeys[\"REDIRECT_URI\"] = \"redirect_uri\";\r\n AADServerParamKeys[\"RESPONSE_TYPE\"] = \"response_type\";\r\n AADServerParamKeys[\"RESPONSE_MODE\"] = \"response_mode\";\r\n AADServerParamKeys[\"GRANT_TYPE\"] = \"grant_type\";\r\n AADServerParamKeys[\"CLAIMS\"] = \"claims\";\r\n AADServerParamKeys[\"SCOPE\"] = \"scope\";\r\n AADServerParamKeys[\"ERROR\"] = \"error\";\r\n AADServerParamKeys[\"ERROR_DESCRIPTION\"] = \"error_description\";\r\n AADServerParamKeys[\"ACCESS_TOKEN\"] = \"access_token\";\r\n AADServerParamKeys[\"ID_TOKEN\"] = \"id_token\";\r\n AADServerParamKeys[\"REFRESH_TOKEN\"] = \"refresh_token\";\r\n AADServerParamKeys[\"EXPIRES_IN\"] = \"expires_in\";\r\n AADServerParamKeys[\"STATE\"] = \"state\";\r\n AADServerParamKeys[\"NONCE\"] = \"nonce\";\r\n AADServerParamKeys[\"PROMPT\"] = \"prompt\";\r\n AADServerParamKeys[\"SESSION_STATE\"] = \"session_state\";\r\n AADServerParamKeys[\"CLIENT_INFO\"] = \"client_info\";\r\n AADServerParamKeys[\"CODE\"] = \"code\";\r\n AADServerParamKeys[\"CODE_CHALLENGE\"] = \"code_challenge\";\r\n AADServerParamKeys[\"CODE_CHALLENGE_METHOD\"] = \"code_challenge_method\";\r\n AADServerParamKeys[\"CODE_VERIFIER\"] = \"code_verifier\";\r\n AADServerParamKeys[\"CLIENT_REQUEST_ID\"] = \"client-request-id\";\r\n AADServerParamKeys[\"X_CLIENT_SKU\"] = \"x-client-SKU\";\r\n AADServerParamKeys[\"X_CLIENT_VER\"] = \"x-client-VER\";\r\n AADServerParamKeys[\"X_CLIENT_OS\"] = \"x-client-OS\";\r\n AADServerParamKeys[\"X_CLIENT_CPU\"] = \"x-client-CPU\";\r\n AADServerParamKeys[\"POST_LOGOUT_URI\"] = \"post_logout_redirect_uri\";\r\n AADServerParamKeys[\"ID_TOKEN_HINT\"] = \"id_token_hint\";\r\n AADServerParamKeys[\"DEVICE_CODE\"] = \"device_code\";\r\n AADServerParamKeys[\"CLIENT_SECRET\"] = \"client_secret\";\r\n AADServerParamKeys[\"CLIENT_ASSERTION\"] = \"client_assertion\";\r\n AADServerParamKeys[\"CLIENT_ASSERTION_TYPE\"] = \"client_assertion_type\";\r\n AADServerParamKeys[\"TOKEN_TYPE\"] = \"token_type\";\r\n AADServerParamKeys[\"REQ_CNF\"] = \"req_cnf\";\r\n AADServerParamKeys[\"OBO_ASSERTION\"] = \"assertion\";\r\n AADServerParamKeys[\"REQUESTED_TOKEN_USE\"] = \"requested_token_use\";\r\n AADServerParamKeys[\"ON_BEHALF_OF\"] = \"on_behalf_of\";\r\n AADServerParamKeys[\"FOCI\"] = \"foci\";\r\n})(AADServerParamKeys || (AADServerParamKeys = {}));\r\n/**\r\n * Claims request keys\r\n */\r\nvar ClaimsRequestKeys;\r\n(function (ClaimsRequestKeys) {\r\n ClaimsRequestKeys[\"ACCESS_TOKEN\"] = \"access_token\";\r\n ClaimsRequestKeys[\"XMS_CC\"] = \"xms_cc\";\r\n})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));\r\n/**\r\n * we considered making this \"enum\" in the request instead of string, however it looks like the allowed list of\r\n * prompt values kept changing over past couple of years. There are some undocumented prompt values for some\r\n * internal partners too, hence the choice of generic \"string\" type instead of the \"enum\"\r\n */\r\nvar PromptValue = {\r\n LOGIN: \"login\",\r\n SELECT_ACCOUNT: \"select_account\",\r\n CONSENT: \"consent\",\r\n NONE: \"none\",\r\n};\r\n/**\r\n * SSO Types - generated to populate hints\r\n */\r\nvar SSOTypes;\r\n(function (SSOTypes) {\r\n SSOTypes[\"ACCOUNT\"] = \"account\";\r\n SSOTypes[\"SID\"] = \"sid\";\r\n SSOTypes[\"LOGIN_HINT\"] = \"login_hint\";\r\n SSOTypes[\"ID_TOKEN\"] = \"id_token\";\r\n SSOTypes[\"DOMAIN_HINT\"] = \"domain_hint\";\r\n SSOTypes[\"ORGANIZATIONS\"] = \"organizations\";\r\n SSOTypes[\"CONSUMERS\"] = \"consumers\";\r\n SSOTypes[\"ACCOUNT_ID\"] = \"accountIdentifier\";\r\n SSOTypes[\"HOMEACCOUNT_ID\"] = \"homeAccountIdentifier\";\r\n})(SSOTypes || (SSOTypes = {}));\r\n/**\r\n * Disallowed extra query parameters.\r\n */\r\nvar BlacklistedEQParams = [\r\n SSOTypes.SID,\r\n SSOTypes.LOGIN_HINT\r\n];\r\n/**\r\n * allowed values for codeVerifier\r\n */\r\nvar CodeChallengeMethodValues = {\r\n PLAIN: \"plain\",\r\n S256: \"S256\"\r\n};\r\n/**\r\n * allowed values for response_mode\r\n */\r\nvar ResponseMode;\r\n(function (ResponseMode) {\r\n ResponseMode[\"QUERY\"] = \"query\";\r\n ResponseMode[\"FRAGMENT\"] = \"fragment\";\r\n ResponseMode[\"FORM_POST\"] = \"form_post\";\r\n})(ResponseMode || (ResponseMode = {}));\r\n/**\r\n * allowed grant_type\r\n */\r\nvar GrantType;\r\n(function (GrantType) {\r\n GrantType[\"IMPLICIT_GRANT\"] = \"implicit\";\r\n GrantType[\"AUTHORIZATION_CODE_GRANT\"] = \"authorization_code\";\r\n GrantType[\"CLIENT_CREDENTIALS_GRANT\"] = \"client_credentials\";\r\n GrantType[\"RESOURCE_OWNER_PASSWORD_GRANT\"] = \"password\";\r\n GrantType[\"REFRESH_TOKEN_GRANT\"] = \"refresh_token\";\r\n GrantType[\"DEVICE_CODE_GRANT\"] = \"device_code\";\r\n GrantType[\"JWT_BEARER\"] = \"urn:ietf:params:oauth:grant-type:jwt-bearer\";\r\n})(GrantType || (GrantType = {}));\r\n/**\r\n * Account types in Cache\r\n */\r\nvar CacheAccountType;\r\n(function (CacheAccountType) {\r\n CacheAccountType[\"MSSTS_ACCOUNT_TYPE\"] = \"MSSTS\";\r\n CacheAccountType[\"ADFS_ACCOUNT_TYPE\"] = \"ADFS\";\r\n CacheAccountType[\"MSAV1_ACCOUNT_TYPE\"] = \"MSA\";\r\n CacheAccountType[\"GENERIC_ACCOUNT_TYPE\"] = \"Generic\"; // NTLM, Kerberos, FBA, Basic etc\r\n})(CacheAccountType || (CacheAccountType = {}));\r\n/**\r\n * Separators used in cache\r\n */\r\nvar Separators;\r\n(function (Separators) {\r\n Separators[\"CACHE_KEY_SEPARATOR\"] = \"-\";\r\n Separators[\"CLIENT_INFO_SEPARATOR\"] = \".\";\r\n})(Separators || (Separators = {}));\r\n/**\r\n * Credential Type stored in the cache\r\n */\r\nvar CredentialType;\r\n(function (CredentialType) {\r\n CredentialType[\"ID_TOKEN\"] = \"IdToken\";\r\n CredentialType[\"ACCESS_TOKEN\"] = \"AccessToken\";\r\n CredentialType[\"REFRESH_TOKEN\"] = \"RefreshToken\";\r\n})(CredentialType || (CredentialType = {}));\r\n/**\r\n * Credential Type stored in the cache\r\n */\r\nvar CacheSchemaType;\r\n(function (CacheSchemaType) {\r\n CacheSchemaType[\"ACCOUNT\"] = \"Account\";\r\n CacheSchemaType[\"CREDENTIAL\"] = \"Credential\";\r\n CacheSchemaType[\"ID_TOKEN\"] = \"IdToken\";\r\n CacheSchemaType[\"ACCESS_TOKEN\"] = \"AccessToken\";\r\n CacheSchemaType[\"REFRESH_TOKEN\"] = \"RefreshToken\";\r\n CacheSchemaType[\"APP_METADATA\"] = \"AppMetadata\";\r\n CacheSchemaType[\"TEMPORARY\"] = \"TempCache\";\r\n CacheSchemaType[\"TELEMETRY\"] = \"Telemetry\";\r\n CacheSchemaType[\"UNDEFINED\"] = \"Undefined\";\r\n CacheSchemaType[\"THROTTLING\"] = \"Throttling\";\r\n})(CacheSchemaType || (CacheSchemaType = {}));\r\n/**\r\n * Combine all cache types\r\n */\r\nvar CacheType;\r\n(function (CacheType) {\r\n CacheType[CacheType[\"ADFS\"] = 1001] = \"ADFS\";\r\n CacheType[CacheType[\"MSA\"] = 1002] = \"MSA\";\r\n CacheType[CacheType[\"MSSTS\"] = 1003] = \"MSSTS\";\r\n CacheType[CacheType[\"GENERIC\"] = 1004] = \"GENERIC\";\r\n CacheType[CacheType[\"ACCESS_TOKEN\"] = 2001] = \"ACCESS_TOKEN\";\r\n CacheType[CacheType[\"REFRESH_TOKEN\"] = 2002] = \"REFRESH_TOKEN\";\r\n CacheType[CacheType[\"ID_TOKEN\"] = 2003] = \"ID_TOKEN\";\r\n CacheType[CacheType[\"APP_METADATA\"] = 3001] = \"APP_METADATA\";\r\n CacheType[CacheType[\"UNDEFINED\"] = 9999] = \"UNDEFINED\";\r\n})(CacheType || (CacheType = {}));\r\n/**\r\n * More Cache related constants\r\n */\r\nvar APP_METADATA = \"appmetadata\";\r\nvar ClientInfo = \"client_info\";\r\nvar THE_FAMILY_ID = \"1\";\r\nvar SERVER_TELEM_CONSTANTS = {\r\n SCHEMA_VERSION: 2,\r\n MAX_HEADER_BYTES: 4000,\r\n CACHE_KEY: \"server-telemetry\",\r\n CATEGORY_SEPARATOR: \"|\",\r\n VALUE_SEPARATOR: \",\",\r\n OVERFLOW_TRUE: \"1\",\r\n OVERFLOW_FALSE: \"0\",\r\n UNKNOWN_ERROR: \"unknown_error\"\r\n};\r\n/**\r\n * Type of the authentication request\r\n */\r\nvar AuthenticationScheme;\r\n(function (AuthenticationScheme) {\r\n AuthenticationScheme[\"POP\"] = \"pop\";\r\n AuthenticationScheme[\"BEARER\"] = \"Bearer\";\r\n})(AuthenticationScheme || (AuthenticationScheme = {}));\r\n/**\r\n * Constants related to throttling\r\n */\r\nvar ThrottlingConstants = {\r\n // Default time to throttle RequestThumbprint in seconds\r\n DEFAULT_THROTTLE_TIME_SECONDS: 60,\r\n // Default maximum time to throttle in seconds, overrides what the server sends back\r\n DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,\r\n // Prefix for storing throttling entries\r\n THROTTLING_PREFIX: \"throttling\"\r\n};\r\nvar Errors = {\r\n INVALID_GRANT_ERROR: \"invalid_grant\",\r\n CLIENT_MISMATCH_ERROR: \"client_mismatch\",\r\n};\r\n/**\r\n * Password grant parameters\r\n */\r\nvar PasswordGrantConstants;\r\n(function (PasswordGrantConstants) {\r\n PasswordGrantConstants[\"username\"] = \"username\";\r\n PasswordGrantConstants[\"password\"] = \"password\";\r\n})(PasswordGrantConstants || (PasswordGrantConstants = {}));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * AuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar AuthErrorMessage = {\r\n unexpectedError: {\r\n code: \"unexpected_error\",\r\n desc: \"Unexpected error in authentication.\"\r\n }\r\n};\r\n/**\r\n * General error class thrown by the MSAL.js library.\r\n */\r\nvar AuthError = /** @class */ (function (_super) {\r\n __extends$1(AuthError, _super);\r\n function AuthError(errorCode, errorMessage, suberror) {\r\n var _this = this;\r\n var errorString = errorMessage ? errorCode + \": \" + errorMessage : errorCode;\r\n _this = _super.call(this, errorString) || this;\r\n Object.setPrototypeOf(_this, AuthError.prototype);\r\n _this.errorCode = errorCode || Constants.EMPTY_STRING;\r\n _this.errorMessage = errorMessage || \"\";\r\n _this.subError = suberror || \"\";\r\n _this.name = \"AuthError\";\r\n return _this;\r\n }\r\n /**\r\n * Creates an error that is thrown when something unexpected happens in the library.\r\n * @param errDesc\r\n */\r\n AuthError.createUnexpectedError = function (errDesc) {\r\n return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + \": \" + errDesc);\r\n };\r\n return AuthError;\r\n}(Error));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar DEFAULT_CRYPTO_IMPLEMENTATION = {\r\n createNewGuid: function () {\r\n var notImplErr = \"Crypto interface - createNewGuid() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Decode: function () {\r\n var notImplErr = \"Crypto interface - base64Decode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Encode: function () {\r\n var notImplErr = \"Crypto interface - base64Encode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n generatePkceCodes: function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator$1(this, function (_a) {\r\n notImplErr = \"Crypto interface - generatePkceCodes() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n getPublicKeyThumbprint: function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator$1(this, function (_a) {\r\n notImplErr = \"Crypto interface - getPublicKeyThumbprint() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n signJwt: function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator$1(this, function (_a) {\r\n notImplErr = \"Crypto interface - signJwt() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n }\r\n};\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ClientAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar ClientAuthErrorMessage = {\r\n clientInfoDecodingError: {\r\n code: \"client_info_decoding_error\",\r\n desc: \"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause.\"\r\n },\r\n clientInfoEmptyError: {\r\n code: \"client_info_empty_error\",\r\n desc: \"The client info was empty. Please review the trace to determine the root cause.\"\r\n },\r\n tokenParsingError: {\r\n code: \"token_parsing_error\",\r\n desc: \"Token cannot be parsed. Please review stack trace to determine root cause.\"\r\n },\r\n nullOrEmptyToken: {\r\n code: \"null_or_empty_token\",\r\n desc: \"The token is null or empty. Please review the trace to determine the root cause.\"\r\n },\r\n endpointResolutionError: {\r\n code: \"endpoints_resolution_error\",\r\n desc: \"Error: could not resolve endpoints. Please check network and try again.\"\r\n },\r\n hashNotDeserialized: {\r\n code: \"hash_not_deserialized\",\r\n desc: \"The hash parameters could not be deserialized. Please review the trace to determine the root cause.\"\r\n },\r\n blankGuidGenerated: {\r\n code: \"blank_guid_generated\",\r\n desc: \"The guid generated was blank. Please review the trace to determine the root cause.\"\r\n },\r\n invalidStateError: {\r\n code: \"invalid_state\",\r\n desc: \"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState().\"\r\n },\r\n stateMismatchError: {\r\n code: \"state_mismatch\",\r\n desc: \"State mismatch error. Please check your network. Continued requests may cause cache overflow.\"\r\n },\r\n stateNotFoundError: {\r\n code: \"state_not_found\",\r\n desc: \"State not found\"\r\n },\r\n nonceMismatchError: {\r\n code: \"nonce_mismatch\",\r\n desc: \"Nonce mismatch error. This may be caused by a race condition in concurrent requests.\"\r\n },\r\n nonceNotFoundError: {\r\n code: \"nonce_not_found\",\r\n desc: \"nonce not found\"\r\n },\r\n noTokensFoundError: {\r\n code: \"no_tokens_found\",\r\n desc: \"No tokens were found for the given scopes, and no authorization code was passed to acquireToken. You must retrieve an authorization code before making a call to acquireToken().\"\r\n },\r\n multipleMatchingTokens: {\r\n code: \"multiple_matching_tokens\",\r\n desc: \"The cache contains multiple tokens satisfying the requirements. \" +\r\n \"Call AcquireToken again providing more requirements such as authority or account.\"\r\n },\r\n multipleMatchingAccounts: {\r\n code: \"multiple_matching_accounts\",\r\n desc: \"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account\"\r\n },\r\n multipleMatchingAppMetadata: {\r\n code: \"multiple_matching_appMetadata\",\r\n desc: \"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata\"\r\n },\r\n tokenRequestCannotBeMade: {\r\n code: \"request_cannot_be_made\",\r\n desc: \"Token request cannot be made without authorization code or refresh token.\"\r\n },\r\n appendEmptyScopeError: {\r\n code: \"cannot_append_empty_scope\",\r\n desc: \"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n removeEmptyScopeError: {\r\n code: \"cannot_remove_empty_scope\",\r\n desc: \"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n appendScopeSetError: {\r\n code: \"cannot_append_scopeset\",\r\n desc: \"Cannot append ScopeSet due to error.\"\r\n },\r\n emptyInputScopeSetError: {\r\n code: \"empty_input_scopeset\",\r\n desc: \"Empty input ScopeSet cannot be processed.\"\r\n },\r\n DeviceCodePollingCancelled: {\r\n code: \"device_code_polling_cancelled\",\r\n desc: \"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.\"\r\n },\r\n DeviceCodeExpired: {\r\n code: \"device_code_expired\",\r\n desc: \"Device code is expired.\"\r\n },\r\n NoAccountInSilentRequest: {\r\n code: \"no_account_in_silent_request\",\r\n desc: \"Please pass an account object, silent flow is not supported without account information\"\r\n },\r\n invalidCacheRecord: {\r\n code: \"invalid_cache_record\",\r\n desc: \"Cache record object was null or undefined.\"\r\n },\r\n invalidCacheEnvironment: {\r\n code: \"invalid_cache_environment\",\r\n desc: \"Invalid environment when attempting to create cache entry\"\r\n },\r\n noAccountFound: {\r\n code: \"no_account_found\",\r\n desc: \"No account found in cache for given key.\"\r\n },\r\n CachePluginError: {\r\n code: \"no cache plugin set on CacheManager\",\r\n desc: \"ICachePlugin needs to be set before using readFromStorage or writeFromStorage\"\r\n },\r\n noCryptoObj: {\r\n code: \"no_crypto_object\",\r\n desc: \"No crypto object detected. This is required for the following operation: \"\r\n },\r\n invalidCacheType: {\r\n code: \"invalid_cache_type\",\r\n desc: \"Invalid cache type\"\r\n },\r\n unexpectedAccountType: {\r\n code: \"unexpected_account_type\",\r\n desc: \"Unexpected account type.\"\r\n },\r\n unexpectedCredentialType: {\r\n code: \"unexpected_credential_type\",\r\n desc: \"Unexpected credential type.\"\r\n },\r\n invalidAssertion: {\r\n code: \"invalid_assertion\",\r\n desc: \"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515\"\r\n },\r\n invalidClientCredential: {\r\n code: \"invalid_client_credential\",\r\n desc: \"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential\"\r\n },\r\n tokenRefreshRequired: {\r\n code: \"token_refresh_required\",\r\n desc: \"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.\"\r\n },\r\n userTimeoutReached: {\r\n code: \"user_timeout_reached\",\r\n desc: \"User defined timeout for device code polling reached\",\r\n },\r\n tokenClaimsRequired: {\r\n code: \"token_claims_cnf_required_for_signedjwt\",\r\n desc: \"Cannot generate a POP jwt if the token_claims are not populated\"\r\n },\r\n noAuthorizationCodeFromServer: {\r\n code: \"authorization_code_missing_from_server_response\",\r\n desc: \"Srver response does not contain an authorization code to proceed\"\r\n }\r\n};\r\n/**\r\n * Error thrown when there is an error in the client code running on the browser.\r\n */\r\nvar ClientAuthError = /** @class */ (function (_super) {\r\n __extends$1(ClientAuthError, _super);\r\n function ClientAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"ClientAuthError\";\r\n Object.setPrototypeOf(_this, ClientAuthError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when client info object doesn't decode correctly.\r\n * @param caughtError\r\n */\r\n ClientAuthError.createClientInfoDecodingError = function (caughtError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoDecodingError.code, ClientAuthErrorMessage.clientInfoDecodingError.desc + \" Failed with error: \" + caughtError);\r\n };\r\n /**\r\n * Creates an error thrown if the client info is empty.\r\n * @param rawClientInfo\r\n */\r\n ClientAuthError.createClientInfoEmptyError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoEmptyError.code, \"\" + ClientAuthErrorMessage.clientInfoEmptyError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the id token extraction errors out.\r\n * @param err\r\n */\r\n ClientAuthError.createTokenParsingError = function (caughtExtractionError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenParsingError.code, ClientAuthErrorMessage.tokenParsingError.desc + \" Failed with error: \" + caughtExtractionError);\r\n };\r\n /**\r\n * Creates an error thrown when the id token string is null or empty.\r\n * @param invalidRawTokenString\r\n */\r\n ClientAuthError.createTokenNullOrEmptyError = function (invalidRawTokenString) {\r\n return new ClientAuthError(ClientAuthErrorMessage.nullOrEmptyToken.code, ClientAuthErrorMessage.nullOrEmptyToken.desc + \" Raw Token Value: \" + invalidRawTokenString);\r\n };\r\n /**\r\n * Creates an error thrown when the endpoint discovery doesn't complete correctly.\r\n */\r\n ClientAuthError.createEndpointDiscoveryIncompleteError = function (errDetail) {\r\n return new ClientAuthError(ClientAuthErrorMessage.endpointResolutionError.code, ClientAuthErrorMessage.endpointResolutionError.desc + \" Detail: \" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when the hash cannot be deserialized.\r\n * @param hashParamObj\r\n */\r\n ClientAuthError.createHashNotDeserializedError = function (hashParamObj) {\r\n return new ClientAuthError(ClientAuthErrorMessage.hashNotDeserialized.code, ClientAuthErrorMessage.hashNotDeserialized.desc + \" Given Object: \" + hashParamObj);\r\n };\r\n /**\r\n * Creates an error thrown when the state cannot be parsed.\r\n * @param invalidState\r\n */\r\n ClientAuthError.createInvalidStateError = function (invalidState, errorString) {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidStateError.code, ClientAuthErrorMessage.invalidStateError.desc + \" Invalid State: \" + invalidState + \", Root Err: \" + errorString);\r\n };\r\n /**\r\n * Creates an error thrown when two states do not match.\r\n */\r\n ClientAuthError.createStateMismatchError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateMismatchError.code, ClientAuthErrorMessage.stateMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the state is not present\r\n * @param missingState\r\n */\r\n ClientAuthError.createStateNotFoundError = function (missingState) {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateNotFoundError.code, ClientAuthErrorMessage.stateNotFoundError.desc + \": \" + missingState);\r\n };\r\n /**\r\n * Creates an error thrown when the nonce does not match.\r\n */\r\n ClientAuthError.createNonceMismatchError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code, ClientAuthErrorMessage.nonceMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the mnonce is not present\r\n * @param missingNonce\r\n */\r\n ClientAuthError.createNonceNotFoundError = function (missingNonce) {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceNotFoundError.code, ClientAuthErrorMessage.nonceNotFoundError.desc + \": \" + missingNonce);\r\n };\r\n /**\r\n * Creates an error thrown when the authorization code required for a token request is null or empty.\r\n */\r\n ClientAuthError.createNoTokensFoundError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noTokensFoundError.code, ClientAuthErrorMessage.noTokensFoundError.desc);\r\n };\r\n /**\r\n * Throws error when multiple tokens are in cache.\r\n */\r\n ClientAuthError.createMultipleMatchingTokensInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingTokens.code, ClientAuthErrorMessage.multipleMatchingTokens.desc + \".\");\r\n };\r\n /**\r\n * Throws error when multiple accounts are in cache for the given params\r\n */\r\n ClientAuthError.createMultipleMatchingAccountsInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAccounts.code, ClientAuthErrorMessage.multipleMatchingAccounts.desc);\r\n };\r\n /**\r\n * Throws error when multiple appMetada are in cache for the given clientId.\r\n */\r\n ClientAuthError.createMultipleMatchingAppMetadataInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAppMetadata.code, ClientAuthErrorMessage.multipleMatchingAppMetadata.desc);\r\n };\r\n /**\r\n * Throws error when no auth code or refresh token is given to ServerTokenRequestParameters.\r\n */\r\n ClientAuthError.createTokenRequestCannotBeMadeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRequestCannotBeMade.code, ClientAuthErrorMessage.tokenRequestCannotBeMade.desc);\r\n };\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n ClientAuthError.createAppendEmptyScopeToSetError = function (givenScope) {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendEmptyScopeError.code, ClientAuthErrorMessage.appendEmptyScopeError.desc + \" Given Scope: \" + givenScope);\r\n };\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n ClientAuthError.createRemoveEmptyScopeFromSetError = function (givenScope) {\r\n return new ClientAuthError(ClientAuthErrorMessage.removeEmptyScopeError.code, ClientAuthErrorMessage.removeEmptyScopeError.desc + \" Given Scope: \" + givenScope);\r\n };\r\n /**\r\n * Throws error when attempting to append null or empty ScopeSet.\r\n * @param appendError\r\n */\r\n ClientAuthError.createAppendScopeSetError = function (appendError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendScopeSetError.code, ClientAuthErrorMessage.appendScopeSetError.desc + \" Detail Error: \" + appendError);\r\n };\r\n /**\r\n * Throws error if ScopeSet is null or undefined.\r\n * @param givenScopeSet\r\n */\r\n ClientAuthError.createEmptyInputScopeSetError = function (givenScopeSet) {\r\n return new ClientAuthError(ClientAuthErrorMessage.emptyInputScopeSetError.code, ClientAuthErrorMessage.emptyInputScopeSetError.desc + \" Given ScopeSet: \" + givenScopeSet);\r\n };\r\n /**\r\n * Throws error if user sets CancellationToken.cancel = true during polling of token endpoint during device code flow\r\n */\r\n ClientAuthError.createDeviceCodeCancelledError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodePollingCancelled.code, \"\" + ClientAuthErrorMessage.DeviceCodePollingCancelled.desc);\r\n };\r\n /**\r\n * Throws error if device code is expired\r\n */\r\n ClientAuthError.createDeviceCodeExpiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeExpired.code, \"\" + ClientAuthErrorMessage.DeviceCodeExpired.desc);\r\n };\r\n /**\r\n * Throws error when silent requests are made without an account object\r\n */\r\n ClientAuthError.createNoAccountInSilentRequestError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.NoAccountInSilentRequest.code, \"\" + ClientAuthErrorMessage.NoAccountInSilentRequest.desc);\r\n };\r\n /**\r\n * Throws error when cache record is null or undefined.\r\n */\r\n ClientAuthError.createNullOrUndefinedCacheRecord = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheRecord.code, ClientAuthErrorMessage.invalidCacheRecord.desc);\r\n };\r\n /**\r\n * Throws error when provided environment is not part of the CloudDiscoveryMetadata object\r\n */\r\n ClientAuthError.createInvalidCacheEnvironmentError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheEnvironment.code, ClientAuthErrorMessage.invalidCacheEnvironment.desc);\r\n };\r\n /**\r\n * Throws error when account is not found in cache.\r\n */\r\n ClientAuthError.createNoAccountFoundError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAccountFound.code, ClientAuthErrorMessage.noAccountFound.desc);\r\n };\r\n /**\r\n * Throws error if ICachePlugin not set on CacheManager.\r\n */\r\n ClientAuthError.createCachePluginError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.CachePluginError.code, \"\" + ClientAuthErrorMessage.CachePluginError.desc);\r\n };\r\n /**\r\n * Throws error if crypto object not found.\r\n * @param operationName\r\n */\r\n ClientAuthError.createNoCryptoObjectError = function (operationName) {\r\n return new ClientAuthError(ClientAuthErrorMessage.noCryptoObj.code, \"\" + ClientAuthErrorMessage.noCryptoObj.desc + operationName);\r\n };\r\n /**\r\n * Throws error if cache type is invalid.\r\n */\r\n ClientAuthError.createInvalidCacheTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheType.code, \"\" + ClientAuthErrorMessage.invalidCacheType.desc);\r\n };\r\n /**\r\n * Throws error if unexpected account type.\r\n */\r\n ClientAuthError.createUnexpectedAccountTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedAccountType.code, \"\" + ClientAuthErrorMessage.unexpectedAccountType.desc);\r\n };\r\n /**\r\n * Throws error if unexpected credential type.\r\n */\r\n ClientAuthError.createUnexpectedCredentialTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedCredentialType.code, \"\" + ClientAuthErrorMessage.unexpectedCredentialType.desc);\r\n };\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n ClientAuthError.createInvalidAssertionError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidAssertion.code, \"\" + ClientAuthErrorMessage.invalidAssertion.desc);\r\n };\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n ClientAuthError.createInvalidCredentialError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidClientCredential.code, \"\" + ClientAuthErrorMessage.invalidClientCredential.desc);\r\n };\r\n /**\r\n * Throws error if token cannot be retrieved from cache due to refresh being required.\r\n */\r\n ClientAuthError.createRefreshRequiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRefreshRequired.code, ClientAuthErrorMessage.tokenRefreshRequired.desc);\r\n };\r\n /**\r\n * Throws error if the user defined timeout is reached.\r\n */\r\n ClientAuthError.createUserTimeoutReachedError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.userTimeoutReached.code, ClientAuthErrorMessage.userTimeoutReached.desc);\r\n };\r\n /*\r\n * Throws error if token claims are not populated for a signed jwt generation\r\n */\r\n ClientAuthError.createTokenClaimsRequiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenClaimsRequired.code, ClientAuthErrorMessage.tokenClaimsRequired.desc);\r\n };\r\n /**\r\n * Throws error when the authorization code is missing from the server response\r\n */\r\n ClientAuthError.createNoAuthCodeInServerResponseError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAuthorizationCodeFromServer.code, ClientAuthErrorMessage.noAuthorizationCodeFromServer.desc);\r\n };\r\n return ClientAuthError;\r\n}(AuthError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * @hidden\r\n */\r\nvar StringUtils = /** @class */ (function () {\r\n function StringUtils() {\r\n }\r\n /**\r\n * decode a JWT\r\n *\r\n * @param authToken\r\n */\r\n StringUtils.decodeAuthToken = function (authToken) {\r\n if (StringUtils.isEmpty(authToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(authToken);\r\n }\r\n var tokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n var matches = tokenPartsRegex.exec(authToken);\r\n if (!matches || matches.length < 4) {\r\n throw ClientAuthError.createTokenParsingError(\"Given token is malformed: \" + JSON.stringify(authToken));\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 /**\r\n * Check if a string is empty.\r\n *\r\n * @param str\r\n */\r\n StringUtils.isEmpty = function (str) {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n };\r\n StringUtils.startsWith = function (str, search) {\r\n return str.indexOf(search) === 0;\r\n };\r\n StringUtils.endsWith = function (str, search) {\r\n return (str.length >= search.length) && (str.lastIndexOf(search) === (str.length - search.length));\r\n };\r\n /**\r\n * Parses string into an object.\r\n *\r\n * @param query\r\n */\r\n StringUtils.queryStringToObject = 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(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 /**\r\n * Trims entries in an array.\r\n *\r\n * @param arr\r\n */\r\n StringUtils.trimArrayEntries = function (arr) {\r\n return arr.map(function (entry) { return entry.trim(); });\r\n };\r\n /**\r\n * Removes empty strings from array\r\n * @param arr\r\n */\r\n StringUtils.removeEmptyStringsFromArray = function (arr) {\r\n return arr.filter(function (entry) {\r\n return !StringUtils.isEmpty(entry);\r\n });\r\n };\r\n /**\r\n * Attempts to parse a string into JSON\r\n * @param str\r\n */\r\n StringUtils.jsonParseHelper = function (str) {\r\n try {\r\n return JSON.parse(str);\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Tests if a given string matches a given pattern, with support for wildcards.\r\n * @param pattern Wildcard pattern to string match. Supports \"*\" for wildcards\r\n * @param input String to match against\r\n */\r\n StringUtils.matchPattern = function (pattern, input) {\r\n // https://stackoverflow.com/a/3117248/4888559\r\n var regex = new RegExp(pattern.replace(/\\*/g, \"[^ ]*\"));\r\n return regex.test(input);\r\n };\r\n return StringUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Log message level.\r\n */\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 || (LogLevel = {}));\r\n/**\r\n * Class which facilitates logging of messages to a specific place.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger(loggerOptions, packageName, packageVersion) {\r\n // Current log level, defaults to info.\r\n this.level = LogLevel.Info;\r\n var defaultLoggerCallback = function () { };\r\n this.localCallback = loggerOptions.loggerCallback || defaultLoggerCallback;\r\n this.piiLoggingEnabled = loggerOptions.piiLoggingEnabled || false;\r\n this.level = loggerOptions.logLevel || LogLevel.Info;\r\n this.packageName = packageName || Constants.EMPTY_STRING;\r\n this.packageVersion = packageVersion || Constants.EMPTY_STRING;\r\n }\r\n /**\r\n * Create new Logger with existing configurations.\r\n */\r\n Logger.prototype.clone = function (packageName, packageVersion) {\r\n return new Logger({ loggerCallback: this.localCallback, piiLoggingEnabled: this.piiLoggingEnabled, logLevel: this.level }, packageName, packageVersion);\r\n };\r\n /**\r\n * Log message with required options.\r\n */\r\n Logger.prototype.logMessage = function (logMessage, options) {\r\n if ((options.logLevel > this.level) || (!this.piiLoggingEnabled && options.containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n var logHeader = StringUtils.isEmpty(this.correlationId) ? \"[\" + timestamp + \"] : \" : \"[\" + timestamp + \"] : [\" + this.correlationId + \"]\";\r\n var log = logHeader + \" : \" + this.packageName + \"@\" + this.packageVersion + \" : \" + LogLevel[options.logLevel] + \" - \" + logMessage;\r\n // debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? \"-Pii\": \"\"}${options.context ? `:${options.context}` : \"\"}`)(logMessage);\r\n this.executeCallback(options.logLevel, log, options.containsPii || false);\r\n };\r\n /**\r\n * Execute callback with message.\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 * Logs error messages.\r\n */\r\n Logger.prototype.error = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: false,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs error messages with PII.\r\n */\r\n Logger.prototype.errorPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: true,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs warning messages.\r\n */\r\n Logger.prototype.warning = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: false,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs warning messages with PII.\r\n */\r\n Logger.prototype.warningPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: true,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs info messages.\r\n */\r\n Logger.prototype.info = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: false,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs info messages with PII.\r\n */\r\n Logger.prototype.infoPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: true,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs verbose messages.\r\n */\r\n Logger.prototype.verbose = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: false,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Logs verbose messages with PII.\r\n */\r\n Logger.prototype.verbosePii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: true,\r\n correlationId: correlationId || \"\"\r\n });\r\n };\r\n /**\r\n * Returns whether PII Logging is enabled or not.\r\n */\r\n Logger.prototype.isPiiLoggingEnabled = function () {\r\n return this.piiLoggingEnabled || false;\r\n };\r\n return Logger;\r\n}());\n\nvar name = \"@azure/msal-common\";\nvar version = \"2.1.0\";\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: -----\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * oboAssertion: access token passed in as part of OBO request\r\n * }\r\n */\r\nvar CredentialEntity = /** @class */ (function () {\r\n function CredentialEntity() {\r\n }\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n CredentialEntity.prototype.generateAccountId = function () {\r\n return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);\r\n };\r\n /**\r\n * Generate Credential Id key component as per the schema: --\r\n */\r\n CredentialEntity.prototype.generateCredentialId = function () {\r\n return CredentialEntity.generateCredentialIdForCacheKey(this.credentialType, this.clientId, this.realm, this.familyId);\r\n };\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n CredentialEntity.prototype.generateTarget = function () {\r\n return CredentialEntity.generateTargetForCacheKey(this.target);\r\n };\r\n /**\r\n * generates credential key\r\n */\r\n CredentialEntity.prototype.generateCredentialKey = function () {\r\n return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId);\r\n };\r\n /**\r\n * returns the type of the cache (in this case credential)\r\n */\r\n CredentialEntity.prototype.generateType = function () {\r\n switch (this.credentialType) {\r\n case CredentialType.ID_TOKEN:\r\n return CacheType.ID_TOKEN;\r\n case CredentialType.ACCESS_TOKEN:\r\n return CacheType.ACCESS_TOKEN;\r\n case CredentialType.REFRESH_TOKEN:\r\n return CacheType.REFRESH_TOKEN;\r\n default: {\r\n throw ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n }\r\n };\r\n /**\r\n * helper function to return `CredentialType`\r\n * @param key\r\n */\r\n CredentialEntity.getCredentialType = function (key) {\r\n if (key.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) !== -1) {\r\n return CredentialType.ACCESS_TOKEN;\r\n }\r\n else if (key.indexOf(CredentialType.ID_TOKEN.toLowerCase()) !== -1) {\r\n return CredentialType.ID_TOKEN;\r\n }\r\n else if (key.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) !== -1) {\r\n return CredentialType.REFRESH_TOKEN;\r\n }\r\n return Constants.NOT_DEFINED;\r\n };\r\n /**\r\n * generates credential key\r\n */\r\n CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId) {\r\n var credentialKey = [\r\n this.generateAccountIdForCacheKey(homeAccountId, environment),\r\n this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),\r\n this.generateTargetForCacheKey(target),\r\n ];\r\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * generates Account Id for keys\r\n * @param homeAccountId\r\n * @param environment\r\n */\r\n CredentialEntity.generateAccountIdForCacheKey = function (homeAccountId, environment) {\r\n var accountId = [homeAccountId, environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generates Credential Id for keys\r\n * @param credentialType\r\n * @param realm\r\n * @param clientId\r\n * @param familyId\r\n */\r\n CredentialEntity.generateCredentialIdForCacheKey = function (credentialType, clientId, realm, familyId) {\r\n var clientOrFamilyId = credentialType === CredentialType.REFRESH_TOKEN\r\n ? familyId || clientId\r\n : clientId;\r\n var credentialId = [\r\n credentialType,\r\n clientOrFamilyId,\r\n realm || \"\",\r\n ];\r\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n CredentialEntity.generateTargetForCacheKey = function (scopes) {\r\n return (scopes || \"\").toLowerCase();\r\n };\r\n return CredentialEntity;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ClientConfigurationErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar ClientConfigurationErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n claimsRequestParsingError: {\r\n code: \"claims_request_parsing_error\",\r\n desc: \"Could not parse the given claims request object.\"\r\n },\r\n authorityUriInsecure: {\r\n code: \"authority_uri_insecure\",\r\n desc: \"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options\"\r\n },\r\n urlParseError: {\r\n code: \"url_parse_error\",\r\n desc: \"URL could not be parsed into appropriate segments.\"\r\n },\r\n urlEmptyError: {\r\n code: \"empty_url_error\",\r\n desc: \"URL was empty or null.\"\r\n },\r\n emptyScopesError: {\r\n code: \"empty_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.\"\r\n },\r\n nonArrayScopesError: {\r\n code: \"nonarray_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as non-array.\"\r\n },\r\n clientIdSingleScopeError: {\r\n code: \"clientid_input_scopes_error\",\r\n desc: \"Client ID can only be provided as a single scope.\"\r\n },\r\n invalidPrompt: {\r\n code: \"invalid_prompt_value\",\r\n desc: \"Supported prompt values are 'login', 'select_account', 'consent' and 'none'. Please see here for valid configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options\",\r\n },\r\n invalidClaimsRequest: {\r\n code: \"invalid_claims\",\r\n desc: \"Given claims parameter must be a stringified JSON object.\"\r\n },\r\n tokenRequestEmptyError: {\r\n code: \"token_request_empty\",\r\n desc: \"Token request was empty and not found in cache.\"\r\n },\r\n logoutRequestEmptyError: {\r\n code: \"logout_request_empty\",\r\n desc: \"The logout request was null or undefined.\"\r\n },\r\n invalidCodeChallengeMethod: {\r\n code: \"invalid_code_challenge_method\",\r\n desc: \"code_challenge_method passed is invalid. Valid values are \\\"plain\\\" and \\\"S256\\\".\"\r\n },\r\n invalidCodeChallengeParams: {\r\n code: \"pkce_params_missing\",\r\n desc: \"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request\"\r\n },\r\n knownAuthoritiesAndCloudDiscoveryMetadata: {\r\n code: \"invalid_known_authorities\",\r\n desc: \"knownAuthorities and cloudDiscoveryMetadata cannot both be provided. Please provide cloudDiscoveryMetadata object for AAD, knownAuthorities otherwise.\"\r\n },\r\n invalidCloudDiscoveryMetadata: {\r\n code: \"invalid_cloud_discovery_metadata\",\r\n desc: \"Invalid cloudDiscoveryMetadata provided. Must be a JSON object containing tenant_discovery_endpoint and metadata fields\"\r\n },\r\n untrustedAuthority: {\r\n code: \"untrusted_authority\",\r\n desc: \"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.\"\r\n },\r\n resourceRequestParametersRequired: {\r\n code: \"resourceRequest_parameters_required\",\r\n desc: \"resourceRequestMethod and resourceRequestUri are required\"\r\n }\r\n};\r\n/**\r\n * Error thrown when there is an error in configuration of the MSAL.js library.\r\n */\r\nvar ClientConfigurationError = /** @class */ (function (_super) {\r\n __extends$1(ClientConfigurationError, _super);\r\n function ClientConfigurationError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"ClientConfigurationError\";\r\n Object.setPrototypeOf(_this, ClientConfigurationError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n ClientConfigurationError.createRedirectUriEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.redirectUriNotSet.code, ClientConfigurationErrorMessage.redirectUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n ClientConfigurationError.createPostLogoutRedirectUriEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.postLogoutUriNotSet.code, ClientConfigurationErrorMessage.postLogoutUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the claims request could not be successfully parsed\r\n */\r\n ClientConfigurationError.createClaimsRequestParsingError = function (claimsRequestParseError) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.claimsRequestParsingError.code, ClientConfigurationErrorMessage.claimsRequestParsingError.desc + \" Given value: \" + claimsRequestParseError);\r\n };\r\n /**\r\n * Creates an error thrown if authority uri is given an insecure protocol.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createInsecureAuthorityUriError = function (urlString) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityUriInsecure.code, ClientConfigurationErrorMessage.authorityUriInsecure.desc + \" Given URI: \" + urlString);\r\n };\r\n /**\r\n * Creates an error thrown if URL string does not parse into separate segments.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createUrlParseError = function (urlParseError) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlParseError.code, ClientConfigurationErrorMessage.urlParseError.desc + \" Given Error: \" + urlParseError);\r\n };\r\n /**\r\n * Creates an error thrown if URL string is empty or null.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createUrlEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlEmptyError.code, ClientConfigurationErrorMessage.urlEmptyError.desc);\r\n };\r\n /**\r\n * Error thrown when scopes are not an array\r\n * @param inputScopes\r\n */\r\n ClientConfigurationError.createScopesNonArrayError = function (inputScopes) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.nonArrayScopesError.code, ClientConfigurationErrorMessage.nonArrayScopesError.desc + \" Given Scopes: \" + inputScopes);\r\n };\r\n /**\r\n * Error thrown when scopes are empty.\r\n * @param scopesValue\r\n */\r\n ClientConfigurationError.createEmptyScopesArrayError = function (inputScopes) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.emptyScopesError.code, ClientConfigurationErrorMessage.emptyScopesError.desc + \" Given Scopes: \" + inputScopes);\r\n };\r\n /**\r\n * Error thrown when client id scope is not provided as single scope.\r\n * @param inputScopes\r\n */\r\n ClientConfigurationError.createClientIdSingleScopeError = function (inputScopes) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.clientIdSingleScopeError.code, ClientConfigurationErrorMessage.clientIdSingleScopeError.desc + \" Given Scopes: \" + inputScopes);\r\n };\r\n /**\r\n * Error thrown when prompt is not an allowed type.\r\n * @param promptValue\r\n */\r\n ClientConfigurationError.createInvalidPromptError = function (promptValue) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidPrompt.code, ClientConfigurationErrorMessage.invalidPrompt.desc + \" Given value: \" + promptValue);\r\n };\r\n /**\r\n * Creates error thrown when claims parameter is not a stringified JSON object\r\n */\r\n ClientConfigurationError.createInvalidClaimsRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidClaimsRequest.code, ClientConfigurationErrorMessage.invalidClaimsRequest.desc);\r\n };\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n ClientConfigurationError.createEmptyLogoutRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.logoutRequestEmptyError.code, ClientConfigurationErrorMessage.logoutRequestEmptyError.desc);\r\n };\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n ClientConfigurationError.createEmptyTokenRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.tokenRequestEmptyError.code, ClientConfigurationErrorMessage.tokenRequestEmptyError.desc);\r\n };\r\n /**\r\n * Throws error when an invalid code_challenge_method is passed by the user\r\n */\r\n ClientConfigurationError.createInvalidCodeChallengeMethodError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCodeChallengeMethod.code, ClientConfigurationErrorMessage.invalidCodeChallengeMethod.desc);\r\n };\r\n /**\r\n * Throws error when both params: code_challenge and code_challenge_method are not passed together\r\n */\r\n ClientConfigurationError.createInvalidCodeChallengeParamsError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCodeChallengeParams.code, ClientConfigurationErrorMessage.invalidCodeChallengeParams.desc);\r\n };\r\n /**\r\n * Throws an error when the user passes both knownAuthorities and cloudDiscoveryMetadata\r\n */\r\n ClientConfigurationError.createKnownAuthoritiesCloudDiscoveryMetadataError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.knownAuthoritiesAndCloudDiscoveryMetadata.code, ClientConfigurationErrorMessage.knownAuthoritiesAndCloudDiscoveryMetadata.desc);\r\n };\r\n /**\r\n * Throws an error when the user passes invalid cloudDiscoveryMetadata\r\n */\r\n ClientConfigurationError.createInvalidCloudDiscoveryMetadataError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.code, ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.desc);\r\n };\r\n /**\r\n * Throws error when provided authority is not a member of the trusted host list\r\n */\r\n ClientConfigurationError.createUntrustedAuthorityError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);\r\n };\r\n /**\r\n * Throws error when resourceRequestMethod or resourceRequestUri is missing\r\n */\r\n ClientConfigurationError.createResourceRequestParametersRequiredError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.resourceRequestParametersRequired.code, ClientConfigurationErrorMessage.resourceRequestParametersRequired.desc);\r\n };\r\n return ClientConfigurationError;\r\n}(ClientAuthError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes\r\n * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions\r\n * to ensure uniqueness of strings.\r\n */\r\nvar ScopeSet = /** @class */ (function () {\r\n function ScopeSet(inputScopes) {\r\n var _this = this;\r\n // Filter empty string and null/undefined array items\r\n var scopeArr = inputScopes ? StringUtils.trimArrayEntries(__spreadArrays(inputScopes)) : [];\r\n var filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];\r\n // Validate and filter scopes (validate function throws if validation fails)\r\n this.validateInputScopes(filteredInput);\r\n this.scopes = new Set(); // Iterator in constructor not supported by IE11\r\n filteredInput.forEach(function (scope) { return _this.scopes.add(scope); });\r\n }\r\n /**\r\n * Factory method to create ScopeSet from space-delimited string\r\n * @param inputScopeString\r\n * @param appClientId\r\n * @param scopesRequired\r\n */\r\n ScopeSet.fromString = function (inputScopeString) {\r\n inputScopeString = inputScopeString || \"\";\r\n var inputScopes = inputScopeString.split(\" \");\r\n return new ScopeSet(inputScopes);\r\n };\r\n /**\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not\r\n */\r\n ScopeSet.prototype.validateInputScopes = function (inputScopes) {\r\n // Check if scopes are required but not given or is an empty array\r\n if (!inputScopes || inputScopes.length < 1) {\r\n throw ClientConfigurationError.createEmptyScopesArrayError(inputScopes);\r\n }\r\n };\r\n /**\r\n * Check if a given scope is present in this set of scopes.\r\n * @param scope\r\n */\r\n ScopeSet.prototype.containsScope = function (scope) {\r\n var lowerCaseScopes = this.printScopesLowerCase().split(\" \");\r\n var lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);\r\n // compare lowercase scopes\r\n return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;\r\n };\r\n /**\r\n * Check if a set of scopes is present in this set of scopes.\r\n * @param scopeSet\r\n */\r\n ScopeSet.prototype.containsScopeSet = function (scopeSet) {\r\n var _this = this;\r\n if (!scopeSet || scopeSet.scopes.size <= 0) {\r\n return false;\r\n }\r\n return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(function (scope) { return _this.containsScope(scope); }));\r\n };\r\n /**\r\n * Check if set of scopes contains only the defaults\r\n */\r\n ScopeSet.prototype.containsOnlyDefaultScopes = function () {\r\n var defaultScopeCount = 0;\r\n if (this.containsScope(Constants.OPENID_SCOPE)) {\r\n defaultScopeCount += 1;\r\n }\r\n if (this.containsScope(Constants.PROFILE_SCOPE)) {\r\n defaultScopeCount += 1;\r\n }\r\n if (this.containsScope(Constants.OFFLINE_ACCESS_SCOPE)) {\r\n defaultScopeCount += 1;\r\n }\r\n return this.scopes.size === defaultScopeCount;\r\n };\r\n /**\r\n * Appends single scope if passed\r\n * @param newScope\r\n */\r\n ScopeSet.prototype.appendScope = function (newScope) {\r\n if (!StringUtils.isEmpty(newScope)) {\r\n this.scopes.add(newScope.trim());\r\n }\r\n };\r\n /**\r\n * Appends multiple scopes if passed\r\n * @param newScopes\r\n */\r\n ScopeSet.prototype.appendScopes = function (newScopes) {\r\n var _this = this;\r\n try {\r\n newScopes.forEach(function (newScope) { return _this.appendScope(newScope); });\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createAppendScopeSetError(e);\r\n }\r\n };\r\n /**\r\n * Removes element from set of scopes.\r\n * @param scope\r\n */\r\n ScopeSet.prototype.removeScope = function (scope) {\r\n if (StringUtils.isEmpty(scope)) {\r\n throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);\r\n }\r\n this.scopes.delete(scope.trim());\r\n };\r\n /**\r\n * Removes default scopes from set of scopes\r\n * Primarily used to prevent cache misses if the default scopes are not returned from the server\r\n */\r\n ScopeSet.prototype.removeDefaultScopes = function () {\r\n this.scopes.delete(Constants.OFFLINE_ACCESS_SCOPE);\r\n this.scopes.delete(Constants.OPENID_SCOPE);\r\n this.scopes.delete(Constants.PROFILE_SCOPE);\r\n };\r\n /**\r\n * Combines an array of scopes with the current set of scopes.\r\n * @param otherScopes\r\n */\r\n ScopeSet.prototype.unionScopeSets = function (otherScopes) {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError(otherScopes);\r\n }\r\n var unionScopes = new Set(); // Iterator in constructor not supported in IE11\r\n otherScopes.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });\r\n this.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });\r\n return unionScopes;\r\n };\r\n /**\r\n * Check if scopes intersect between this set and another.\r\n * @param otherScopes\r\n */\r\n ScopeSet.prototype.intersectingScopeSets = function (otherScopes) {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError(otherScopes);\r\n }\r\n var unionScopes = this.unionScopeSets(otherScopes);\r\n // Do not allow default scopes to be the only intersecting scopes\r\n if (!otherScopes.containsOnlyDefaultScopes()) {\r\n otherScopes.removeDefaultScopes();\r\n }\r\n var sizeOtherScopes = otherScopes.getScopeCount();\r\n var sizeThisScopes = this.getScopeCount();\r\n var sizeUnionScopes = unionScopes.size;\r\n return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);\r\n };\r\n /**\r\n * Returns size of set of scopes.\r\n */\r\n ScopeSet.prototype.getScopeCount = function () {\r\n return this.scopes.size;\r\n };\r\n /**\r\n * Returns the scopes as an array of string values\r\n */\r\n ScopeSet.prototype.asArray = function () {\r\n var array = [];\r\n this.scopes.forEach(function (val) { return array.push(val); });\r\n return array;\r\n };\r\n /**\r\n * Prints scopes into a space-delimited string\r\n */\r\n ScopeSet.prototype.printScopes = function () {\r\n if (this.scopes) {\r\n var scopeArr = this.asArray();\r\n return scopeArr.join(\" \");\r\n }\r\n return \"\";\r\n };\r\n /**\r\n * Prints scopes into a space-delimited lower-case string (used for caching)\r\n */\r\n ScopeSet.prototype.printScopesLowerCase = function () {\r\n return this.printScopes().toLowerCase();\r\n };\r\n return ScopeSet;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Authority types supported by MSAL.\r\n */\r\nvar AuthorityType;\r\n(function (AuthorityType) {\r\n AuthorityType[AuthorityType[\"Default\"] = 0] = \"Default\";\r\n AuthorityType[AuthorityType[\"Adfs\"] = 1] = \"Adfs\";\r\n})(AuthorityType || (AuthorityType = {}));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Url object class which can perform various transformations on url strings.\r\n */\r\nvar UrlString = /** @class */ (function () {\r\n function UrlString(url) {\r\n this._urlString = url;\r\n if (StringUtils.isEmpty(this._urlString)) {\r\n // Throws error if url is empty\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n if (StringUtils.isEmpty(this.getHash())) {\r\n this._urlString = UrlString.canonicalizeUri(url);\r\n }\r\n }\r\n Object.defineProperty(UrlString.prototype, \"urlString\", {\r\n get: function () {\r\n return this._urlString;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Ensure urls are lower case and end with a / character.\r\n * @param url\r\n */\r\n UrlString.canonicalizeUri = function (url) {\r\n if (url) {\r\n url = url.toLowerCase();\r\n if (StringUtils.endsWith(url, \"?\")) {\r\n url = url.slice(0, -1);\r\n }\r\n else if (StringUtils.endsWith(url, \"?/\")) {\r\n url = url.slice(0, -2);\r\n }\r\n if (!StringUtils.endsWith(url, \"/\")) {\r\n url += \"/\";\r\n }\r\n }\r\n return url;\r\n };\r\n /**\r\n * Throws if urlString passed is not a valid authority URI string.\r\n */\r\n UrlString.prototype.validateAsUri = function () {\r\n // Attempts to parse url for uri components\r\n var components;\r\n try {\r\n components = this.getUrlComponents();\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createUrlParseError(e);\r\n }\r\n // Throw error if URI or path segments are not parseable.\r\n if (!components.HostNameAndPort || !components.PathSegments) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + this.urlString);\r\n }\r\n // Throw error if uri is insecure.\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\r\n }\r\n };\r\n /**\r\n * Function to remove query string params from url. Returns the new url.\r\n * @param url\r\n * @param name\r\n */\r\n UrlString.prototype.urlRemoveQueryStringParameter = function (name) {\r\n var regex = new RegExp(\"(\\\\&\" + name + \"=)[^\\&]+\");\r\n this._urlString = this.urlString.replace(regex, \"\");\r\n // name=value&\r\n regex = new RegExp(\"(\" + name + \"=)[^\\&]+&\");\r\n this._urlString = this.urlString.replace(regex, \"\");\r\n // name=value\r\n regex = new RegExp(\"(\" + name + \"=)[^\\&]+\");\r\n this._urlString = this.urlString.replace(regex, \"\");\r\n return this.urlString;\r\n };\r\n UrlString.removeHashFromUrl = function (url) {\r\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\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 UrlString.prototype.replaceTenantPath = function (tenantId) {\r\n var urlObject = this.getUrlComponents();\r\n var pathArray = urlObject.PathSegments;\r\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\r\n pathArray[0] = tenantId;\r\n }\r\n return UrlString.constructAuthorityUriFromObject(urlObject);\r\n };\r\n /**\r\n * Returns the anchor part(#) of the URL\r\n */\r\n UrlString.prototype.getHash = function () {\r\n return UrlString.parseHash(this.urlString);\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 UrlString.prototype.getUrlComponents = function () {\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n // If url string does not match regEx, we throw an error\r\n var match = this.urlString.match(regEx);\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + this.urlString);\r\n }\r\n // Url component object\r\n var urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5],\r\n QueryString: match[7]\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 if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\r\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length - 1);\r\n }\r\n return urlComponents;\r\n };\r\n UrlString.getDomainFromUrl = function (url) {\r\n var regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\r\n var match = url.match(regEx);\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + url);\r\n }\r\n return match[2];\r\n };\r\n UrlString.getAbsoluteUrl = function (relativeUrl, baseUrl) {\r\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\r\n var url = new UrlString(baseUrl);\r\n var baseComponents = url.getUrlComponents();\r\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\r\n }\r\n return relativeUrl;\r\n };\r\n /**\r\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\r\n * @param hashString\r\n */\r\n UrlString.parseHash = function (hashString) {\r\n var hashIndex1 = hashString.indexOf(\"#\");\r\n var hashIndex2 = hashString.indexOf(\"#/\");\r\n if (hashIndex2 > -1) {\r\n return hashString.substring(hashIndex2 + 2);\r\n }\r\n else if (hashIndex1 > -1) {\r\n return hashString.substring(hashIndex1 + 1);\r\n }\r\n return \"\";\r\n };\r\n UrlString.constructAuthorityUriFromObject = function (urlObject) {\r\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\r\n };\r\n /**\r\n * Returns URL hash as server auth code response object.\r\n */\r\n UrlString.getDeserializedHash = function (hash) {\r\n // Check if given hash is empty\r\n if (StringUtils.isEmpty(hash)) {\r\n return {};\r\n }\r\n // Strip the # symbol if present\r\n var parsedHash = UrlString.parseHash(hash);\r\n // If # symbol was not present, above will return empty string, so give original hash value\r\n var deserializedHash = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\r\n // Check if deserialization didn't work\r\n if (!deserializedHash) {\r\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\r\n }\r\n return deserializedHash;\r\n };\r\n /**\r\n * Check if the hash of the URL string contains known properties\r\n */\r\n UrlString.hashContainsKnownProperties = function (hash) {\r\n if (StringUtils.isEmpty(hash)) {\r\n return false;\r\n }\r\n var parameters = UrlString.getDeserializedHash(hash);\r\n return !!(parameters.code ||\r\n parameters.error_description ||\r\n parameters.error ||\r\n parameters.state);\r\n };\r\n return UrlString;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar TrustedAuthority = /** @class */ (function () {\r\n function TrustedAuthority() {\r\n }\r\n /**\r\n * Set the CloudDiscoveryMetadata object from knownAuthorities or cloudDiscoveryMetadata passed into the app config\r\n * @param knownAuthorities\r\n * @param cloudDiscoveryMetadata\r\n */\r\n TrustedAuthority.setTrustedAuthoritiesFromConfig = function (knownAuthorities, cloudDiscoveryMetadata) {\r\n if (!this.getTrustedHostList().length) {\r\n if (knownAuthorities.length > 0 && !StringUtils.isEmpty(cloudDiscoveryMetadata)) {\r\n throw ClientConfigurationError.createKnownAuthoritiesCloudDiscoveryMetadataError();\r\n }\r\n this.createCloudDiscoveryMetadataFromKnownAuthorities(knownAuthorities);\r\n try {\r\n if (cloudDiscoveryMetadata) {\r\n var parsedMetadata = JSON.parse(cloudDiscoveryMetadata);\r\n this.saveCloudDiscoveryMetadata(parsedMetadata.metadata);\r\n }\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();\r\n }\r\n }\r\n };\r\n /**\r\n * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config\r\n * @param networkInterface\r\n */\r\n TrustedAuthority.setTrustedAuthoritiesFromNetwork = function (authorityToVerify, networkInterface) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var instanceDiscoveryEndpoint, response, metadata, e_1, host;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n instanceDiscoveryEndpoint = \"\" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + authorityToVerify.urlString + \"oauth2/v2.0/authorize\";\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];\r\n case 2:\r\n response = _a.sent();\r\n metadata = response.body.metadata;\r\n this.saveCloudDiscoveryMetadata(metadata);\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_1 = _a.sent();\r\n return [2 /*return*/];\r\n case 4:\r\n host = authorityToVerify.getUrlComponents().HostNameAndPort;\r\n if (this.getTrustedHostList().length > 0 && !this.IsInTrustedHostList(host)) {\r\n // Custom Domain scenario, host is trusted because Instance Discovery call succeeded \r\n this.createCloudDiscoveryMetadataFromKnownAuthorities([host]);\r\n }\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n *\r\n * @param metadata\r\n */\r\n TrustedAuthority.saveCloudDiscoveryMetadata = function (metadata) {\r\n metadata.forEach(function (entry) {\r\n var authorities = entry.aliases;\r\n authorities.forEach(function (authority) {\r\n TrustedAuthority.TrustedHostList[authority.toLowerCase()] = entry;\r\n });\r\n });\r\n };\r\n /**\r\n * Create a generic metadata object for each host passed to knownAuthorities.\r\n * This is mostly useful for B2C or ADFS scenarios\r\n * @param knownAuthorities\r\n */\r\n TrustedAuthority.createCloudDiscoveryMetadataFromKnownAuthorities = function (knownAuthorities) {\r\n var _this = this;\r\n knownAuthorities.forEach(function (authority) {\r\n var authorityDomain = UrlString.getDomainFromUrl(authority).toLowerCase();\r\n _this.TrustedHostList[authorityDomain] = {\r\n preferred_cache: authorityDomain,\r\n preferred_network: authorityDomain,\r\n aliases: [authorityDomain]\r\n };\r\n });\r\n };\r\n TrustedAuthority.getTrustedHostList = function () {\r\n return Object.keys(this.TrustedHostList);\r\n };\r\n /**\r\n * Get metadata for the provided host\r\n * @param host\r\n */\r\n TrustedAuthority.getCloudDiscoveryMetadata = function (host) {\r\n return this.TrustedHostList[host.toLowerCase()] || null;\r\n };\r\n /**\r\n * Checks to see if the host is in a list of trusted hosts\r\n * @param host\r\n */\r\n TrustedAuthority.IsInTrustedHostList = function (host) {\r\n return Object.keys(this.TrustedHostList).indexOf(host.toLowerCase()) > -1;\r\n };\r\n TrustedAuthority.TrustedHostList = {};\r\n return TrustedAuthority;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Protocol modes supported by MSAL.\r\n */\r\nvar ProtocolMode;\r\n(function (ProtocolMode) {\r\n ProtocolMode[\"AAD\"] = \"AAD\";\r\n ProtocolMode[\"OIDC\"] = \"OIDC\";\r\n})(ProtocolMode || (ProtocolMode = {}));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the\r\n * endpoint. It will store the pertinent config data in this object for use during token calls.\r\n */\r\nvar Authority = /** @class */ (function () {\r\n function Authority(authority, networkInterface, protocolMode) {\r\n this.canonicalAuthority = authority;\r\n this._canonicalAuthority.validateAsUri();\r\n this.networkInterface = networkInterface;\r\n this.authorityProtocolMode = protocolMode;\r\n }\r\n Object.defineProperty(Authority.prototype, \"authorityType\", {\r\n // See above for AuthorityType\r\n get: function () {\r\n var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;\r\n if (pathSegments.length && pathSegments[0].toLowerCase() === Constants.ADFS) {\r\n return AuthorityType.Adfs;\r\n }\r\n return AuthorityType.Default;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"protocolMode\", {\r\n /**\r\n * ProtocolMode enum representing the way endpoints are constructed.\r\n */\r\n get: function () {\r\n return this.authorityProtocolMode;\r\n },\r\n enumerable: true,\r\n configurable: true\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.urlString;\r\n },\r\n /**\r\n * Sets canonical authority.\r\n */\r\n set: function (url) {\r\n this._canonicalAuthority = new UrlString(url);\r\n this._canonicalAuthority.validateAsUri();\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 /**\r\n * Get authority components.\r\n */\r\n get: function () {\r\n if (!this._canonicalAuthorityUrlComponents) {\r\n this._canonicalAuthorityUrlComponents = this._canonicalAuthority.getUrlComponents();\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, \"tenant\", {\r\n /**\r\n * Get tenant for authority.\r\n */\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 /**\r\n * OAuth /authorize endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replaceTenant(this.tenantDiscoveryResponse.authorization_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"tokenEndpoint\", {\r\n /**\r\n * OAuth /token endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replaceTenant(this.tenantDiscoveryResponse.token_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"deviceCodeEndpoint\", {\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.tenantDiscoveryResponse.token_endpoint.replace(\"/token\", \"/devicecode\");\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"endSessionEndpoint\", {\r\n /**\r\n * OAuth logout endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replaceTenant(this.tenantDiscoveryResponse.end_session_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"selfSignedJwtAudience\", {\r\n /**\r\n * OAuth issuer for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replaceTenant(this.tenantDiscoveryResponse.issuer);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Replaces tenant in url path with current tenant. Defaults to common.\r\n * @param urlString\r\n */\r\n Authority.prototype.replaceTenant = function (urlString) {\r\n return urlString.replace(/{tenant}|{tenantid}/g, this.tenant);\r\n };\r\n Object.defineProperty(Authority.prototype, \"defaultOpenIdConfigurationEndpoint\", {\r\n /**\r\n * The default open id configuration endpoint for any canonical authority.\r\n */\r\n get: function () {\r\n if (this.authorityType === AuthorityType.Adfs || this.protocolMode === ProtocolMode.OIDC) {\r\n return this.canonicalAuthority + \".well-known/openid-configuration\";\r\n }\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 * Boolean that returns whethr or not tenant discovery has been completed.\r\n */\r\n Authority.prototype.discoveryComplete = function () {\r\n return !!this.tenantDiscoveryResponse;\r\n };\r\n /**\r\n * Gets OAuth endpoints from the given OpenID configuration endpoint.\r\n * @param openIdConfigurationEndpoint\r\n */\r\n Authority.prototype.discoverEndpoints = function (openIdConfigurationEndpoint) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n return __generator$1(this, function (_a) {\r\n return [2 /*return*/, this.networkInterface.sendGetRequestAsync(openIdConfigurationEndpoint)];\r\n });\r\n });\r\n };\r\n /**\r\n * Set the trusted hosts and validate subsequent calls\r\n */\r\n Authority.prototype.validateAndSetPreferredNetwork = function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var host, preferredNetwork;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n host = this.canonicalAuthorityUrlComponents.HostNameAndPort;\r\n if (!(TrustedAuthority.getTrustedHostList().length === 0)) return [3 /*break*/, 2];\r\n return [4 /*yield*/, TrustedAuthority.setTrustedAuthoritiesFromNetwork(this._canonicalAuthority, this.networkInterface)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n if (!TrustedAuthority.IsInTrustedHostList(host)) {\r\n throw ClientConfigurationError.createUntrustedAuthorityError();\r\n }\r\n preferredNetwork = TrustedAuthority.getCloudDiscoveryMetadata(host).preferred_network;\r\n if (host !== preferredNetwork) {\r\n this.canonicalAuthority = this.canonicalAuthority.replace(host, preferredNetwork);\r\n }\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Perform endpoint discovery to discover the /authorize, /token and logout endpoints.\r\n */\r\n Authority.prototype.resolveEndpointsAsync = function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var openIdConfigEndpoint, response;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateAndSetPreferredNetwork()];\r\n case 1:\r\n _a.sent();\r\n openIdConfigEndpoint = this.defaultOpenIdConfigurationEndpoint;\r\n return [4 /*yield*/, this.discoverEndpoints(openIdConfigEndpoint)];\r\n case 2:\r\n response = _a.sent();\r\n this.tenantDiscoveryResponse = response.body;\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Determine if given hostname is alias of this authority\r\n * @param host\r\n */\r\n Authority.prototype.isAuthorityAlias = function (host) {\r\n if (host === this.canonicalAuthorityUrlComponents.HostNameAndPort) {\r\n return true;\r\n }\r\n var aliases = TrustedAuthority.getCloudDiscoveryMetadata(this.canonicalAuthorityUrlComponents.HostNameAndPort).aliases;\r\n return aliases.indexOf(host) !== -1;\r\n };\r\n /**\r\n * helper function to generate environment from authority object\r\n * @param authority\r\n */\r\n Authority.generateEnvironmentFromAuthority = function (authority) {\r\n var reqEnvironment = authority.canonicalAuthorityUrlComponents.HostNameAndPort;\r\n return TrustedAuthority.getCloudDiscoveryMetadata(reqEnvironment) ? TrustedAuthority.getCloudDiscoveryMetadata(reqEnvironment).preferred_cache : \"\";\r\n };\r\n return Authority;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Function to build a client info object\r\n * @param rawClientInfo\r\n * @param crypto\r\n */\r\nfunction buildClientInfo(rawClientInfo, crypto) {\r\n if (StringUtils.isEmpty(rawClientInfo)) {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n try {\r\n var decodedClientInfo = crypto.base64Decode(rawClientInfo);\r\n return JSON.parse(decodedClientInfo);\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createClientInfoDecodingError(e);\r\n }\r\n}\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: --\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * name: Full name for the account, including given name and family name,\r\n * clientInfo: Full base64 encoded client info received from ESTS\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * oboAssertion: access token passed in as part of OBO request\r\n * idTokenClaims: Object containing claims parsed from ID token\r\n * }\r\n */\r\nvar AccountEntity = /** @class */ (function () {\r\n function AccountEntity() {\r\n }\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n AccountEntity.prototype.generateAccountId = function () {\r\n var accountId = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generate Account Cache Key as per the schema: --\r\n */\r\n AccountEntity.prototype.generateAccountKey = function () {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId\r\n });\r\n };\r\n /**\r\n * returns the type of the cache (in this case account)\r\n */\r\n AccountEntity.prototype.generateType = function () {\r\n switch (this.authorityType) {\r\n case CacheAccountType.ADFS_ACCOUNT_TYPE:\r\n return CacheType.ADFS;\r\n case CacheAccountType.MSAV1_ACCOUNT_TYPE:\r\n return CacheType.MSA;\r\n case CacheAccountType.MSSTS_ACCOUNT_TYPE:\r\n return CacheType.MSSTS;\r\n case CacheAccountType.GENERIC_ACCOUNT_TYPE:\r\n return CacheType.GENERIC;\r\n default: {\r\n throw ClientAuthError.createUnexpectedAccountTypeError();\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n AccountEntity.prototype.getAccountInfo = function () {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n idTokenClaims: this.idTokenClaims\r\n };\r\n };\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n AccountEntity.generateAccountCacheKey = function (accountInterface) {\r\n var accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || \"\",\r\n accountInterface.tenantId || \"\",\r\n ];\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\r\n * @param clientInfo\r\n * @param authority\r\n * @param idToken\r\n * @param policy\r\n */\r\n AccountEntity.createAccount = function (clientInfo, homeAccountId, authority, idToken, oboAssertion, cloudGraphHostName, msGraphHost) {\r\n var _a, _b, _c, _d, _e, _f;\r\n var account = new AccountEntity();\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n account.clientInfo = clientInfo;\r\n account.homeAccountId = homeAccountId;\r\n var env = Authority.generateEnvironmentFromAuthority(authority);\r\n if (StringUtils.isEmpty(env)) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || \"\";\r\n account.oboAssertion = oboAssertion;\r\n if (idToken) {\r\n account.idTokenClaims = idToken.claims;\r\n // How do you account for MSA CID here?\r\n account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) || \"\";\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array. In most cases it will contain a single email.\r\n * This field should not be relied upon if a custom policy is configured to return more than 1 email.\r\n */\r\n account.username = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username) || (((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] : \"\");\r\n account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;\r\n }\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n return account;\r\n };\r\n /**\r\n * Builds non-AAD/ADFS account.\r\n * @param authority\r\n * @param idToken\r\n */\r\n AccountEntity.createGenericAccount = function (authority, homeAccountId, idToken, oboAssertion, cloudGraphHostName, msGraphHost) {\r\n var _a, _b, _c, _d;\r\n var account = new AccountEntity();\r\n account.authorityType = (authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n account.homeAccountId = homeAccountId;\r\n // non AAD scenarios can have empty realm\r\n account.realm = \"\";\r\n account.oboAssertion = oboAssertion;\r\n var env = Authority.generateEnvironmentFromAuthority(authority);\r\n if (StringUtils.isEmpty(env)) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n if (idToken) {\r\n // How do you account for MSA CID here?\r\n account.localAccountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.oid) || ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.sub) || \"\";\r\n // upn claim for most ADFS scenarios\r\n account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) || \"\";\r\n account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) || \"\";\r\n account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;\r\n }\r\n account.environment = env;\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n /*\r\n * add uniqueName to claims\r\n * account.name = idToken.claims.uniqueName;\r\n */\r\n return account;\r\n };\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idToken) {\r\n var _a;\r\n var accountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.sub) ? idToken.claims.sub : Constants.EMPTY_STRING;\r\n // since ADFS does not have tid and does not set client_info\r\n if (authType === AuthorityType.Adfs) {\r\n return accountId;\r\n }\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n var clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\r\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\r\n return \"\" + clientInfo.uid + Separators.CLIENT_INFO_SEPARATOR + clientInfo.utid;\r\n }\r\n }\r\n // default to \"sub\" claim\r\n logger.verbose(\"No client info in response\");\r\n return accountId;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AccountEntity.isAccountEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\"));\r\n };\r\n /**\r\n * Helper function to determine whether 2 accounts are equal\r\n * Used to avoid unnecessary state updates\r\n * @param arrayA\r\n * @param arrayB\r\n */\r\n AccountEntity.accountInfoIsEqual = function (accountA, accountB) {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n return (accountA.homeAccountId === accountB.homeAccountId) &&\r\n (accountA.localAccountId === accountB.localAccountId) &&\r\n (accountA.username === accountB.username) &&\r\n (accountA.tenantId === accountB.tenantId) &&\r\n (accountA.environment === accountB.environment);\r\n };\r\n return AccountEntity;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * JWT Token representation class. Parses token string and generates claims object.\r\n */\r\nvar AuthToken = /** @class */ (function () {\r\n function AuthToken(rawToken, crypto) {\r\n if (StringUtils.isEmpty(rawToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(rawToken);\r\n }\r\n this.rawToken = rawToken;\r\n this.claims = AuthToken.extractTokenClaims(rawToken, crypto);\r\n }\r\n /**\r\n * Extract token by decoding the rawToken\r\n *\r\n * @param encodedToken\r\n */\r\n AuthToken.extractTokenClaims = function (encodedToken, crypto) {\r\n var decodedToken = StringUtils.decodeAuthToken(encodedToken);\r\n // token will be decoded to get the username\r\n try {\r\n var base64TokenPayload = decodedToken.JWSPayload;\r\n // base64Decode() should throw an error if there is an issue\r\n var base64Decoded = crypto.base64Decode(base64TokenPayload);\r\n return JSON.parse(base64Decoded);\r\n }\r\n catch (err) {\r\n throw ClientAuthError.createTokenParsingError(err);\r\n }\r\n };\r\n return AuthToken;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\r\n */\r\nvar CacheManager = /** @class */ (function () {\r\n function CacheManager(clientId, cryptoImpl) {\r\n this.clientId = clientId;\r\n this.cryptoImpl = cryptoImpl;\r\n }\r\n /**\r\n * Returns all accounts in cache\r\n */\r\n CacheManager.prototype.getAllAccounts = function () {\r\n var _this = this;\r\n var currentAccounts = this.getAccountsFilteredBy();\r\n var accountValues = Object.keys(currentAccounts).map(function (accountKey) { return currentAccounts[accountKey]; });\r\n var numAccounts = accountValues.length;\r\n if (numAccounts < 1) {\r\n return [];\r\n }\r\n else {\r\n var allAccounts = accountValues.map(function (value) {\r\n var accountEntity = CacheManager.toObject(new AccountEntity(), value);\r\n var accountInfo = accountEntity.getAccountInfo();\r\n var idToken = _this.readIdTokenFromCache(_this.clientId, accountInfo);\r\n if (idToken && !accountInfo.idTokenClaims) {\r\n accountInfo.idTokenClaims = new AuthToken(idToken.secret, _this.cryptoImpl).claims;\r\n }\r\n return accountInfo;\r\n });\r\n return allAccounts;\r\n }\r\n };\r\n /**\r\n * saves a cache record\r\n * @param cacheRecord\r\n */\r\n CacheManager.prototype.saveCacheRecord = function (cacheRecord) {\r\n if (!cacheRecord) {\r\n throw ClientAuthError.createNullOrUndefinedCacheRecord();\r\n }\r\n if (!!cacheRecord.account) {\r\n this.setAccount(cacheRecord.account);\r\n }\r\n if (!!cacheRecord.idToken) {\r\n this.setIdTokenCredential(cacheRecord.idToken);\r\n }\r\n if (!!cacheRecord.accessToken) {\r\n this.saveAccessToken(cacheRecord.accessToken);\r\n }\r\n if (!!cacheRecord.refreshToken) {\r\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\r\n }\r\n if (!!cacheRecord.appMetadata) {\r\n this.setAppMetadata(cacheRecord.appMetadata);\r\n }\r\n };\r\n /**\r\n * saves access token credential\r\n * @param credential\r\n */\r\n CacheManager.prototype.saveAccessToken = function (credential) {\r\n var _this = this;\r\n var currentTokenCache = this.getCredentialsFilteredBy({\r\n clientId: credential.clientId,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n environment: credential.environment,\r\n homeAccountId: credential.homeAccountId,\r\n realm: credential.realm,\r\n });\r\n var currentScopes = ScopeSet.fromString(credential.target);\r\n var currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });\r\n if (currentAccessTokens) {\r\n currentAccessTokens.forEach(function (tokenEntity) {\r\n var tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\r\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\r\n _this.removeCredential(tokenEntity);\r\n }\r\n });\r\n }\r\n this.setAccessTokenCredential(credential);\r\n };\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {\r\n return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : \"\", accountFilter ? accountFilter.environment : \"\", accountFilter ? accountFilter.realm : \"\");\r\n };\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm) {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n var matchingAccounts = {};\r\n allCacheKeys.forEach(function (cacheKey) {\r\n var entity = _this.getAccount(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!homeAccountId && !_this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n if (!!environment && !_this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n if (!!realm && !_this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n matchingAccounts[cacheKey] = entity;\r\n });\r\n return matchingAccounts;\r\n };\r\n /**\r\n * retrieve credentails matching all provided filters; if no filter is set, get all credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n */\r\n CacheManager.prototype.getCredentialsFilteredBy = function (filter) {\r\n return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion);\r\n };\r\n /**\r\n * Support function to help match credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n */\r\n CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion) {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n var matchingCredentials = {\r\n idTokens: {},\r\n accessTokens: {},\r\n refreshTokens: {},\r\n };\r\n allCacheKeys.forEach(function (cacheKey) {\r\n // don't parse any non-credential type cache entities\r\n var credType = CredentialEntity.getCredentialType(cacheKey);\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n var entity = _this.getSpecificCredential(cacheKey, credType);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!oboAssertion && !_this.matchOboAssertion(entity, oboAssertion)) {\r\n return;\r\n }\r\n if (!!homeAccountId && !_this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n if (!!environment && !_this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n if (!!realm && !_this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n if (!!credentialType && !_this.matchCredentialType(entity, credentialType)) {\r\n return;\r\n }\r\n if (!!clientId && !_this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n if (!!familyId && !_this.matchFamilyId(entity, familyId)) {\r\n return;\r\n }\r\n /*\r\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\r\n * Resource specific refresh tokens case will be added when the support is deemed necessary\r\n */\r\n if (!!target && !_this.matchTarget(entity, target)) {\r\n return;\r\n }\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN:\r\n matchingCredentials.idTokens[cacheKey] = entity;\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n matchingCredentials.accessTokens[cacheKey] = entity;\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n matchingCredentials.refreshTokens[cacheKey] = entity;\r\n break;\r\n }\r\n });\r\n return matchingCredentials;\r\n };\r\n /**\r\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\r\n * @param filter\r\n */\r\n CacheManager.prototype.getAppMetadataFilteredBy = function (filter) {\r\n return this.getAppMetadataFilteredByInternal(filter.environment, filter.clientId);\r\n };\r\n /**\r\n * Support function to help match appMetadata\r\n * @param environment\r\n * @param clientId\r\n */\r\n CacheManager.prototype.getAppMetadataFilteredByInternal = function (environment, clientId) {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n var matchingAppMetadata = {};\r\n allCacheKeys.forEach(function (cacheKey) {\r\n // don't parse any non-appMetadata type cache entities\r\n if (!_this.isAppMetadata(cacheKey)) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n var entity = _this.getAppMetadata(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!environment && !_this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n if (!!clientId && !_this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n matchingAppMetadata[cacheKey] = entity;\r\n });\r\n return matchingAppMetadata;\r\n };\r\n /**\r\n * Removes all accounts and related tokens from cache.\r\n */\r\n CacheManager.prototype.removeAllAccounts = function () {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach(function (cacheKey) {\r\n var entity = _this.getAccount(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n _this.removeAccount(cacheKey);\r\n });\r\n return true;\r\n };\r\n /**\r\n * returns a boolean if the given account is removed\r\n * @param account\r\n */\r\n CacheManager.prototype.removeAccount = function (accountKey) {\r\n var account = this.getAccount(accountKey);\r\n if (!account) {\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n return (this.removeAccountContext(account) && this.removeItem(accountKey, CacheSchemaType.ACCOUNT));\r\n };\r\n /**\r\n * returns a boolean if the given account is removed\r\n * @param account\r\n */\r\n CacheManager.prototype.removeAccountContext = function (account) {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n var accountId = account.generateAccountId();\r\n allCacheKeys.forEach(function (cacheKey) {\r\n // don't parse any non-credential type cache entities\r\n var credType = CredentialEntity.getCredentialType(cacheKey);\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n var cacheEntity = _this.getSpecificCredential(cacheKey, credType);\r\n if (!!cacheEntity && accountId === cacheEntity.generateAccountId()) {\r\n _this.removeCredential(cacheEntity);\r\n }\r\n });\r\n return true;\r\n };\r\n /**\r\n * returns a boolean if the given credential is removed\r\n * @param credential\r\n */\r\n CacheManager.prototype.removeCredential = function (credential) {\r\n var key = credential.generateCredentialKey();\r\n return this.removeItem(key, CacheSchemaType.CREDENTIAL);\r\n };\r\n /**\r\n * Removes all app metadata objects from cache.\r\n */\r\n CacheManager.prototype.removeAppMetadata = function () {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach(function (cacheKey) {\r\n if (_this.isAppMetadata(cacheKey)) {\r\n _this.removeItem(cacheKey, CacheSchemaType.APP_METADATA);\r\n }\r\n });\r\n return true;\r\n };\r\n /**\r\n * Retrieve the cached credentials into a cacherecord\r\n * @param account\r\n * @param clientId\r\n * @param scopes\r\n * @param environment\r\n */\r\n CacheManager.prototype.readCacheRecord = function (account, clientId, scopes, environment) {\r\n var cachedAccount = this.readAccountFromCache(account);\r\n var cachedIdToken = this.readIdTokenFromCache(clientId, account);\r\n var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, scopes);\r\n var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);\r\n var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n if (cachedAccount && cachedIdToken) {\r\n cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;\r\n }\r\n return {\r\n account: cachedAccount,\r\n idToken: cachedIdToken,\r\n accessToken: cachedAccessToken,\r\n refreshToken: cachedRefreshToken,\r\n appMetadata: cachedAppMetadata,\r\n };\r\n };\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param account\r\n */\r\n CacheManager.prototype.readAccountFromCache = function (account) {\r\n var accountKey = AccountEntity.generateAccountCacheKey(account);\r\n return this.getAccount(accountKey);\r\n };\r\n /**\r\n * Retrieve IdTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param inputRealm\r\n */\r\n CacheManager.prototype.readIdTokenFromCache = function (clientId, account) {\r\n var idTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: clientId,\r\n realm: account.tenantId,\r\n };\r\n var credentialCache = this.getCredentialsFilteredBy(idTokenFilter);\r\n var idTokens = Object.keys(credentialCache.idTokens).map(function (key) { return credentialCache.idTokens[key]; });\r\n var numIdTokens = idTokens.length;\r\n if (numIdTokens < 1) {\r\n return null;\r\n }\r\n else if (numIdTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n return idTokens[0];\r\n };\r\n /**\r\n * Retrieve AccessTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param scopes\r\n * @param inputRealm\r\n */\r\n CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, scopes) {\r\n var accessTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n clientId: clientId,\r\n realm: account.tenantId,\r\n target: scopes.printScopesLowerCase(),\r\n };\r\n var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);\r\n var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });\r\n var numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n return null;\r\n }\r\n else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n return accessTokens[0];\r\n };\r\n /**\r\n * Helper to retrieve the appropriate refresh token from cache\r\n * @param clientId\r\n * @param account\r\n * @param familyRT\r\n */\r\n CacheManager.prototype.readRefreshTokenFromCache = function (clientId, account, familyRT) {\r\n var id = familyRT ? THE_FAMILY_ID : undefined;\r\n var refreshTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n clientId: clientId,\r\n familyId: id\r\n };\r\n var credentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);\r\n var refreshTokens = Object.keys(credentialCache.refreshTokens).map(function (key) { return credentialCache.refreshTokens[key]; });\r\n var numRefreshTokens = refreshTokens.length;\r\n if (numRefreshTokens < 1) {\r\n return null;\r\n }\r\n // address the else case after remove functions address environment aliases\r\n return refreshTokens[0];\r\n };\r\n /**\r\n * Retrieve AppMetadataEntity from cache\r\n */\r\n CacheManager.prototype.readAppMetadataFromCache = function (environment, clientId) {\r\n var appMetadataFilter = {\r\n environment: environment,\r\n clientId: clientId,\r\n };\r\n var appMetadata = this.getAppMetadataFilteredBy(appMetadataFilter);\r\n var appMetadataEntries = Object.keys(appMetadata).map(function (key) { return appMetadata[key]; });\r\n var numAppMetadata = appMetadataEntries.length;\r\n if (numAppMetadata < 1) {\r\n return null;\r\n }\r\n else if (numAppMetadata > 1) {\r\n throw ClientAuthError.createMultipleMatchingAppMetadataInCacheError();\r\n }\r\n return appMetadataEntries[0];\r\n };\r\n /**\r\n * Return the family_id value associated with FOCI\r\n * @param environment\r\n * @param clientId\r\n */\r\n CacheManager.prototype.isAppMetadataFOCI = function (environment, clientId) {\r\n var appMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\r\n };\r\n /**\r\n * helper to match account ids\r\n * @param value\r\n * @param homeAccountId\r\n */\r\n CacheManager.prototype.matchHomeAccountId = function (entity, homeAccountId) {\r\n return !!(entity.homeAccountId && homeAccountId === entity.homeAccountId);\r\n };\r\n /**\r\n * helper to match assertion\r\n * @param value\r\n * @param oboAssertion\r\n */\r\n CacheManager.prototype.matchOboAssertion = function (entity, oboAssertion) {\r\n return !!(entity.oboAssertion && oboAssertion === entity.oboAssertion);\r\n };\r\n /**\r\n * helper to match environment\r\n * @param value\r\n * @param environment\r\n */\r\n CacheManager.prototype.matchEnvironment = function (entity, environment) {\r\n var cloudMetadata = TrustedAuthority.getCloudDiscoveryMetadata(environment);\r\n if (cloudMetadata && cloudMetadata.aliases.indexOf(entity.environment) > -1) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * helper to match credential type\r\n * @param entity\r\n * @param credentialType\r\n */\r\n CacheManager.prototype.matchCredentialType = function (entity, credentialType) {\r\n return (entity.credentialType && credentialType.toLowerCase() === entity.credentialType.toLowerCase());\r\n };\r\n /**\r\n * helper to match client ids\r\n * @param entity\r\n * @param clientId\r\n */\r\n CacheManager.prototype.matchClientId = function (entity, clientId) {\r\n return !!(entity.clientId && clientId === entity.clientId);\r\n };\r\n /**\r\n * helper to match family ids\r\n * @param entity\r\n * @param familyId\r\n */\r\n CacheManager.prototype.matchFamilyId = function (entity, familyId) {\r\n return !!(entity.familyId && familyId === entity.familyId);\r\n };\r\n /**\r\n * helper to match realm\r\n * @param entity\r\n * @param realm\r\n */\r\n CacheManager.prototype.matchRealm = function (entity, realm) {\r\n return !!(entity.realm && realm === entity.realm);\r\n };\r\n /**\r\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\r\n * @param entity\r\n * @param target\r\n */\r\n CacheManager.prototype.matchTarget = function (entity, target) {\r\n if (entity.credentialType !== CredentialType.ACCESS_TOKEN || !entity.target) {\r\n return false;\r\n }\r\n var entityScopeSet = ScopeSet.fromString(entity.target);\r\n var requestTargetScopeSet = ScopeSet.fromString(target);\r\n if (!requestTargetScopeSet.containsOnlyDefaultScopes()) {\r\n requestTargetScopeSet.removeDefaultScopes(); // ignore default scopes\r\n }\r\n return entityScopeSet.containsScopeSet(requestTargetScopeSet);\r\n };\r\n /**\r\n * returns if a given cache entity is of the type appmetadata\r\n * @param key\r\n */\r\n CacheManager.prototype.isAppMetadata = function (key) {\r\n return key.indexOf(APP_METADATA) !== -1;\r\n };\r\n /**\r\n * Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache\r\n * @param key\r\n * @param credType\r\n */\r\n CacheManager.prototype.getSpecificCredential = function (key, credType) {\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN: {\r\n return this.getIdTokenCredential(key);\r\n }\r\n case CredentialType.ACCESS_TOKEN: {\r\n return this.getAccessTokenCredential(key);\r\n }\r\n case CredentialType.REFRESH_TOKEN: {\r\n return this.getRefreshTokenCredential(key);\r\n }\r\n default:\r\n return null;\r\n }\r\n };\r\n /**\r\n * Helper to convert serialized data to object\r\n * @param obj\r\n * @param json\r\n */\r\n CacheManager.toObject = function (obj, json) {\r\n for (var propertyName in json) {\r\n obj[propertyName] = json[propertyName];\r\n }\r\n return obj;\r\n };\r\n return CacheManager;\r\n}());\r\nvar DefaultStorageClass = /** @class */ (function (_super) {\r\n __extends$1(DefaultStorageClass, _super);\r\n function DefaultStorageClass() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n DefaultStorageClass.prototype.setAccount = function () {\r\n var notImplErr = \"Storage interface - setAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAccount = function () {\r\n var notImplErr = \"Storage interface - getAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setIdTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getIdTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setAccessTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAccessTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setRefreshTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getRefreshTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setAppMetadata = function () {\r\n var notImplErr = \"Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAppMetadata = function () {\r\n var notImplErr = \"Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setServerTelemetry = function () {\r\n var notImplErr = \"Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getServerTelemetry = function () {\r\n var notImplErr = \"Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setThrottlingCache = function () {\r\n var notImplErr = \"Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getThrottlingCache = function () {\r\n var notImplErr = \"Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.removeItem = function () {\r\n var notImplErr = \"Storage interface - removeItem() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.containsKey = function () {\r\n var notImplErr = \"Storage interface - containsKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getKeys = function () {\r\n var notImplErr = \"Storage interface - getKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.clear = function () {\r\n var notImplErr = \"Storage interface - clear() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n return DefaultStorageClass;\r\n}(CacheManager));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Token renewal offset default in seconds\r\nvar DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;\r\nvar DEFAULT_SYSTEM_OPTIONS = {\r\n tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC\r\n};\r\nvar DEFAULT_LOGGER_IMPLEMENTATION = {\r\n loggerCallback: function () {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info\r\n};\r\nvar DEFAULT_NETWORK_IMPLEMENTATION = {\r\n sendGetRequestAsync: function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator$1(this, function (_a) {\r\n notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n sendPostRequestAsync: function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator$1(this, function (_a) {\r\n notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n }\r\n};\r\nvar DEFAULT_LIBRARY_INFO = {\r\n sku: Constants.SKU,\r\n version: version,\r\n cpu: \"\",\r\n os: \"\"\r\n};\r\nvar DEFAULT_CLIENT_CREDENTIALS = {\r\n clientSecret: \"\",\r\n clientAssertion: undefined\r\n};\r\n/**\r\n * Function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param Configuration\r\n *\r\n * @returns Configuration\r\n */\r\nfunction buildClientConfiguration(_a) {\r\n var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;\r\n return {\r\n authOptions: buildAuthOptions(userAuthOptions),\r\n systemOptions: __assign$1(__assign$1({}, DEFAULT_SYSTEM_OPTIONS), userSystemOptions),\r\n loggerOptions: __assign$1(__assign$1({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption),\r\n storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION),\r\n networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,\r\n cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,\r\n clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,\r\n libraryInfo: __assign$1(__assign$1({}, DEFAULT_LIBRARY_INFO), libraryInfo),\r\n serverTelemetryManager: serverTelemetryManager || null,\r\n persistencePlugin: persistencePlugin || null,\r\n serializableCache: serializableCache || null\r\n };\r\n}\r\n/**\r\n * Construct authoptions from the client and platform passed values\r\n * @param authOptions\r\n */\r\nfunction buildAuthOptions(authOptions) {\r\n return __assign$1({ knownAuthorities: [], cloudDiscoveryMetadata: \"\", clientCapabilities: [], protocolMode: ProtocolMode.AAD }, authOptions);\r\n}\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Error thrown when there is an error with the server code, for example, unavailability.\r\n */\r\nvar ServerError = /** @class */ (function (_super) {\r\n __extends$1(ServerError, _super);\r\n function ServerError(errorCode, errorMessage, subError) {\r\n var _this = _super.call(this, errorCode, errorMessage, subError) || this;\r\n _this.name = \"ServerError\";\r\n Object.setPrototypeOf(_this, ServerError.prototype);\r\n return _this;\r\n }\r\n return ServerError;\r\n}(AuthError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ThrottlingUtils = /** @class */ (function () {\r\n function ThrottlingUtils() {\r\n }\r\n /**\r\n * Prepares a RequestThumbprint to be stored as a key.\r\n * @param thumbprint\r\n */\r\n ThrottlingUtils.generateThrottlingStorageKey = function (thumbprint) {\r\n return ThrottlingConstants.THROTTLING_PREFIX + \".\" + JSON.stringify(thumbprint);\r\n };\r\n /**\r\n * Performs necessary throttling checks before a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n */\r\n ThrottlingUtils.preProcess = function (cacheManager, thumbprint) {\r\n var _a;\r\n var key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);\r\n var value = cacheManager.getThrottlingCache(key);\r\n if (value) {\r\n if (value.throttleTime < Date.now()) {\r\n cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\r\n return;\r\n }\r\n throw new ServerError(((_a = value.errorCodes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || Constants.EMPTY_STRING, value.errorMessage, value.subError);\r\n }\r\n };\r\n /**\r\n * Performs necessary throttling checks after a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n * @param response\r\n */\r\n ThrottlingUtils.postProcess = function (cacheManager, thumbprint, response) {\r\n if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {\r\n var thumbprintValue = {\r\n throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),\r\n error: response.body.error,\r\n errorCodes: response.body.error_codes,\r\n errorMessage: response.body.error_description,\r\n subError: response.body.suberror\r\n };\r\n cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);\r\n }\r\n };\r\n /**\r\n * Checks a NetworkResponse object's status codes against 429 or 5xx\r\n * @param response\r\n */\r\n ThrottlingUtils.checkResponseStatus = function (response) {\r\n return response.status === 429 || response.status >= 500 && response.status < 600;\r\n };\r\n /**\r\n * Checks a NetworkResponse object's RetryAfter header\r\n * @param response\r\n */\r\n ThrottlingUtils.checkResponseForRetryAfter = function (response) {\r\n if (response.headers) {\r\n return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);\r\n }\r\n return false;\r\n };\r\n /**\r\n * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.\r\n * @param throttleTime\r\n */\r\n ThrottlingUtils.calculateThrottleTime = function (throttleTime) {\r\n if (throttleTime <= 0) {\r\n throttleTime = 0;\r\n }\r\n var currentSeconds = Date.now() / 1000;\r\n return Math.floor(Math.min(currentSeconds + (throttleTime || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds + ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);\r\n };\r\n ThrottlingUtils.removeThrottle = function (cacheManager, clientId, authority, scopes, homeAccountIdentifier) {\r\n var thumbprint = {\r\n clientId: clientId,\r\n authority: authority,\r\n scopes: scopes,\r\n homeAccountIdentifier: homeAccountIdentifier\r\n };\r\n var key = this.generateThrottlingStorageKey(thumbprint);\r\n return cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\r\n };\r\n return ThrottlingUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NetworkManager = /** @class */ (function () {\r\n function NetworkManager(networkClient, cacheManager) {\r\n this.networkClient = networkClient;\r\n this.cacheManager = cacheManager;\r\n }\r\n /**\r\n * Wraps sendPostRequestAsync with necessary preflight and postflight logic\r\n * @param thumbprint\r\n * @param tokenEndpoint\r\n * @param options\r\n */\r\n NetworkManager.prototype.sendPostRequest = function (thumbprint, tokenEndpoint, options) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var response;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n ThrottlingUtils.preProcess(this.cacheManager, thumbprint);\r\n return [4 /*yield*/, this.networkClient.sendPostRequestAsync(tokenEndpoint, options)];\r\n case 1:\r\n response = _a.sent();\r\n ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);\r\n // Placeholder for Telemetry hook\r\n return [2 /*return*/, response];\r\n }\r\n });\r\n });\r\n };\r\n return NetworkManager;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.\r\n */\r\nvar BaseClient = /** @class */ (function () {\r\n function BaseClient(configuration) {\r\n // Set the configuration\r\n this.config = buildClientConfiguration(configuration);\r\n // Initialize the logger\r\n this.logger = new Logger(this.config.loggerOptions, name, version);\r\n // Initialize crypto\r\n this.cryptoUtils = this.config.cryptoInterface;\r\n // Initialize storage interface\r\n this.cacheManager = this.config.storageInterface;\r\n // Set the network interface\r\n this.networkClient = this.config.networkInterface;\r\n // Set the NetworkManager\r\n this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);\r\n // Set TelemetryManager\r\n this.serverTelemetryManager = this.config.serverTelemetryManager;\r\n // Set TrustedAuthorities from config\r\n TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.authOptions.knownAuthorities, this.config.authOptions.cloudDiscoveryMetadata);\r\n // set Authority\r\n this.authority = this.config.authOptions.authority;\r\n }\r\n /**\r\n * Creates default headers for requests to token endpoint\r\n */\r\n BaseClient.prototype.createDefaultTokenRequestHeaders = function () {\r\n var headers = this.createDefaultLibraryHeaders();\r\n headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;\r\n headers[HeaderNames.X_MS_LIB_CAPABILITY] = HeaderNames.X_MS_LIB_CAPABILITY_VALUE;\r\n if (this.serverTelemetryManager) {\r\n headers[HeaderNames.X_CLIENT_CURR_TELEM] = this.serverTelemetryManager.generateCurrentRequestHeaderValue();\r\n headers[HeaderNames.X_CLIENT_LAST_TELEM] = this.serverTelemetryManager.generateLastRequestHeaderValue();\r\n }\r\n return headers;\r\n };\r\n /**\r\n * addLibraryData\r\n */\r\n BaseClient.prototype.createDefaultLibraryHeaders = function () {\r\n var headers = {};\r\n // client info headers\r\n headers[AADServerParamKeys.X_CLIENT_SKU] = this.config.libraryInfo.sku;\r\n headers[AADServerParamKeys.X_CLIENT_VER] = this.config.libraryInfo.version;\r\n headers[AADServerParamKeys.X_CLIENT_OS] = this.config.libraryInfo.os;\r\n headers[AADServerParamKeys.X_CLIENT_CPU] = this.config.libraryInfo.cpu;\r\n return headers;\r\n };\r\n /**\r\n * Http post to token endpoint\r\n * @param tokenEndpoint\r\n * @param queryString\r\n * @param headers\r\n * @param thumbprint\r\n */\r\n BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var response;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];\r\n case 1:\r\n response = _a.sent();\r\n if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {\r\n // Telemetry data successfully logged by server, clear Telemetry cache\r\n this.config.serverTelemetryManager.clearTelemetryCache();\r\n }\r\n return [2 /*return*/, response];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Updates the authority object of the client. Endpoint discovery must be completed.\r\n * @param updatedAuthority\r\n */\r\n BaseClient.prototype.updateAuthority = function (updatedAuthority) {\r\n if (!updatedAuthority.discoveryComplete()) {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Updated authority has not completed endpoint discovery.\");\r\n }\r\n this.authority = updatedAuthority;\r\n };\r\n return BaseClient;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Validates server consumable params from the \"request\" objects\r\n */\r\nvar RequestValidator = /** @class */ (function () {\r\n function RequestValidator() {\r\n }\r\n /**\r\n * Utility to check if the `redirectUri` in the request is a non-null value\r\n * @param redirectUri\r\n */\r\n RequestValidator.validateRedirectUri = function (redirectUri) {\r\n if (StringUtils.isEmpty(redirectUri)) {\r\n throw ClientConfigurationError.createRedirectUriEmptyError();\r\n }\r\n };\r\n /**\r\n * Utility to validate prompt sent by the user in the request\r\n * @param prompt\r\n */\r\n RequestValidator.validatePrompt = function (prompt) {\r\n if ([\r\n PromptValue.LOGIN,\r\n PromptValue.SELECT_ACCOUNT,\r\n PromptValue.CONSENT,\r\n PromptValue.NONE\r\n ].indexOf(prompt) < 0) {\r\n throw ClientConfigurationError.createInvalidPromptError(prompt);\r\n }\r\n };\r\n RequestValidator.validateClaims = function (claims) {\r\n try {\r\n JSON.parse(claims);\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n };\r\n /**\r\n * Utility to validate code_challenge and code_challenge_method\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n RequestValidator.validateCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {\r\n if (StringUtils.isEmpty(codeChallenge) || StringUtils.isEmpty(codeChallengeMethod)) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n }\r\n else {\r\n this.validateCodeChallengeMethod(codeChallengeMethod);\r\n }\r\n };\r\n /**\r\n * Utility to validate code_challenge_method\r\n * @param codeChallengeMethod\r\n */\r\n RequestValidator.validateCodeChallengeMethod = function (codeChallengeMethod) {\r\n if ([\r\n CodeChallengeMethodValues.PLAIN,\r\n CodeChallengeMethodValues.S256\r\n ].indexOf(codeChallengeMethod) < 0) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeMethodError();\r\n }\r\n };\r\n /**\r\n * Removes unnecessary or duplicate query parameters from extraQueryParameters\r\n * @param request\r\n */\r\n RequestValidator.sanitizeEQParams = function (eQParams, queryParams) {\r\n if (!eQParams) {\r\n return {};\r\n }\r\n // Remove any query parameters already included in SSO params\r\n queryParams.forEach(function (value, key) {\r\n if (eQParams[key]) {\r\n delete eQParams[key];\r\n }\r\n });\r\n return eQParams;\r\n };\r\n return RequestValidator;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RequestParameterBuilder = /** @class */ (function () {\r\n function RequestParameterBuilder() {\r\n this.parameters = new Map();\r\n }\r\n /**\r\n * add response_type = code\r\n */\r\n RequestParameterBuilder.prototype.addResponseTypeCode = function () {\r\n this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));\r\n };\r\n /**\r\n * add response_mode. defaults to query.\r\n * @param responseMode\r\n */\r\n RequestParameterBuilder.prototype.addResponseMode = function (responseMode) {\r\n this.parameters.set(AADServerParamKeys.RESPONSE_MODE, encodeURIComponent((responseMode) ? responseMode : ResponseMode.QUERY));\r\n };\r\n /**\r\n * add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios\r\n * @param scopeSet\r\n * @param addOidcScopes\r\n */\r\n RequestParameterBuilder.prototype.addScopes = function (scopes, addOidcScopes) {\r\n if (addOidcScopes === void 0) { addOidcScopes = true; }\r\n var requestScopes = addOidcScopes ? __spreadArrays(scopes || [], [Constants.OPENID_SCOPE, Constants.PROFILE_SCOPE]) : scopes || [];\r\n var scopeSet = new ScopeSet(requestScopes);\r\n this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));\r\n };\r\n /**\r\n * add clientId\r\n * @param clientId\r\n */\r\n RequestParameterBuilder.prototype.addClientId = function (clientId) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));\r\n };\r\n /**\r\n * add redirect_uri\r\n * @param redirectUri\r\n */\r\n RequestParameterBuilder.prototype.addRedirectUri = function (redirectUri) {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));\r\n };\r\n /**\r\n * add post logout redirectUri\r\n * @param redirectUri\r\n */\r\n RequestParameterBuilder.prototype.addPostLogoutRedirectUri = function (redirectUri) {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));\r\n };\r\n /**\r\n * add id_token_hint to logout request\r\n * @param idTokenHint\r\n */\r\n RequestParameterBuilder.prototype.addIdTokenHint = function (idTokenHint) {\r\n this.parameters.set(AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));\r\n };\r\n /**\r\n * add domain_hint\r\n * @param domainHint\r\n */\r\n RequestParameterBuilder.prototype.addDomainHint = function (domainHint) {\r\n this.parameters.set(SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));\r\n };\r\n /**\r\n * add login_hint\r\n * @param loginHint\r\n */\r\n RequestParameterBuilder.prototype.addLoginHint = function (loginHint) {\r\n this.parameters.set(SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));\r\n };\r\n /**\r\n * add sid\r\n * @param sid\r\n */\r\n RequestParameterBuilder.prototype.addSid = function (sid) {\r\n this.parameters.set(SSOTypes.SID, encodeURIComponent(sid));\r\n };\r\n /**\r\n * add claims\r\n * @param claims\r\n */\r\n RequestParameterBuilder.prototype.addClaims = function (claims, clientCapabilities) {\r\n var mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);\r\n RequestValidator.validateClaims(mergedClaims);\r\n this.parameters.set(AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));\r\n };\r\n /**\r\n * add correlationId\r\n * @param correlationId\r\n */\r\n RequestParameterBuilder.prototype.addCorrelationId = function (correlationId) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));\r\n };\r\n /**\r\n * add library info query params\r\n * @param libraryInfo\r\n */\r\n RequestParameterBuilder.prototype.addLibraryInfo = function (libraryInfo) {\r\n // Telemetry Info\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);\r\n };\r\n /**\r\n * add prompt\r\n * @param prompt\r\n */\r\n RequestParameterBuilder.prototype.addPrompt = function (prompt) {\r\n RequestValidator.validatePrompt(prompt);\r\n this.parameters.set(\"\" + AADServerParamKeys.PROMPT, encodeURIComponent(prompt));\r\n };\r\n /**\r\n * add state\r\n * @param state\r\n */\r\n RequestParameterBuilder.prototype.addState = function (state) {\r\n if (!StringUtils.isEmpty(state)) {\r\n this.parameters.set(AADServerParamKeys.STATE, encodeURIComponent(state));\r\n }\r\n };\r\n /**\r\n * add nonce\r\n * @param nonce\r\n */\r\n RequestParameterBuilder.prototype.addNonce = function (nonce) {\r\n this.parameters.set(AADServerParamKeys.NONCE, encodeURIComponent(nonce));\r\n };\r\n /**\r\n * add code_challenge and code_challenge_method\r\n * - throw if either of them are not passed\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n RequestParameterBuilder.prototype.addCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {\r\n RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);\r\n if (codeChallenge && codeChallengeMethod) {\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));\r\n }\r\n else {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n }\r\n };\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n RequestParameterBuilder.prototype.addAuthorizationCode = function (code) {\r\n this.parameters.set(AADServerParamKeys.CODE, encodeURIComponent(code));\r\n };\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n RequestParameterBuilder.prototype.addDeviceCode = function (code) {\r\n this.parameters.set(AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));\r\n };\r\n /**\r\n * add the `refreshToken` passed by the user\r\n * @param refreshToken\r\n */\r\n RequestParameterBuilder.prototype.addRefreshToken = function (refreshToken) {\r\n this.parameters.set(AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));\r\n };\r\n /**\r\n * add the `code_verifier` passed by the user to exchange for a token\r\n * @param codeVerifier\r\n */\r\n RequestParameterBuilder.prototype.addCodeVerifier = function (codeVerifier) {\r\n this.parameters.set(AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));\r\n };\r\n /**\r\n * add client_secret\r\n * @param clientSecret\r\n */\r\n RequestParameterBuilder.prototype.addClientSecret = function (clientSecret) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));\r\n };\r\n /**\r\n * add clientAssertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n RequestParameterBuilder.prototype.addClientAssertion = function (clientAssertion) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));\r\n };\r\n /**\r\n * add clientAssertionType for confidential client flows\r\n * @param clientAssertionType\r\n */\r\n RequestParameterBuilder.prototype.addClientAssertionType = function (clientAssertionType) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));\r\n };\r\n /**\r\n * add OBO assertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n RequestParameterBuilder.prototype.addOboAssertion = function (oboAssertion) {\r\n this.parameters.set(AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));\r\n };\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n RequestParameterBuilder.prototype.addRequestTokenUse = function (tokenUse) {\r\n this.parameters.set(AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));\r\n };\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n RequestParameterBuilder.prototype.addGrantType = function (grantType) {\r\n this.parameters.set(AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));\r\n };\r\n /**\r\n * add client info\r\n *\r\n */\r\n RequestParameterBuilder.prototype.addClientInfo = function () {\r\n this.parameters.set(ClientInfo, \"1\");\r\n };\r\n /**\r\n * add extraQueryParams\r\n * @param eQparams\r\n */\r\n RequestParameterBuilder.prototype.addExtraQueryParameters = function (eQparams) {\r\n var _this = this;\r\n RequestValidator.sanitizeEQParams(eQparams, this.parameters);\r\n Object.keys(eQparams).forEach(function (key) {\r\n _this.parameters.set(key, eQparams[key]);\r\n });\r\n };\r\n RequestParameterBuilder.prototype.addClientCapabilitiesToClaims = function (claims, clientCapabilities) {\r\n var mergedClaims;\r\n // Parse provided claims into JSON object or initialize empty object\r\n if (!claims) {\r\n mergedClaims = {};\r\n }\r\n else {\r\n try {\r\n mergedClaims = JSON.parse(claims);\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n }\r\n if (clientCapabilities && clientCapabilities.length > 0) {\r\n if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {\r\n // Add access_token key to claims object\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};\r\n }\r\n // Add xms_cc claim with provided clientCapabilities to access_token key\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {\r\n values: clientCapabilities\r\n };\r\n }\r\n return JSON.stringify(mergedClaims);\r\n };\r\n /**\r\n * adds `username` for Password Grant flow\r\n * @param username\r\n */\r\n RequestParameterBuilder.prototype.addUsername = function (username) {\r\n this.parameters.set(PasswordGrantConstants.username, username);\r\n };\r\n /**\r\n * adds `password` for Password Grant flow\r\n * @param password\r\n */\r\n RequestParameterBuilder.prototype.addPassword = function (password) {\r\n this.parameters.set(PasswordGrantConstants.password, password);\r\n };\r\n /**\r\n * add pop_jwk to query params\r\n * @param cnfString\r\n */\r\n RequestParameterBuilder.prototype.addPopToken = function (cnfString) {\r\n if (!StringUtils.isEmpty(cnfString)) {\r\n this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);\r\n this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));\r\n }\r\n };\r\n /**\r\n * Utility to create a URL from the params map\r\n */\r\n RequestParameterBuilder.prototype.createQueryString = function () {\r\n var queryParameterArray = new Array();\r\n this.parameters.forEach(function (value, key) {\r\n queryParameterArray.push(key + \"=\" + value);\r\n });\r\n return queryParameterArray.join(\"&\");\r\n };\r\n return RequestParameterBuilder;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class which exposes functions for managing date and time operations.\r\n */\r\nvar TimeUtils = /** @class */ (function () {\r\n function TimeUtils() {\r\n }\r\n /**\r\n * return the current time in Unix time (seconds).\r\n */\r\n TimeUtils.nowSeconds = function () {\r\n // Date.getTime() returns in milliseconds.\r\n return Math.round(new Date().getTime() / 1000.0);\r\n };\r\n /**\r\n * check if a token is expired based on given UTC time in seconds.\r\n * @param expiresOn\r\n */\r\n TimeUtils.isTokenExpired = function (expiresOn, offset) {\r\n // check for access token expiry\r\n var expirationSec = Number(expiresOn) || 0;\r\n var offsetCurrentTimeSec = TimeUtils.nowSeconds() + offset;\r\n // If current time + offset is greater than token expiration time, then token is expired.\r\n return (offsetCurrentTimeSec > expirationSec);\r\n };\r\n return TimeUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ID_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * }\r\n */\r\nvar IdTokenEntity = /** @class */ (function (_super) {\r\n __extends$1(IdTokenEntity, _super);\r\n function IdTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create IdTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n IdTokenEntity.createIdTokenEntity = function (homeAccountId, environment, idToken, clientId, tenantId, oboAssertion) {\r\n var idTokenEntity = new IdTokenEntity();\r\n idTokenEntity.credentialType = CredentialType.ID_TOKEN;\r\n idTokenEntity.homeAccountId = homeAccountId;\r\n idTokenEntity.environment = environment;\r\n idTokenEntity.clientId = clientId;\r\n idTokenEntity.secret = idToken;\r\n idTokenEntity.realm = tenantId;\r\n idTokenEntity.oboAssertion = oboAssertion;\r\n return idTokenEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n IdTokenEntity.isIdTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.ID_TOKEN);\r\n };\r\n return IdTokenEntity;\r\n}(CredentialEntity));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ACCESS_TOKEN Credential Type\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-accesstoken-clientId-contoso.com-user.read\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * cachedAt: Absolute device time when entry was created in the cache.\r\n * expiresOn: Token expiry time, calculated based on current UTC time in seconds. Represented as a string.\r\n * extendedExpiresOn: Additional extended expiry time until when token is valid in case of server-side outage. Represented as string in UTC seconds.\r\n * keyId: used for POP and SSH tokenTypes\r\n * tokenType: Type of the token issued. Usually \"Bearer\"\r\n * }\r\n */\r\nvar AccessTokenEntity = /** @class */ (function (_super) {\r\n __extends$1(AccessTokenEntity, _super);\r\n function AccessTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create AccessTokenEntity\r\n * @param homeAccountId\r\n * @param environment\r\n * @param accessToken\r\n * @param clientId\r\n * @param tenantId\r\n * @param scopes\r\n * @param expiresOn\r\n * @param extExpiresOn\r\n */\r\n AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, tokenType, oboAssertion) {\r\n var atEntity = new AccessTokenEntity();\r\n atEntity.homeAccountId = homeAccountId;\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN;\r\n atEntity.secret = accessToken;\r\n var currentTime = TimeUtils.nowSeconds();\r\n atEntity.cachedAt = currentTime.toString();\r\n /*\r\n * Token expiry time.\r\n * This value should be  calculated based on the current UTC time measured locally and the value  expires_in Represented as a string in JSON.\r\n */\r\n atEntity.expiresOn = expiresOn.toString();\r\n atEntity.extendedExpiresOn = extExpiresOn.toString();\r\n atEntity.environment = environment;\r\n atEntity.clientId = clientId;\r\n atEntity.realm = tenantId;\r\n atEntity.target = scopes;\r\n atEntity.oboAssertion = oboAssertion;\r\n atEntity.tokenType = StringUtils.isEmpty(tokenType) ? AuthenticationScheme.BEARER : tokenType;\r\n return atEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AccessTokenEntity.isAccessTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity.hasOwnProperty(\"target\") &&\r\n entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN);\r\n };\r\n return AccessTokenEntity;\r\n}(CredentialEntity));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * REFRESH_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--\r\n *\r\n * Value:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * }\r\n */\r\nvar RefreshTokenEntity = /** @class */ (function (_super) {\r\n __extends$1(RefreshTokenEntity, _super);\r\n function RefreshTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create RefreshTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n RefreshTokenEntity.createRefreshTokenEntity = function (homeAccountId, environment, refreshToken, clientId, familyId, oboAssertion) {\r\n var rtEntity = new RefreshTokenEntity();\r\n rtEntity.clientId = clientId;\r\n rtEntity.credentialType = CredentialType.REFRESH_TOKEN;\r\n rtEntity.environment = environment;\r\n rtEntity.homeAccountId = homeAccountId;\r\n rtEntity.secret = refreshToken;\r\n rtEntity.oboAssertion = oboAssertion;\r\n if (familyId)\r\n rtEntity.familyId = familyId;\r\n return rtEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n RefreshTokenEntity.isRefreshTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN);\r\n };\r\n return RefreshTokenEntity;\r\n}(CredentialEntity));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * InteractionRequiredAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar InteractionRequiredAuthErrorMessage = [\r\n \"interaction_required\",\r\n \"consent_required\",\r\n \"login_required\"\r\n];\r\nvar InteractionRequiredAuthSubErrorMessage = [\r\n \"message_only\",\r\n \"additional_action\",\r\n \"basic_action\",\r\n \"user_password_expired\",\r\n \"consent_required\"\r\n];\r\n/**\r\n * Error thrown when user interaction is required at the auth server.\r\n */\r\nvar InteractionRequiredAuthError = /** @class */ (function (_super) {\r\n __extends$1(InteractionRequiredAuthError, _super);\r\n function InteractionRequiredAuthError(errorCode, errorMessage, subError) {\r\n var _this = _super.call(this, errorCode, errorMessage, subError) || this;\r\n _this.name = \"InteractionRequiredAuthError\";\r\n Object.setPrototypeOf(_this, InteractionRequiredAuthError.prototype);\r\n return _this;\r\n }\r\n InteractionRequiredAuthError.isInteractionRequiredError = function (errorCode, errorString, subError) {\r\n var isInteractionRequiredErrorCode = !!errorCode && InteractionRequiredAuthErrorMessage.indexOf(errorCode) > -1;\r\n var isInteractionRequiredSubError = !!subError && InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;\r\n var isInteractionRequiredErrorDesc = !!errorString && InteractionRequiredAuthErrorMessage.some(function (irErrorCode) {\r\n return errorString.indexOf(irErrorCode) > -1;\r\n });\r\n return isInteractionRequiredErrorCode || isInteractionRequiredErrorDesc || isInteractionRequiredSubError;\r\n };\r\n return InteractionRequiredAuthError;\r\n}(ServerError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar CacheRecord = /** @class */ (function () {\r\n function CacheRecord(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {\r\n this.account = accountEntity || null;\r\n this.idToken = idTokenEntity || null;\r\n this.accessToken = accessTokenEntity || null;\r\n this.refreshToken = refreshTokenEntity || null;\r\n this.appMetadata = appMetadataEntity || null;\r\n }\r\n return CacheRecord;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which provides helpers for OAuth 2.0 protocol specific values\r\n */\r\nvar ProtocolUtils = /** @class */ (function () {\r\n function ProtocolUtils() {\r\n }\r\n /**\r\n * Appends user state with random guid, or returns random guid.\r\n * @param userState\r\n * @param randomGuid\r\n */\r\n ProtocolUtils.setRequestState = function (cryptoObj, userState, meta) {\r\n var libraryState = ProtocolUtils.generateLibraryState(cryptoObj, meta);\r\n return !StringUtils.isEmpty(userState) ? \"\" + libraryState + Constants.RESOURCE_DELIM + userState : libraryState;\r\n };\r\n /**\r\n * Generates the state value used by the common library.\r\n * @param randomGuid\r\n * @param cryptoObj\r\n */\r\n ProtocolUtils.generateLibraryState = function (cryptoObj, meta) {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"generateLibraryState\");\r\n }\r\n // Create a state object containing a unique id and the timestamp of the request creation\r\n var stateObj = {\r\n id: cryptoObj.createNewGuid(),\r\n ts: TimeUtils.nowSeconds()\r\n };\r\n if (meta) {\r\n stateObj.meta = meta;\r\n }\r\n var stateString = JSON.stringify(stateObj);\r\n return cryptoObj.base64Encode(stateString);\r\n };\r\n /**\r\n * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.\r\n * @param state\r\n * @param cryptoObj\r\n */\r\n ProtocolUtils.parseRequestState = function (cryptoObj, state) {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"parseRequestState\");\r\n }\r\n if (StringUtils.isEmpty(state)) {\r\n throw ClientAuthError.createInvalidStateError(state, \"Null, undefined or empty state\");\r\n }\r\n try {\r\n // Split the state between library state and user passed state and decode them separately\r\n var splitState = decodeURIComponent(state).split(Constants.RESOURCE_DELIM);\r\n var libraryState = splitState[0];\r\n var userState = splitState.length > 1 ? splitState.slice(1).join(Constants.RESOURCE_DELIM) : \"\";\r\n var libraryStateString = cryptoObj.base64Decode(libraryState);\r\n var libraryStateObj = JSON.parse(libraryStateString);\r\n return {\r\n userRequestState: !StringUtils.isEmpty(userState) ? userState : \"\",\r\n libraryState: libraryStateObj\r\n };\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createInvalidStateError(state, e);\r\n }\r\n };\r\n return ProtocolUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar KeyLocation;\r\n(function (KeyLocation) {\r\n KeyLocation[\"SW\"] = \"sw\";\r\n KeyLocation[\"UHW\"] = \"uhw\";\r\n})(KeyLocation || (KeyLocation = {}));\r\nvar PopTokenGenerator = /** @class */ (function () {\r\n function PopTokenGenerator(cryptoUtils) {\r\n this.cryptoUtils = cryptoUtils;\r\n }\r\n PopTokenGenerator.prototype.generateCnf = function (resourceRequestMethod, resourceRequestUri) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var kidThumbprint, reqCnf;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.cryptoUtils.getPublicKeyThumbprint(resourceRequestMethod, resourceRequestUri)];\r\n case 1:\r\n kidThumbprint = _a.sent();\r\n reqCnf = {\r\n kid: kidThumbprint,\r\n xms_ksl: KeyLocation.SW\r\n };\r\n return [2 /*return*/, this.cryptoUtils.base64Encode(JSON.stringify(reqCnf))];\r\n }\r\n });\r\n });\r\n };\r\n PopTokenGenerator.prototype.signPopToken = function (accessToken, resourceRequestMethod, resourceRequestUri) {\r\n var _a;\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var tokenClaims, resourceUrlString, resourceUrlComponents;\r\n return __generator$1(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n tokenClaims = AuthToken.extractTokenClaims(accessToken, this.cryptoUtils);\r\n resourceUrlString = new UrlString(resourceRequestUri);\r\n resourceUrlComponents = resourceUrlString.getUrlComponents();\r\n if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {\r\n throw ClientAuthError.createTokenClaimsRequiredError();\r\n }\r\n return [4 /*yield*/, this.cryptoUtils.signJwt({\r\n at: accessToken,\r\n ts: \"\" + TimeUtils.nowSeconds(),\r\n m: resourceRequestMethod.toUpperCase(),\r\n u: resourceUrlComponents.HostNameAndPort || \"\",\r\n nonce: this.cryptoUtils.createNewGuid(),\r\n p: resourceUrlComponents.AbsolutePath,\r\n q: [[], resourceUrlComponents.QueryString],\r\n }, tokenClaims.cnf.kid)];\r\n case 1: return [2 /*return*/, _b.sent()];\r\n }\r\n });\r\n });\r\n };\r\n return PopTokenGenerator;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * APP_METADATA Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: appmetadata--\r\n *\r\n * Value:\r\n * {\r\n * clientId: client ID of the application\r\n * environment: entity that issued the token, represented as a full host\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * }\r\n */\r\nvar AppMetadataEntity = /** @class */ (function () {\r\n function AppMetadataEntity() {\r\n }\r\n /**\r\n * Generate AppMetadata Cache Key as per the schema: appmetadata--\r\n */\r\n AppMetadataEntity.prototype.generateAppMetadataKey = function () {\r\n return AppMetadataEntity.generateAppMetadataCacheKey(this.environment, this.clientId);\r\n };\r\n /**\r\n * Generate AppMetadata Cache Key\r\n */\r\n AppMetadataEntity.generateAppMetadataCacheKey = function (environment, clientId) {\r\n var appMetaDataKeyArray = [\r\n APP_METADATA,\r\n environment,\r\n clientId,\r\n ];\r\n return appMetaDataKeyArray.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Creates AppMetadataEntity\r\n * @param clientId\r\n * @param environment\r\n * @param familyId\r\n */\r\n AppMetadataEntity.createAppMetadataEntity = function (clientId, environment, familyId) {\r\n var appMetadata = new AppMetadataEntity();\r\n appMetadata.clientId = clientId;\r\n appMetadata.environment = environment;\r\n if (familyId) {\r\n appMetadata.familyId = familyId;\r\n }\r\n return appMetadata;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AppMetadataEntity.isAppMetadataEntity = function (key, entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (key.indexOf(APP_METADATA) === 0 &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"environment\"));\r\n };\r\n return AppMetadataEntity;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar TokenCacheContext = /** @class */ (function () {\r\n function TokenCacheContext(tokenCache, hasChanged) {\r\n this.cache = tokenCache;\r\n this.hasChanged = hasChanged;\r\n }\r\n Object.defineProperty(TokenCacheContext.prototype, \"cacheHasChanged\", {\r\n get: function () {\r\n return this.hasChanged;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(TokenCacheContext.prototype, \"tokenCache\", {\r\n get: function () {\r\n return this.cache;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return TokenCacheContext;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class that handles response parsing.\r\n */\r\nvar ResponseHandler = /** @class */ (function () {\r\n function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin) {\r\n this.clientId = clientId;\r\n this.cacheStorage = cacheStorage;\r\n this.cryptoObj = cryptoObj;\r\n this.logger = logger;\r\n this.serializableCache = serializableCache;\r\n this.persistencePlugin = persistencePlugin;\r\n }\r\n /**\r\n * Function which validates server authorization code response.\r\n * @param serverResponseHash\r\n * @param cachedState\r\n * @param cryptoObj\r\n */\r\n ResponseHandler.prototype.validateServerAuthorizationCodeResponse = function (serverResponseHash, cachedState, cryptoObj) {\r\n if (!serverResponseHash.state || !cachedState) {\r\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\r\n throw ClientAuthError.createStateMismatchError();\r\n }\r\n // Check for error\r\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\r\n }\r\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\r\n }\r\n if (serverResponseHash.client_info) {\r\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\r\n }\r\n };\r\n /**\r\n * Function which validates server authorization token response.\r\n * @param serverResponse\r\n */\r\n ResponseHandler.prototype.validateTokenResponse = function (serverResponse) {\r\n // Check for error\r\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);\r\n }\r\n var errString = serverResponse.error_codes + \" - [\" + serverResponse.timestamp + \"]: \" + serverResponse.error_description + \" - Correlation ID: \" + serverResponse.correlation_id + \" - Trace ID: \" + serverResponse.trace_id;\r\n throw new ServerError(serverResponse.error, errString);\r\n }\r\n };\r\n /**\r\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\r\n * @param serverTokenResponse\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, resourceRequestMethod, resourceRequestUri, authCodePayload, requestScopes, oboAssertion, handlingRefreshTokenResponse) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (serverTokenResponse.id_token) {\r\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\r\n // token nonce check (TODO: Add a warning if no nonce is given?)\r\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\r\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\r\n throw ClientAuthError.createNonceMismatchError();\r\n }\r\n }\r\n }\r\n // generate homeAccountId\r\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\r\n if (!!authCodePayload && !!authCodePayload.state) {\r\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\r\n }\r\n cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, idTokenObj, requestStateObj && requestStateObj.libraryState, requestScopes, oboAssertion, authCodePayload);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, , 4, 7]);\r\n if (!(this.persistencePlugin && this.serializableCache)) return [3 /*break*/, 3];\r\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\r\n cacheContext = new TokenCacheContext(this.serializableCache, true);\r\n return [4 /*yield*/, this.persistencePlugin.beforeCacheAccess(cacheContext)];\r\n case 2:\r\n _a.sent();\r\n _a.label = 3;\r\n case 3:\r\n /*\r\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\r\n * If not present, we should return null, as it's the case that another application called removeAccount in between\r\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.\r\n */\r\n if (handlingRefreshTokenResponse && cacheRecord.account) {\r\n key = cacheRecord.account.generateAccountKey();\r\n account = this.cacheStorage.getAccount(key);\r\n if (!account) {\r\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\r\n return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, idTokenObj, requestStateObj, resourceRequestMethod, resourceRequestUri)];\r\n }\r\n }\r\n this.cacheStorage.saveCacheRecord(cacheRecord);\r\n return [3 /*break*/, 7];\r\n case 4:\r\n if (!(this.persistencePlugin && this.serializableCache && cacheContext)) return [3 /*break*/, 6];\r\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\r\n return [4 /*yield*/, this.persistencePlugin.afterCacheAccess(cacheContext)];\r\n case 5:\r\n _a.sent();\r\n _a.label = 6;\r\n case 6: return [7 /*endfinally*/];\r\n case 7: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, idTokenObj, requestStateObj, resourceRequestMethod, resourceRequestUri)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates CacheRecord\r\n * @param serverTokenResponse\r\n * @param idTokenObj\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, idTokenObj, libraryState, requestScopes, oboAssertion, authCodePayload) {\r\n var env = Authority.generateEnvironmentFromAuthority(authority);\r\n if (StringUtils.isEmpty(env)) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n // IdToken: non AAD scenarios can have empty realm\r\n var cachedIdToken;\r\n var cachedAccount;\r\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\r\n cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING, oboAssertion);\r\n cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority, oboAssertion, authCodePayload);\r\n }\r\n // AccessToken\r\n var cachedAccessToken = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\r\n // If scopes not returned in server response, use request scopes\r\n var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(requestScopes || []);\r\n // Expiration calculation\r\n var currentTime = TimeUtils.nowSeconds();\r\n // If the request timestamp was sent in the library state, use that timestamp to calculate expiration. Otherwise, use current time.\r\n var timestamp = libraryState ? libraryState.ts : currentTime;\r\n var tokenExpirationSeconds = timestamp + (serverTokenResponse.expires_in || 0);\r\n var extendedTokenExpirationSeconds = tokenExpirationSeconds + (serverTokenResponse.ext_expires_in || 0);\r\n // non AAD scenarios can have empty realm\r\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, serverTokenResponse.token_type, oboAssertion);\r\n }\r\n // refreshToken\r\n var cachedRefreshToken = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\r\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.refresh_token || Constants.EMPTY_STRING, this.clientId, serverTokenResponse.foci, oboAssertion);\r\n }\r\n // appMetadata\r\n var cachedAppMetadata = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\r\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\r\n }\r\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\r\n };\r\n /**\r\n * Generate Account\r\n * @param serverTokenResponse\r\n * @param idToken\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, oboAssertion, authCodePayload) {\r\n var authorityType = authority.authorityType;\r\n var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : \"\";\r\n var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : \"\";\r\n // ADFS does not require client_info in the response\r\n if (authorityType === AuthorityType.Adfs) {\r\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\r\n return AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);\r\n }\r\n // This fallback applies to B2C as well as they fall under an AAD account type.\r\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n return serverTokenResponse.client_info ?\r\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, authority, idToken, oboAssertion, cloudGraphHostName, msGraphhost) :\r\n AccountEntity.createGenericAccount(authority, this.homeAccountIdentifier, idToken, oboAssertion, cloudGraphHostName, msGraphhost);\r\n };\r\n /**\r\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\r\n *\r\n * Optionally takes a state string that is set as-is in the response.\r\n *\r\n * @param cacheRecord\r\n * @param idTokenObj\r\n * @param fromTokenCache\r\n * @param stateString\r\n */\r\n ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, idTokenObj, requestState, resourceRequestMethod, resourceRequestUri) {\r\n var _a, _b, _c;\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;\r\n return __generator$1(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n accessToken = \"\";\r\n responseScopes = [];\r\n expiresOn = null;\r\n familyId = Constants.EMPTY_STRING;\r\n if (!cacheRecord.accessToken) return [3 /*break*/, 4];\r\n if (!(cacheRecord.accessToken.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(cryptoObj);\r\n if (!resourceRequestMethod || !resourceRequestUri) {\r\n throw ClientConfigurationError.createResourceRequestParametersRequiredError();\r\n }\r\n return [4 /*yield*/, popTokenGenerator.signPopToken(cacheRecord.accessToken.secret, resourceRequestMethod, resourceRequestUri)];\r\n case 1:\r\n accessToken = _d.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n accessToken = cacheRecord.accessToken.secret;\r\n _d.label = 3;\r\n case 3:\r\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\r\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\r\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\r\n _d.label = 4;\r\n case 4:\r\n if (cacheRecord.appMetadata) {\r\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\r\n }\r\n uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;\r\n tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;\r\n return [2 /*return*/, {\r\n authority: authority.canonicalAuthority,\r\n uniqueId: uid,\r\n tenantId: tid,\r\n scopes: responseScopes,\r\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\r\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\r\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\r\n accessToken: accessToken,\r\n fromCache: fromTokenCache,\r\n expiresOn: expiresOn,\r\n extExpiresOn: extExpiresOn,\r\n familyId: familyId,\r\n tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,\r\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\r\n cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,\r\n msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n return ResponseHandler;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Oauth2.0 Authorization Code client\r\n */\r\nvar AuthorizationCodeClient = /** @class */ (function (_super) {\r\n __extends$1(AuthorizationCodeClient, _super);\r\n function AuthorizationCodeClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Creates the URL of the authorization request letting the user input credentials and consent to the\r\n * application. The URL target the /authorize endpoint of the authority configured in the\r\n * application object.\r\n *\r\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\r\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\r\n * acquireToken(AuthorizationCodeRequest)\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.getAuthCodeUrl = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var queryString;\r\n return __generator$1(this, function (_a) {\r\n queryString = this.createAuthCodeUrlQueryString(request);\r\n return [2 /*return*/, this.authority.authorizationEndpoint + \"?\" + queryString];\r\n });\r\n });\r\n };\r\n /**\r\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\r\n * authorization_code_grant\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var response, responseHandler;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.info(\"in acquireToken call\");\r\n if (!request || StringUtils.isEmpty(request.code)) {\r\n throw ClientAuthError.createTokenRequestCannotBeMadeError();\r\n }\r\n return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];\r\n case 1:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, request.resourceRequestMethod, request.resourceRequestUri, authCodePayload)];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Handles the hash fragment response from public client code request. Returns a code response used by\r\n * the client to exchange for a token in acquireToken.\r\n * @param hashFragment\r\n */\r\n AuthorizationCodeClient.prototype.handleFragmentResponse = function (hashFragment, cachedState) {\r\n // Handle responses.\r\n var responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\r\n // Deserialize hash fragment response parameters.\r\n var hashUrlString = new UrlString(hashFragment);\r\n // Deserialize hash fragment response parameters.\r\n var serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());\r\n // Get code response\r\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);\r\n // throw when there is no auth code in the response\r\n if (!serverParams.code) {\r\n throw ClientAuthError.createNoAuthCodeInServerResponseError();\r\n }\r\n return __assign$1(__assign$1({}, serverParams), { \r\n // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod\r\n code: serverParams.code });\r\n };\r\n /**\r\n * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param authorityUri\r\n */\r\n AuthorizationCodeClient.prototype.getLogoutUri = function (logoutRequest) {\r\n // Throw error if logoutRequest is null/undefined\r\n if (!logoutRequest) {\r\n throw ClientConfigurationError.createEmptyLogoutRequestError();\r\n }\r\n if (logoutRequest.account) {\r\n // Clear given account.\r\n this.cacheManager.removeAccount(AccountEntity.generateAccountCacheKey(logoutRequest.account));\r\n }\r\n else {\r\n // Clear all accounts and tokens\r\n this.cacheManager.clear();\r\n }\r\n var queryString = this.createLogoutUrlQueryString(logoutRequest);\r\n // Construct logout URI.\r\n return StringUtils.isEmpty(queryString) ? this.authority.endSessionEndpoint : this.authority.endSessionEndpoint + \"?\" + queryString;\r\n };\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.executeTokenRequest = function (authority, request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var thumbprint, requestBody, headers;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes\r\n };\r\n return [4 /*yield*/, this.createTokenRequestBody(request)];\r\n case 1:\r\n requestBody = _a.sent();\r\n headers = this.createDefaultTokenRequestHeaders();\r\n return [2 /*return*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var parameterBuilder, clientAssertion, popTokenGenerator, cnfString, correlationId;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n // validate the redirectUri (to be a non null value)\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n // Add scope array, parameter builder will add default scopes and dedupe\r\n parameterBuilder.addScopes(request.scopes);\r\n // add code: user set, not validated\r\n parameterBuilder.addAuthorizationCode(request.code);\r\n // add code_verifier if passed\r\n if (request.codeVerifier) {\r\n parameterBuilder.addCodeVerifier(request.codeVerifier);\r\n }\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\r\n parameterBuilder.addClientInfo();\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP && !!request.resourceRequestMethod && !!request.resourceRequestUri)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(request.resourceRequestMethod, request.resourceRequestUri)];\r\n case 1:\r\n cnfString = _a.sent();\r\n parameterBuilder.addPopToken(cnfString);\r\n _a.label = 2;\r\n case 2:\r\n correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return [2 /*return*/, parameterBuilder.createQueryString()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n var requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);\r\n parameterBuilder.addScopes(requestScopes);\r\n // validate the redirectUri (to be a non null value)\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n // generate the correlationId if not set by the user and add\r\n var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n // add response_mode. If not passed in it defaults to query.\r\n parameterBuilder.addResponseMode(request.responseMode);\r\n // add response_type = code\r\n parameterBuilder.addResponseTypeCode();\r\n // add library info parameters\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n // add client_info=1\r\n parameterBuilder.addClientInfo();\r\n if (request.codeChallenge && request.codeChallengeMethod) {\r\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\r\n }\r\n if (request.prompt) {\r\n parameterBuilder.addPrompt(request.prompt);\r\n }\r\n if (request.domainHint) {\r\n parameterBuilder.addDomainHint(request.domainHint);\r\n }\r\n // Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object\r\n if (request.sid) {\r\n parameterBuilder.addSid(request.sid);\r\n }\r\n else if (request.loginHint) {\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n }\r\n else if (request.account && request.account.username) {\r\n parameterBuilder.addLoginHint(request.account.username);\r\n }\r\n if (request.nonce) {\r\n parameterBuilder.addNonce(request.nonce);\r\n }\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n /**\r\n * This API validates the `EndSessionRequest` and creates a URL\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createLogoutUrlQueryString = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n if (request.postLogoutRedirectUri) {\r\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\r\n }\r\n if (request.correlationId) {\r\n parameterBuilder.addCorrelationId(request.correlationId);\r\n }\r\n if (request.idTokenHint) {\r\n parameterBuilder.addIdTokenHint(request.idTokenHint);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n return AuthorizationCodeClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * OAuth2.0 Device code client\r\n */\r\nvar DeviceCodeClient = /** @class */ (function (_super) {\r\n __extends$1(DeviceCodeClient, _super);\r\n function DeviceCodeClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Gets device code from device code endpoint, calls back to with device code response, and\r\n * polls token endpoint to exchange device code for tokens\r\n * @param request\r\n */\r\n DeviceCodeClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var deviceCodeResponse, response, responseHandler;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getDeviceCode(request)];\r\n case 1:\r\n deviceCodeResponse = _a.sent();\r\n request.deviceCodeCallback(deviceCodeResponse);\r\n return [4 /*yield*/, this.acquireTokenWithDeviceCode(request, deviceCodeResponse)];\r\n case 2:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response);\r\n return [4 /*yield*/, responseHandler.handleServerTokenResponse(response, this.authority, request.resourceRequestMethod, request.resourceRequestUri)];\r\n case 3: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates device code request and executes http GET\r\n * @param request\r\n */\r\n DeviceCodeClient.prototype.getDeviceCode = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var queryString, headers, thumbprint;\r\n return __generator$1(this, function (_a) {\r\n queryString = this.createQueryString(request);\r\n headers = this.createDefaultTokenRequestHeaders();\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes\r\n };\r\n return [2 /*return*/, this.executePostRequestToDeviceCodeEndpoint(this.authority.deviceCodeEndpoint, queryString, headers, thumbprint)];\r\n });\r\n });\r\n };\r\n /**\r\n * Executes POST request to device code endpoint\r\n * @param deviceCodeEndpoint\r\n * @param queryString\r\n * @param headers\r\n */\r\n DeviceCodeClient.prototype.executePostRequestToDeviceCodeEndpoint = function (deviceCodeEndpoint, queryString, headers, thumbprint) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var _a, userCode, deviceCode, verificationUri, expiresIn, interval, message;\r\n return __generator$1(this, function (_b) {\r\n switch (_b.label) {\r\n case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {\r\n body: queryString,\r\n headers: headers\r\n })];\r\n case 1:\r\n _a = (_b.sent()).body, userCode = _a.user_code, deviceCode = _a.device_code, verificationUri = _a.verification_uri, expiresIn = _a.expires_in, interval = _a.interval, message = _a.message;\r\n return [2 /*return*/, {\r\n userCode: userCode,\r\n deviceCode: deviceCode,\r\n verificationUri: verificationUri,\r\n expiresIn: expiresIn,\r\n interval: interval,\r\n message: message\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Create device code endpoint query parameters and returns string\r\n */\r\n DeviceCodeClient.prototype.createQueryString = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n /**\r\n * Creates token request with device code response and polls token endpoint at interval set by the device code\r\n * response\r\n * @param request\r\n * @param deviceCodeResponse\r\n */\r\n DeviceCodeClient.prototype.acquireTokenWithDeviceCode = function (request, deviceCodeResponse) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var requestBody, headers, userSpecifiedTimeout, deviceCodeExpirationTime, pollingIntervalMilli;\r\n var _this = this;\r\n return __generator$1(this, function (_a) {\r\n requestBody = this.createTokenRequestBody(request, deviceCodeResponse);\r\n headers = this.createDefaultTokenRequestHeaders();\r\n userSpecifiedTimeout = request.timeout ? TimeUtils.nowSeconds() + request.timeout : undefined;\r\n deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;\r\n pollingIntervalMilli = deviceCodeResponse.interval * 1000;\r\n /*\r\n * Poll token endpoint while (device code is not expired AND operation has not been cancelled by\r\n * setting CancellationToken.cancel = true). POST request is sent at interval set by pollingIntervalMilli\r\n */\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var intervalId = setInterval(function () { return __awaiter$1(_this, void 0, void 0, function () {\r\n var thumbprint, response, error_1;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 6, , 7]);\r\n if (!request.cancel) return [3 /*break*/, 1];\r\n this.logger.error(\"Token request cancelled by setting DeviceCodeRequest.cancel = true\");\r\n clearInterval(intervalId);\r\n reject(ClientAuthError.createDeviceCodeCancelledError());\r\n return [3 /*break*/, 5];\r\n case 1:\r\n if (!(userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils.nowSeconds() > userSpecifiedTimeout)) return [3 /*break*/, 2];\r\n this.logger.error(\"User defined timeout for device code polling reached. The timeout was set for \" + userSpecifiedTimeout);\r\n clearInterval(intervalId);\r\n reject(ClientAuthError.createUserTimeoutReachedError());\r\n return [3 /*break*/, 5];\r\n case 2:\r\n if (!(TimeUtils.nowSeconds() > deviceCodeExpirationTime)) return [3 /*break*/, 3];\r\n if (userSpecifiedTimeout) {\r\n this.logger.verbose(\"User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for \" + userSpecifiedTimeout);\r\n }\r\n this.logger.error(\"Device code expired. Expiration time of device code was \" + deviceCodeExpirationTime);\r\n clearInterval(intervalId);\r\n reject(ClientAuthError.createDeviceCodeExpiredError());\r\n return [3 /*break*/, 5];\r\n case 3:\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes\r\n };\r\n return [4 /*yield*/, this.executePostToTokenEndpoint(this.authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n case 4:\r\n response = _a.sent();\r\n if (response.body && response.body.error === Constants.AUTHORIZATION_PENDING) {\r\n // user authorization is pending. Sleep for polling interval and try again\r\n this.logger.info(response.body.error_description || \"no_error_description\");\r\n }\r\n else {\r\n clearInterval(intervalId);\r\n resolve(response.body);\r\n }\r\n _a.label = 5;\r\n case 5: return [3 /*break*/, 7];\r\n case 6:\r\n error_1 = _a.sent();\r\n clearInterval(intervalId);\r\n reject(error_1);\r\n return [3 /*break*/, 7];\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n }); }, pollingIntervalMilli);\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Creates query parameters and converts to string.\r\n * @param request\r\n * @param deviceCodeResponse\r\n */\r\n DeviceCodeClient.prototype.createTokenRequestBody = function (request, deviceCodeResponse) {\r\n var requestParameters = new RequestParameterBuilder();\r\n requestParameters.addScopes(request.scopes);\r\n requestParameters.addClientId(this.config.authOptions.clientId);\r\n requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);\r\n requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);\r\n var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n requestParameters.addCorrelationId(correlationId);\r\n requestParameters.addClientInfo();\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return requestParameters.createQueryString();\r\n };\r\n return DeviceCodeClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * OAuth2.0 refresh token client\r\n */\r\nvar RefreshTokenClient = /** @class */ (function (_super) {\r\n __extends$1(RefreshTokenClient, _super);\r\n function RefreshTokenClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n RefreshTokenClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var response, responseHandler;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 1:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n responseHandler.validateTokenResponse(response.body);\r\n return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, request.resourceRequestMethod, request.resourceRequestUri, undefined, [], undefined, true)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Gets cached refresh token and attaches to request, then calls acquireToken API\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.acquireTokenByRefreshToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var isFOCI, noFamilyRTInCache, clientMismatchErrorWithFamilyRT;\r\n return __generator$1(this, function (_a) {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);\r\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\r\n if (isFOCI) {\r\n try {\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, true)];\r\n }\r\n catch (e) {\r\n noFamilyRTInCache = e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.noTokensFoundError.code;\r\n clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;\r\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\r\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];\r\n // throw in all other cases\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n // fall back to application refresh token acquisition\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];\r\n });\r\n });\r\n };\r\n /**\r\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.acquireTokenWithCachedRefreshToken = function (request, foci) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var refreshToken, refreshTokenRequest;\r\n return __generator$1(this, function (_a) {\r\n refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);\r\n // no refresh Token\r\n if (!refreshToken) {\r\n throw ClientAuthError.createNoTokensFoundError();\r\n }\r\n refreshTokenRequest = __assign$1(__assign$1({}, request), { refreshToken: refreshToken.secret, authenticationScheme: AuthenticationScheme.BEARER });\r\n return [2 /*return*/, this.acquireToken(refreshTokenRequest)];\r\n });\r\n });\r\n };\r\n /**\r\n * Constructs the network message and makes a NW call to the underlying secure token service\r\n * @param request\r\n * @param authority\r\n */\r\n RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var requestBody, headers, thumbprint;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.createTokenRequestBody(request)];\r\n case 1:\r\n requestBody = _a.sent();\r\n headers = this.createDefaultTokenRequestHeaders();\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes\r\n };\r\n return [2 /*return*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper function to create the token request body\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.createTokenRequestBody = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, _a, _b;\r\n return __generator$1(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\r\n parameterBuilder.addClientInfo();\r\n correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n parameterBuilder.addRefreshToken(request.refreshToken);\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n if (!request.resourceRequestMethod || !request.resourceRequestUri) {\r\n throw ClientConfigurationError.createResourceRequestParametersRequiredError();\r\n }\r\n _b = (_a = parameterBuilder).addPopToken;\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(request.resourceRequestMethod, request.resourceRequestUri)];\r\n case 1:\r\n _b.apply(_a, [_c.sent()]);\r\n _c.label = 2;\r\n case 2:\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return [2 /*return*/, parameterBuilder.createQueryString()];\r\n }\r\n });\r\n });\r\n };\r\n return RefreshTokenClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * OAuth2.0 client credential grant\r\n */\r\nvar ClientCredentialClient = /** @class */ (function (_super) {\r\n __extends$1(ClientCredentialClient, _super);\r\n function ClientCredentialClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Public API to acquire a token with ClientCredential Flow for Confidential clients\r\n * @param request\r\n */\r\n ClientCredentialClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var cachedAuthenticationResult;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.scopeSet = new ScopeSet(request.scopes || []);\r\n if (!request.skipCache) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2: return [4 /*yield*/, this.getCachedAuthenticationResult()];\r\n case 3:\r\n cachedAuthenticationResult = _a.sent();\r\n if (!cachedAuthenticationResult) return [3 /*break*/, 4];\r\n return [2 /*return*/, cachedAuthenticationResult];\r\n case 4: return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 5: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * looks up cache if the tokens are cached already\r\n */\r\n ClientCredentialClient.prototype.getCachedAuthenticationResult = function () {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var cachedAccessToken;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n cachedAccessToken = this.readAccessTokenFromCache();\r\n if (!cachedAccessToken ||\r\n TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n return [2 /*return*/, null];\r\n }\r\n return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {\r\n account: null,\r\n idToken: null,\r\n accessToken: cachedAccessToken,\r\n refreshToken: null,\r\n appMetadata: null\r\n }, true)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Reads access token from the cache\r\n * TODO: Move this call to cacheManager instead\r\n */\r\n ClientCredentialClient.prototype.readAccessTokenFromCache = function () {\r\n var accessTokenFilter = {\r\n homeAccountId: \"\",\r\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n clientId: this.config.authOptions.clientId,\r\n realm: this.authority.tenant,\r\n target: this.scopeSet.printScopesLowerCase()\r\n };\r\n var credentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);\r\n var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });\r\n if (accessTokens.length < 1) {\r\n return null;\r\n }\r\n else if (accessTokens.length > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n return accessTokens[0];\r\n };\r\n /**\r\n * Makes a network call to request the token from the service\r\n * @param request\r\n * @param authority\r\n */\r\n ClientCredentialClient.prototype.executeTokenRequest = function (request, authority) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var requestBody, headers, thumbprint, response, responseHandler, tokenResponse;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n requestBody = this.createTokenRequestBody(request);\r\n headers = this.createDefaultTokenRequestHeaders();\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes\r\n };\r\n return [4 /*yield*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n case 1:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n responseHandler.validateTokenResponse(response.body);\r\n return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, request.resourceRequestMethod, request.resourceRequestUri, undefined, request.scopes)];\r\n case 2:\r\n tokenResponse = _a.sent();\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * generate the request to the server in the acceptable format\r\n * @param request\r\n */\r\n ClientCredentialClient.prototype.createTokenRequestBody = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addScopes(request.scopes, false);\r\n parameterBuilder.addGrantType(GrantType.CLIENT_CREDENTIALS_GRANT);\r\n var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n var clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n return ClientCredentialClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * On-Behalf-Of client\r\n */\r\nvar OnBehalfOfClient = /** @class */ (function (_super) {\r\n __extends$1(OnBehalfOfClient, _super);\r\n function OnBehalfOfClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Public API to acquire tokens with on behalf of flow\r\n * @param request\r\n */\r\n OnBehalfOfClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var cachedAuthenticationResult;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.scopeSet = new ScopeSet(request.scopes || []);\r\n if (!request.skipCache) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2: return [4 /*yield*/, this.getCachedAuthenticationResult(request)];\r\n case 3:\r\n cachedAuthenticationResult = _a.sent();\r\n if (!cachedAuthenticationResult) return [3 /*break*/, 4];\r\n return [2 /*return*/, cachedAuthenticationResult];\r\n case 4: return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 5: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * look up cache for tokens\r\n * @param request\r\n */\r\n OnBehalfOfClient.prototype.getCachedAuthenticationResult = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var cachedAccessToken, cachedIdToken, idTokenObject, cachedAccount, localAccountId, accountInfo;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n cachedAccessToken = this.readAccessTokenFromCache(request);\r\n if (!cachedAccessToken ||\r\n TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n return [2 /*return*/, null];\r\n }\r\n cachedIdToken = this.readIdTokenFromCache(request);\r\n cachedAccount = null;\r\n if (cachedIdToken) {\r\n idTokenObject = new AuthToken(cachedIdToken.secret, this.config.cryptoInterface);\r\n localAccountId = idTokenObject.claims.oid ? idTokenObject.claims.oid : idTokenObject.claims.sub;\r\n accountInfo = {\r\n homeAccountId: cachedIdToken.homeAccountId,\r\n environment: cachedIdToken.environment,\r\n tenantId: cachedIdToken.realm,\r\n username: Constants.EMPTY_STRING,\r\n localAccountId: localAccountId || \"\"\r\n };\r\n cachedAccount = this.readAccountFromCache(accountInfo);\r\n }\r\n return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {\r\n account: cachedAccount,\r\n accessToken: cachedAccessToken,\r\n idToken: cachedIdToken,\r\n refreshToken: null,\r\n appMetadata: null\r\n }, true, idTokenObject)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * read access token from cache TODO: CacheManager API should be used here\r\n * @param request\r\n */\r\n OnBehalfOfClient.prototype.readAccessTokenFromCache = function (request) {\r\n var accessTokenFilter = {\r\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n clientId: this.config.authOptions.clientId,\r\n realm: this.authority.tenant,\r\n target: this.scopeSet.printScopesLowerCase(),\r\n oboAssertion: request.oboAssertion\r\n };\r\n var credentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);\r\n var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });\r\n var numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n return null;\r\n }\r\n else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n return accessTokens[0];\r\n };\r\n /**\r\n * read idtoken from cache TODO: CacheManager API should be used here instead\r\n * @param request\r\n */\r\n OnBehalfOfClient.prototype.readIdTokenFromCache = function (request) {\r\n var idTokenFilter = {\r\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: this.config.authOptions.clientId,\r\n realm: this.authority.tenant,\r\n oboAssertion: request.oboAssertion\r\n };\r\n var credentialCache = this.cacheManager.getCredentialsFilteredBy(idTokenFilter);\r\n var idTokens = Object.keys(credentialCache.idTokens).map(function (key) { return credentialCache.idTokens[key]; });\r\n // When acquiring a token on behalf of an application, there might not be an id token in the cache\r\n if (idTokens.length < 1) {\r\n return null;\r\n }\r\n return idTokens[0];\r\n };\r\n /**\r\n * read account from cache, TODO: CacheManager API should be used here instead\r\n * @param account\r\n */\r\n OnBehalfOfClient.prototype.readAccountFromCache = function (account) {\r\n return this.cacheManager.readAccountFromCache(account);\r\n };\r\n /**\r\n * Make a network call to the server requesting credentials\r\n * @param request\r\n * @param authority\r\n */\r\n OnBehalfOfClient.prototype.executeTokenRequest = function (request, authority) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var requestBody, headers, thumbprint, response, responseHandler, tokenResponse;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n requestBody = this.createTokenRequestBody(request);\r\n headers = this.createDefaultTokenRequestHeaders();\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes\r\n };\r\n return [4 /*yield*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n case 1:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n responseHandler.validateTokenResponse(response.body);\r\n return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, request.resourceRequestMethod, request.resourceRequestUri, undefined, request.scopes, request.oboAssertion)];\r\n case 2:\r\n tokenResponse = _a.sent();\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * generate a server request in accepable format\r\n * @param request\r\n */\r\n OnBehalfOfClient.prototype.createTokenRequestBody = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addGrantType(GrantType.JWT_BEARER);\r\n parameterBuilder.addClientInfo();\r\n var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n parameterBuilder.addRequestTokenUse(AADServerParamKeys.ON_BEHALF_OF);\r\n parameterBuilder.addOboAssertion(request.oboAssertion);\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n var clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n return OnBehalfOfClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentFlowClient = /** @class */ (function (_super) {\r\n __extends$1(SilentFlowClient, _super);\r\n function SilentFlowClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\r\n * the given token and returns the renewed token\r\n * @param request\r\n */\r\n SilentFlowClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var e_1, refreshTokenClient;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, this.acquireCachedToken(request)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\r\n refreshTokenClient = new RefreshTokenClient(this.config);\r\n return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];\r\n }\r\n else {\r\n throw e_1;\r\n }\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Retrieves token from cache or throws an error if it must be refreshed.\r\n * @param request\r\n */\r\n SilentFlowClient.prototype.acquireCachedToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var requestScopes, environment, cacheRecord;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n requestScopes = new ScopeSet(request.scopes || []);\r\n environment = request.authority || Authority.generateEnvironmentFromAuthority(this.authority);\r\n cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment);\r\n if (!this.isRefreshRequired(request, cacheRecord.accessToken)) return [3 /*break*/, 1];\r\n throw ClientAuthError.createRefreshRequiredError();\r\n case 1:\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n return [4 /*yield*/, this.generateResultFromCacheRecord(cacheRecord, request.resourceRequestMethod, request.resourceRequestUri)];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper function to build response object from the CacheRecord\r\n * @param cacheRecord\r\n */\r\n SilentFlowClient.prototype.generateResultFromCacheRecord = function (cacheRecord, resourceRequestMethod, resourceRequestUri) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var idTokenObj;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (cacheRecord.idToken) {\r\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\r\n }\r\n return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, idTokenObj, undefined, resourceRequestMethod, resourceRequestUri)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Given a request object and an accessTokenEntity determine if the accessToken needs to be refreshed\r\n * @param request\r\n * @param cachedAccessToken\r\n */\r\n SilentFlowClient.prototype.isRefreshRequired = function (request, cachedAccessToken) {\r\n if (request.forceRefresh || request.claims) {\r\n // Must refresh due to request parameters\r\n return true;\r\n }\r\n else if (!cachedAccessToken || TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n // Must refresh due to expired or non-existent access_token\r\n return true;\r\n }\r\n return false;\r\n };\r\n return SilentFlowClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Oauth2.0 Password grant client\r\n * Note: We are only supporting public clients for password grant and for purely testing purposes\r\n */\r\nvar UsernamePasswordClient = /** @class */ (function (_super) {\r\n __extends$1(UsernamePasswordClient, _super);\r\n function UsernamePasswordClient(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * API to acquire a token by passing the username and password to the service in exchage of credentials\r\n * password_grant\r\n * @param request\r\n */\r\n UsernamePasswordClient.prototype.acquireToken = function (request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var response, responseHandler, tokenResponse;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.info(\"in acquireToken call\");\r\n return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];\r\n case 1:\r\n response = _a.sent();\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority);\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n UsernamePasswordClient.prototype.executeTokenRequest = function (authority, request) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var thumbprint, requestBody, headers;\r\n return __generator$1(this, function (_a) {\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes\r\n };\r\n requestBody = this.createTokenRequestBody(request);\r\n headers = this.createDefaultTokenRequestHeaders();\r\n return [2 /*return*/, this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint)];\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n UsernamePasswordClient.prototype.createTokenRequestBody = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addUsername(request.username);\r\n parameterBuilder.addPassword(request.password);\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);\r\n parameterBuilder.addClientInfo();\r\n var correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n return UsernamePasswordClient;\r\n}(BaseClient));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar AuthorityFactory = /** @class */ (function () {\r\n function AuthorityFactory() {\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 (i.e. aad, b2c, adfs)\r\n *\r\n * Also performs endpoint discovery.\r\n *\r\n * @param authorityUri\r\n * @param networkClient\r\n * @param protocolMode\r\n */\r\n AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, protocolMode) {\r\n return __awaiter$1(this, void 0, void 0, function () {\r\n var acquireTokenAuthority, e_1;\r\n return __generator$1(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, protocolMode);\r\n if (acquireTokenAuthority.discoveryComplete()) {\r\n return [2 /*return*/, acquireTokenAuthority];\r\n }\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, acquireTokenAuthority.resolveEndpointsAsync()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, acquireTokenAuthority];\r\n case 3:\r\n e_1 = _a.sent();\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(e_1);\r\n case 4: return [2 /*return*/];\r\n }\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 (i.e. aad, b2c, adfs)\r\n *\r\n * Does not perform endpoint discovery.\r\n *\r\n * @param authorityUrl\r\n * @param networkInterface\r\n * @param protocolMode\r\n */\r\n AuthorityFactory.createInstance = function (authorityUrl, networkInterface, protocolMode) {\r\n // Throw error if authority url is empty\r\n if (StringUtils.isEmpty(authorityUrl)) {\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n return new Authority(authorityUrl, networkInterface, protocolMode);\r\n };\r\n return AuthorityFactory;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ServerTelemetryEntity = /** @class */ (function () {\r\n function ServerTelemetryEntity() {\r\n this.failedRequests = [];\r\n this.errors = [];\r\n this.cacheHits = 0;\r\n }\r\n /**\r\n * validates if a given cache entry is \"Telemetry\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n ServerTelemetryEntity.isServerTelemetryEntity = function (key, entity) {\r\n var validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\r\n var validateEntity = true;\r\n if (entity) {\r\n validateEntity =\r\n entity.hasOwnProperty(\"failedRequests\") &&\r\n entity.hasOwnProperty(\"errors\") &&\r\n entity.hasOwnProperty(\"cacheHits\");\r\n }\r\n return validateKey && validateEntity;\r\n };\r\n return ServerTelemetryEntity;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ThrottlingEntity = /** @class */ (function () {\r\n function ThrottlingEntity() {\r\n }\r\n /**\r\n * validates if a given cache entry is \"Throttling\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n ThrottlingEntity.isThrottlingEntity = function (key, entity) {\r\n var validateKey = false;\r\n if (key) {\r\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\r\n }\r\n var validateEntity = true;\r\n if (entity) {\r\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\r\n }\r\n return validateKey && validateEntity;\r\n };\r\n return ThrottlingEntity;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar StubbedNetworkModule = {\r\n sendGetRequestAsync: function () {\r\n var notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n },\r\n sendPostRequestAsync: function () {\r\n var notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n }\r\n};\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ServerTelemetryManager = /** @class */ (function () {\r\n function ServerTelemetryManager(telemetryRequest, cacheManager) {\r\n this.cacheManager = cacheManager;\r\n this.apiId = telemetryRequest.apiId;\r\n this.correlationId = telemetryRequest.correlationId;\r\n this.forceRefresh = telemetryRequest.forceRefresh || false;\r\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\r\n }\r\n /**\r\n * API to add MSER Telemetry to request\r\n */\r\n ServerTelemetryManager.prototype.generateCurrentRequestHeaderValue = function () {\r\n var forceRefreshInt = this.forceRefresh ? 1 : 0;\r\n var request = \"\" + this.apiId + SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR + forceRefreshInt;\r\n var platformFields = \"\"; // TODO: Determine what we want to include\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, request, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n };\r\n /**\r\n * API to add MSER Telemetry for the last failed request\r\n */\r\n ServerTelemetryManager.prototype.generateLastRequestHeaderValue = function () {\r\n var lastRequests = this.getLastRequests();\r\n var maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n var failedRequests = lastRequests.failedRequests.slice(0, 2 * maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n var errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n var errorCount = lastRequests.errors.length;\r\n // Indicate whether this header contains all data or partial data\r\n var overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\r\n var platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n };\r\n /**\r\n * API to cache token failures for MSER data capture\r\n * @param error\r\n */\r\n ServerTelemetryManager.prototype.cacheFailedRequest = function (error) {\r\n var lastRequests = this.getLastRequests();\r\n lastRequests.failedRequests.push(this.apiId, this.correlationId);\r\n if (!StringUtils.isEmpty(error.subError)) {\r\n lastRequests.errors.push(error.subError);\r\n }\r\n else if (!StringUtils.isEmpty(error.errorCode)) {\r\n lastRequests.errors.push(error.errorCode);\r\n }\r\n else if (!!error && error.toString()) {\r\n lastRequests.errors.push(error.toString());\r\n }\r\n else {\r\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\r\n }\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n return;\r\n };\r\n /**\r\n * Update server telemetry cache entry by incrementing cache hit counter\r\n */\r\n ServerTelemetryManager.prototype.incrementCacheHits = function () {\r\n var lastRequests = this.getLastRequests();\r\n lastRequests.cacheHits += 1;\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n return lastRequests.cacheHits;\r\n };\r\n /**\r\n * Get the server telemetry entity from cache or initialize a new one\r\n */\r\n ServerTelemetryManager.prototype.getLastRequests = function () {\r\n var initialValue = new ServerTelemetryEntity();\r\n var lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey);\r\n return lastRequests || initialValue;\r\n };\r\n /**\r\n * Remove server telemetry cache entry\r\n */\r\n ServerTelemetryManager.prototype.clearTelemetryCache = function () {\r\n var lastRequests = this.getLastRequests();\r\n var numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n var errorCount = lastRequests.errors.length;\r\n if (numErrorsFlushed === errorCount) {\r\n // All errors were sent on last request, clear Telemetry cache\r\n this.cacheManager.removeItem(this.telemetryCacheKey);\r\n }\r\n else {\r\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\r\n var serverTelemEntity = new ServerTelemetryEntity();\r\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed * 2); // failedRequests contains 2 items for each error\r\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\r\n }\r\n };\r\n /**\r\n * Returns the maximum number of errors that can be flushed to the server in the next network request\r\n * @param serverTelemetryEntity\r\n */\r\n ServerTelemetryManager.maxErrorsToSend = function (serverTelemetryEntity) {\r\n var i;\r\n var maxErrors = 0;\r\n var dataSize = 0;\r\n var errorCount = serverTelemetryEntity.errors.length;\r\n for (i = 0; i < errorCount; i++) {\r\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\r\n var apiId = serverTelemetryEntity.failedRequests[2 * i] || Constants.EMPTY_STRING;\r\n var correlationId = serverTelemetryEntity.failedRequests[2 * i + 1] || Constants.EMPTY_STRING;\r\n var errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\r\n // Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators\r\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\r\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_HEADER_BYTES) {\r\n // Adding this entry to the header would still keep header size below the limit\r\n maxErrors += 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return maxErrors;\r\n };\r\n return ServerTelemetryManager;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Constants\r\n */\r\nvar BrowserConstants = {\r\n // Interaction in progress cache value\r\n INTERACTION_IN_PROGRESS_VALUE: \"interaction_in_progress\",\r\n // Invalid grant error code\r\n INVALID_GRANT_ERROR: \"invalid_grant\",\r\n // Default popup window width\r\n POPUP_WIDTH: 483,\r\n // Default popup window height\r\n POPUP_HEIGHT: 600,\r\n // Default popup monitor poll interval in milliseconds\r\n POLL_INTERVAL_MS: 50,\r\n // msal-browser SKU\r\n MSAL_SKU: \"msal.js.browser\",\r\n};\r\nvar BrowserCacheLocation;\r\n(function (BrowserCacheLocation) {\r\n BrowserCacheLocation[\"LocalStorage\"] = \"localStorage\";\r\n BrowserCacheLocation[\"SessionStorage\"] = \"sessionStorage\";\r\n BrowserCacheLocation[\"MemoryStorage\"] = \"memoryStorage\";\r\n})(BrowserCacheLocation || (BrowserCacheLocation = {}));\r\n/**\r\n * HTTP Request types supported by MSAL.\r\n */\r\nvar HTTP_REQUEST_TYPE;\r\n(function (HTTP_REQUEST_TYPE) {\r\n HTTP_REQUEST_TYPE[\"GET\"] = \"GET\";\r\n HTTP_REQUEST_TYPE[\"POST\"] = \"POST\";\r\n})(HTTP_REQUEST_TYPE || (HTTP_REQUEST_TYPE = {}));\r\n/**\r\n * Temporary cache keys for MSAL, deleted after any request.\r\n */\r\nvar TemporaryCacheKeys;\r\n(function (TemporaryCacheKeys) {\r\n TemporaryCacheKeys[\"AUTHORITY\"] = \"authority\";\r\n TemporaryCacheKeys[\"ACQUIRE_TOKEN_ACCOUNT\"] = \"acquireToken.account\";\r\n TemporaryCacheKeys[\"SESSION_STATE\"] = \"session.state\";\r\n TemporaryCacheKeys[\"REQUEST_STATE\"] = \"request.state\";\r\n TemporaryCacheKeys[\"NONCE_IDTOKEN\"] = \"nonce.id_token\";\r\n TemporaryCacheKeys[\"ORIGIN_URI\"] = \"request.origin\";\r\n TemporaryCacheKeys[\"RENEW_STATUS\"] = \"token.renew.status\";\r\n TemporaryCacheKeys[\"URL_HASH\"] = \"urlHash\";\r\n TemporaryCacheKeys[\"REQUEST_PARAMS\"] = \"request.params\";\r\n TemporaryCacheKeys[\"SCOPES\"] = \"scopes\";\r\n TemporaryCacheKeys[\"INTERACTION_STATUS_KEY\"] = \"interaction.status\";\r\n})(TemporaryCacheKeys || (TemporaryCacheKeys = {}));\r\n/**\r\n * API Codes for Telemetry purposes.\r\n * Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs\r\n * 0-99 Silent Flow\r\n * 800-899 Auth Code Flow\r\n */\r\nvar ApiId;\r\n(function (ApiId) {\r\n ApiId[ApiId[\"acquireTokenRedirect\"] = 861] = \"acquireTokenRedirect\";\r\n ApiId[ApiId[\"acquireTokenPopup\"] = 862] = \"acquireTokenPopup\";\r\n ApiId[ApiId[\"ssoSilent\"] = 863] = \"ssoSilent\";\r\n ApiId[ApiId[\"acquireTokenSilent_authCode\"] = 864] = \"acquireTokenSilent_authCode\";\r\n ApiId[ApiId[\"handleRedirectPromise\"] = 865] = \"handleRedirectPromise\";\r\n ApiId[ApiId[\"acquireTokenSilent_silentFlow\"] = 61] = \"acquireTokenSilent_silentFlow\";\r\n ApiId[ApiId[\"logout\"] = 961] = \"logout\";\r\n})(ApiId || (ApiId = {}));\r\n/*\r\n * Interaction type of the API - used for state and telemetry\r\n */\r\nvar InteractionType;\r\n(function (InteractionType) {\r\n InteractionType[\"Redirect\"] = \"redirect\";\r\n InteractionType[\"Popup\"] = \"popup\";\r\n InteractionType[\"Silent\"] = \"silent\";\r\n})(InteractionType || (InteractionType = {}));\r\nvar DEFAULT_REQUEST = {\r\n scopes: [Constants.OPENID_SCOPE, Constants.PROFILE_SCOPE]\r\n};\r\n// JWK Key Format string (Type MUST be defined for window crypto APIs)\r\nvar KEY_FORMAT_JWK = \"jwk\";\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class for math specific functions in browser.\r\n */\r\nvar MathUtils = /** @class */ (function () {\r\n function MathUtils() {\r\n }\r\n /**\r\n * Decimal to Hex\r\n *\r\n * @param num\r\n */\r\n MathUtils.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 return MathUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar GuidGenerator = /** @class */ (function () {\r\n function GuidGenerator(cryptoObj) {\r\n this.cryptoObj = cryptoObj;\r\n }\r\n /*\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 GuidGenerator.prototype.generateGuid = function () {\r\n try {\r\n var buffer = new Uint8Array(16);\r\n this.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 MathUtils.decimalToHex(buffer[0]) + MathUtils.decimalToHex(buffer[1])\r\n + MathUtils.decimalToHex(buffer[2]) + MathUtils.decimalToHex(buffer[3])\r\n + \"-\" + MathUtils.decimalToHex(buffer[4]) + MathUtils.decimalToHex(buffer[5])\r\n + \"-\" + MathUtils.decimalToHex(buffer[6]) + MathUtils.decimalToHex(buffer[7])\r\n + \"-\" + MathUtils.decimalToHex(buffer[8]) + MathUtils.decimalToHex(buffer[9])\r\n + \"-\" + MathUtils.decimalToHex(buffer[10]) + MathUtils.decimalToHex(buffer[11])\r\n + MathUtils.decimalToHex(buffer[12]) + MathUtils.decimalToHex(buffer[13])\r\n + MathUtils.decimalToHex(buffer[14]) + MathUtils.decimalToHex(buffer[15]);\r\n }\r\n catch (err) {\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 * verifies if a string is GUID\r\n * @param guid\r\n */\r\n GuidGenerator.isGuid = function (guid) {\r\n var regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\r\n return regexGuid.test(guid);\r\n };\r\n return GuidGenerator;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility functions for strings in a browser. See here for implementation details:\r\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\r\n */\r\nvar BrowserStringUtils = /** @class */ (function () {\r\n function BrowserStringUtils() {\r\n }\r\n /**\r\n * Converts string to Uint8Array\r\n * @param sDOMStr\r\n */\r\n BrowserStringUtils.stringToUtf8Arr = function (sDOMStr) {\r\n var nChr;\r\n var nArrLen = 0;\r\n var nStrLen = sDOMStr.length;\r\n /* mapping... */\r\n for (var nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {\r\n nChr = sDOMStr.charCodeAt(nMapIdx);\r\n nArrLen += nChr < 0x80 ? 1 : nChr < 0x800 ? 2 : nChr < 0x10000 ? 3 : nChr < 0x200000 ? 4 : nChr < 0x4000000 ? 5 : 6;\r\n }\r\n var aBytes = new Uint8Array(nArrLen);\r\n /* transcription... */\r\n for (var nIdx = 0, nChrIdx = 0; nIdx < nArrLen; nChrIdx++) {\r\n nChr = sDOMStr.charCodeAt(nChrIdx);\r\n if (nChr < 128) {\r\n /* one byte */\r\n aBytes[nIdx++] = nChr;\r\n }\r\n else if (nChr < 0x800) {\r\n /* two bytes */\r\n aBytes[nIdx++] = 192 + (nChr >>> 6);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x10000) {\r\n /* three bytes */\r\n aBytes[nIdx++] = 224 + (nChr >>> 12);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x200000) {\r\n /* four bytes */\r\n aBytes[nIdx++] = 240 + (nChr >>> 18);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x4000000) {\r\n /* five bytes */\r\n aBytes[nIdx++] = 248 + (nChr >>> 24);\r\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else /* if (nChr <= 0x7fffffff) */ {\r\n /* six bytes */\r\n aBytes[nIdx++] = 252 + (nChr >>> 30);\r\n aBytes[nIdx++] = 128 + (nChr >>> 24 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n }\r\n return aBytes;\r\n };\r\n /**\r\n * Converst string to ArrayBuffer\r\n * @param dataString\r\n */\r\n BrowserStringUtils.stringToArrayBuffer = function (dataString) {\r\n var data = new ArrayBuffer(dataString.length);\r\n var dataView = new Uint8Array(data);\r\n for (var i = 0; i < dataString.length; i++) {\r\n dataView[i] = dataString.charCodeAt(i);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Converts Uint8Array to a string\r\n * @param aBytes\r\n */\r\n BrowserStringUtils.utf8ArrToString = function (aBytes) {\r\n var sView = \"\";\r\n for (var nPart = void 0, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {\r\n nPart = aBytes[nIdx];\r\n sView += String.fromCharCode(nPart > 251 && nPart < 254 && nIdx + 5 < nLen ? /* six bytes */\r\n /* (nPart - 252 << 30) may be not so safe in ECMAScript! So...: */\r\n (nPart - 252) * 1073741824 + (aBytes[++nIdx] - 128 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 247 && nPart < 252 && nIdx + 4 < nLen ? /* five bytes */\r\n (nPart - 248 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 239 && nPart < 248 && nIdx + 3 < nLen ? /* four bytes */\r\n (nPart - 240 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 223 && nPart < 240 && nIdx + 2 < nLen ? /* three bytes */\r\n (nPart - 224 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 191 && nPart < 224 && nIdx + 1 < nLen ? /* two bytes */\r\n (nPart - 192 << 6) + aBytes[++nIdx] - 128\r\n : /* nPart < 127 ? */ /* one byte */\r\n nPart);\r\n }\r\n return sView;\r\n };\r\n return BrowserStringUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:\r\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\r\n */\r\nvar Base64Encode = /** @class */ (function () {\r\n function Base64Encode() {\r\n }\r\n /**\r\n * Returns URL Safe b64 encoded string from a plaintext string.\r\n * @param input\r\n */\r\n Base64Encode.prototype.urlEncode = function (input) {\r\n return encodeURIComponent(this.encode(input)\r\n .replace(/=/g, \"\")\r\n .replace(/\\+/g, \"-\")\r\n .replace(/\\//g, \"_\"));\r\n };\r\n /**\r\n * Returns URL Safe b64 encoded string from an int8Array.\r\n * @param inputArr\r\n */\r\n Base64Encode.prototype.urlEncodeArr = function (inputArr) {\r\n return this.base64EncArr(inputArr)\r\n .replace(/=/g, \"\")\r\n .replace(/\\+/g, \"-\")\r\n .replace(/\\//g, \"_\");\r\n };\r\n /**\r\n * Returns b64 encoded string from plaintext string.\r\n * @param input\r\n */\r\n Base64Encode.prototype.encode = function (input) {\r\n var inputUtf8Arr = BrowserStringUtils.stringToUtf8Arr(input);\r\n return this.base64EncArr(inputUtf8Arr);\r\n };\r\n /**\r\n * Base64 encode byte array\r\n * @param aBytes\r\n */\r\n Base64Encode.prototype.base64EncArr = function (aBytes) {\r\n var eqLen = (3 - (aBytes.length % 3)) % 3;\r\n var sB64Enc = \"\";\r\n for (var nMod3 = void 0, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {\r\n nMod3 = nIdx % 3;\r\n /* Uncomment the following line in order to split the output in lines 76-character long: */\r\n /*\r\n *if (nIdx > 0 && (nIdx * 4 / 3) % 76 === 0) { sB64Enc += \"\\r\\n\"; }\r\n */\r\n nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24);\r\n if (nMod3 === 2 || aBytes.length - nIdx === 1) {\r\n sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63));\r\n nUint24 = 0;\r\n }\r\n }\r\n return eqLen === 0 ? sB64Enc : sB64Enc.substring(0, sB64Enc.length - eqLen) + (eqLen === 1 ? \"=\" : \"==\");\r\n };\r\n /**\r\n * Base64 string to array encoding helper\r\n * @param nUint6\r\n */\r\n Base64Encode.prototype.uint6ToB64 = function (nUint6) {\r\n return nUint6 < 26 ?\r\n nUint6 + 65\r\n : nUint6 < 52 ?\r\n nUint6 + 71\r\n : nUint6 < 62 ?\r\n nUint6 - 4\r\n : nUint6 === 62 ?\r\n 43\r\n : nUint6 === 63 ?\r\n 47\r\n :\r\n 65;\r\n };\r\n return Base64Encode;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which exposes APIs to decode base64 strings to plaintext. See here for implementation details:\r\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\r\n */\r\nvar Base64Decode = /** @class */ (function () {\r\n function Base64Decode() {\r\n }\r\n /**\r\n * Returns a URL-safe plaintext decoded string from b64 encoded input.\r\n * @param input\r\n */\r\n Base64Decode.prototype.decode = function (input) {\r\n var encodedString = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n switch (encodedString.length % 4) {\r\n case 0:\r\n break;\r\n case 2:\r\n encodedString += \"==\";\r\n break;\r\n case 3:\r\n encodedString += \"=\";\r\n break;\r\n default:\r\n throw new Error(\"Invalid base64 string\");\r\n }\r\n var inputUtf8Arr = this.base64DecToArr(encodedString);\r\n return BrowserStringUtils.utf8ArrToString(inputUtf8Arr);\r\n };\r\n /**\r\n * Decodes base64 into Uint8Array\r\n * @param base64String\r\n * @param nBlockSize\r\n */\r\n Base64Decode.prototype.base64DecToArr = function (base64String, nBlockSize) {\r\n var sB64Enc = base64String.replace(/[^A-Za-z0-9\\+\\/]/g, \"\");\r\n var nInLen = sB64Enc.length;\r\n var nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2;\r\n var aBytes = new Uint8Array(nOutLen);\r\n for (var nMod3 = void 0, nMod4 = void 0, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) {\r\n nMod4 = nInIdx & 3;\r\n nUint24 |= this.b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4;\r\n if (nMod4 === 3 || nInLen - nInIdx === 1) {\r\n for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {\r\n aBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255;\r\n }\r\n nUint24 = 0;\r\n }\r\n }\r\n return aBytes;\r\n };\r\n /**\r\n * Base64 string to array decoding helper\r\n * @param charNum\r\n */\r\n Base64Decode.prototype.b64ToUint6 = function (charNum) {\r\n return charNum > 64 && charNum < 91 ?\r\n charNum - 65\r\n : charNum > 96 && charNum < 123 ?\r\n charNum - 71\r\n : charNum > 47 && charNum < 58 ?\r\n charNum + 4\r\n : charNum === 43 ?\r\n 62\r\n : charNum === 47 ?\r\n 63\r\n :\r\n 0;\r\n };\r\n return Base64Decode;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar BrowserAuthErrorMessage = {\r\n pkceNotGenerated: {\r\n code: \"pkce_not_created\",\r\n desc: \"The PKCE code challenge and verifier could not be generated.\"\r\n },\r\n cryptoDoesNotExist: {\r\n code: \"crypto_nonexistent\",\r\n desc: \"The crypto object or function is not available.\"\r\n },\r\n httpMethodNotImplementedError: {\r\n code: \"http_method_not_implemented\",\r\n desc: \"The HTTP method given has not been implemented in this library.\"\r\n },\r\n emptyNavigateUriError: {\r\n code: \"empty_navigate_uri\",\r\n desc: \"Navigation URI is empty. Please check stack trace for more info.\"\r\n },\r\n hashEmptyError: {\r\n code: \"hash_empty_error\",\r\n desc: \"Hash value cannot be processed because it is empty.\"\r\n },\r\n hashDoesNotContainStateError: {\r\n code: \"no_state_in_hash\",\r\n desc: \"Hash does not contain state. Please verify that the request originated from msal.\"\r\n },\r\n unableToParseStateError: {\r\n code: \"unable_to_parse_state\",\r\n desc: \"Unable to parse state. Please verify that the request originated from msal.\"\r\n },\r\n stateInteractionTypeMismatchError: {\r\n code: \"state_interaction_type_mismatch\",\r\n desc: \"Hash contains state but the interaction type does not match the caller.\"\r\n },\r\n interactionInProgress: {\r\n code: \"interaction_in_progress\",\r\n desc: \"Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API.\"\r\n },\r\n popUpWindowError: {\r\n code: \"popup_window_error\",\r\n desc: \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"\r\n },\r\n emptyWindowError: {\r\n code: \"empty_window_error\",\r\n desc: \"window.open returned null or undefined window object.\"\r\n },\r\n userCancelledError: {\r\n code: \"user_cancelled\",\r\n desc: \"User cancelled the flow.\"\r\n },\r\n monitorPopupTimeoutError: {\r\n code: \"monitor_window_timeout\",\r\n desc: \"Token acquisition in popup failed due to timeout.\"\r\n },\r\n monitorIframeTimeoutError: {\r\n code: \"monitor_window_timeout\",\r\n desc: \"Token acquisition in iframe failed due to timeout.\"\r\n },\r\n redirectInIframeError: {\r\n code: \"redirect_in_iframe\",\r\n desc: \"Code flow is not supported inside an iframe. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.\"\r\n },\r\n blockTokenRequestsInHiddenIframeError: {\r\n code: \"block_iframe_reload\",\r\n desc: \"Request was blocked inside an iframe because MSAL detected an authentication response. Please ensure monitorWindowForHash was called.\"\r\n },\r\n iframeClosedPrematurelyError: {\r\n code: \"iframe_closed_prematurely\",\r\n desc: \"The iframe being monitored was closed prematurely.\"\r\n },\r\n silentSSOInsufficientInfoError: {\r\n code: \"silent_sso_error\",\r\n desc: \"Silent SSO could not be completed - insufficient information was provided. Please provide either a loginHint or sid.\"\r\n },\r\n noAccountError: {\r\n code: \"no_account_error\",\r\n desc: \"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.\"\r\n },\r\n silentPromptValueError: {\r\n code: \"silent_prompt_value_error\",\r\n desc: \"The value given for the prompt value is not valid for silent requests - must be set to 'none'.\"\r\n },\r\n noTokenRequestCacheError: {\r\n code: \"no_token_request_cache_error\",\r\n desc: \"No token request in found in cache.\"\r\n },\r\n unableToParseTokenRequestCacheError: {\r\n code: \"unable_to_parse_token_request_cache_error\",\r\n desc: \"The cached token request could not be parsed.\"\r\n },\r\n noCachedAuthorityError: {\r\n code: \"no_cached_authority_error\",\r\n desc: \"No cached authority found.\"\r\n },\r\n authRequestNotSet: {\r\n code: \"auth_request_not_set_error\",\r\n desc: \"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler\"\r\n },\r\n invalidCacheType: {\r\n code: \"invalid_cache_type\",\r\n desc: \"Invalid cache type\"\r\n },\r\n notInBrowserEnvironment: {\r\n code: \"non_browser_environment\",\r\n desc: \"Login and token requests are not supported in non-browser environments.\"\r\n },\r\n databaseNotOpen: {\r\n code: \"database_not_open\",\r\n desc: \"Database is not open!\"\r\n }\r\n};\r\n/**\r\n * Browser library error class thrown by the MSAL.js library for SPAs\r\n */\r\nvar BrowserAuthError = /** @class */ (function (_super) {\r\n __extends(BrowserAuthError, _super);\r\n function BrowserAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n Object.setPrototypeOf(_this, BrowserAuthError.prototype);\r\n _this.name = \"BrowserAuthError\";\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when PKCE is not implemented.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createPkceNotGeneratedError = function (errDetail) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.pkceNotGenerated.code, BrowserAuthErrorMessage.pkceNotGenerated.desc + \" Detail:\" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when the crypto object is unavailable.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createCryptoNotAvailableError = function (errDetail) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.cryptoDoesNotExist.code, BrowserAuthErrorMessage.cryptoDoesNotExist.desc + \" Detail:\" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when an HTTP method hasn't been implemented by the browser class.\r\n * @param method\r\n */\r\n BrowserAuthError.createHttpMethodNotImplementedError = function (method) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.httpMethodNotImplementedError.code, BrowserAuthErrorMessage.httpMethodNotImplementedError.desc + \" Given Method: \" + method);\r\n };\r\n /**\r\n * Creates an error thrown when the navigation URI is empty.\r\n */\r\n BrowserAuthError.createEmptyNavigationUriError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.emptyNavigateUriError.code, BrowserAuthErrorMessage.emptyNavigateUriError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n * @param hashValue\r\n */\r\n BrowserAuthError.createEmptyHashError = function (hashValue) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.hashEmptyError.code, BrowserAuthErrorMessage.hashEmptyError.desc + \" Given Url: \" + hashValue);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n */\r\n BrowserAuthError.createHashDoesNotContainStateError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.hashDoesNotContainStateError.code, BrowserAuthErrorMessage.hashDoesNotContainStateError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n */\r\n BrowserAuthError.createUnableToParseStateError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToParseStateError.code, BrowserAuthErrorMessage.unableToParseStateError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the state value in the hash does not match the interaction type of the API attempting to consume it.\r\n */\r\n BrowserAuthError.createStateInteractionTypeMismatchError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.stateInteractionTypeMismatchError.code, BrowserAuthErrorMessage.stateInteractionTypeMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a browser interaction (redirect or popup) is in progress.\r\n */\r\n BrowserAuthError.createInteractionInProgressError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.interactionInProgress.code, BrowserAuthErrorMessage.interactionInProgress.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the popup window could not be opened.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createPopupWindowError = function (errDetail) {\r\n var errorMessage = BrowserAuthErrorMessage.popUpWindowError.desc;\r\n errorMessage = !StringUtils.isEmpty(errDetail) ? errorMessage + \" Details: \" + errDetail : errorMessage;\r\n return new BrowserAuthError(BrowserAuthErrorMessage.popUpWindowError.code, errorMessage);\r\n };\r\n /**\r\n * Creates an error thrown when window.open returns an empty window object.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createEmptyWindowCreatedError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.emptyWindowError.code, BrowserAuthErrorMessage.emptyWindowError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the user closes a popup.\r\n */\r\n BrowserAuthError.createUserCancelledError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.userCancelledError.code, BrowserAuthErrorMessage.userCancelledError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when monitorPopupFromHash times out for a given popup.\r\n */\r\n BrowserAuthError.createMonitorPopupTimeoutError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.monitorPopupTimeoutError.code, BrowserAuthErrorMessage.monitorPopupTimeoutError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when monitorIframeFromHash times out for a given iframe.\r\n */\r\n BrowserAuthError.createMonitorIframeTimeoutError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.monitorIframeTimeoutError.code, BrowserAuthErrorMessage.monitorIframeTimeoutError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when navigateWindow is called inside an iframe.\r\n * @param windowParentCheck\r\n */\r\n BrowserAuthError.createRedirectInIframeError = function (windowParentCheck) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.redirectInIframeError.code, BrowserAuthErrorMessage.redirectInIframeError.desc + \" (window.parent !== window) => \" + windowParentCheck);\r\n };\r\n /**\r\n * Creates an error thrown when an auth reload is done inside an iframe.\r\n */\r\n BrowserAuthError.createBlockReloadInHiddenIframeError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.blockTokenRequestsInHiddenIframeError.code, BrowserAuthErrorMessage.blockTokenRequestsInHiddenIframeError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when an iframe is found to be closed before the timeout is reached.\r\n */\r\n BrowserAuthError.createIframeClosedPrematurelyError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.iframeClosedPrematurelyError.code, BrowserAuthErrorMessage.iframeClosedPrematurelyError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the login_hint, sid or account object is not provided in the ssoSilent API.\r\n */\r\n BrowserAuthError.createSilentSSOInsufficientInfoError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.silentSSOInsufficientInfoError.code, BrowserAuthErrorMessage.silentSSOInsufficientInfoError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the account object is not provided in the acquireTokenSilent API.\r\n */\r\n BrowserAuthError.createNoAccountError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noAccountError.code, BrowserAuthErrorMessage.noAccountError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a given prompt value is invalid for silent requests.\r\n */\r\n BrowserAuthError.createSilentPromptValueError = function (givenPrompt) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.silentPromptValueError.code, BrowserAuthErrorMessage.silentPromptValueError.desc + \" Given value: \" + givenPrompt);\r\n };\r\n /**\r\n * Creates an error thrown when the cached token request could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createUnableToParseTokenRequestCacheError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToParseTokenRequestCacheError.code, BrowserAuthErrorMessage.unableToParseTokenRequestCacheError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the token request could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createNoTokenRequestCacheError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noTokenRequestCacheError.code, BrowserAuthErrorMessage.noTokenRequestCacheError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when handleCodeResponse is called before initiateAuthRequest (InteractionHandler)\r\n */\r\n BrowserAuthError.createAuthRequestNotSetError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.authRequestNotSet.code, BrowserAuthErrorMessage.authRequestNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the authority could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createNoCachedAuthorityError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noCachedAuthorityError.code, BrowserAuthErrorMessage.noCachedAuthorityError.desc);\r\n };\r\n /**\r\n * Creates an error thrown if cache type is invalid.\r\n */\r\n BrowserAuthError.createInvalidCacheTypeError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.invalidCacheType.code, \"\" + BrowserAuthErrorMessage.invalidCacheType.desc);\r\n };\r\n /**\r\n * Create an error thrown when login and token requests are made from a non-browser environment\r\n */\r\n BrowserAuthError.createNonBrowserEnvironmentError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.notInBrowserEnvironment.code, BrowserAuthErrorMessage.notInBrowserEnvironment.desc);\r\n };\r\n /**\r\n * Create an error thrown when indexDB database is not open\r\n */\r\n BrowserAuthError.createDatabaseNotOpenError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.databaseNotOpen.code, BrowserAuthErrorMessage.databaseNotOpen.desc);\r\n };\r\n return BrowserAuthError;\r\n}(AuthError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Constant byte array length\r\nvar RANDOM_BYTE_ARR_LENGTH = 32;\r\n/**\r\n * Class which exposes APIs to generate PKCE codes and code verifiers.\r\n */\r\nvar PkceGenerator = /** @class */ (function () {\r\n function PkceGenerator(cryptoObj) {\r\n this.base64Encode = new Base64Encode();\r\n this.cryptoObj = cryptoObj;\r\n }\r\n /**\r\n * Generates PKCE Codes. See the RFC for more information: https://tools.ietf.org/html/rfc7636\r\n */\r\n PkceGenerator.prototype.generateCodes = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var codeVerifier, codeChallenge;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n codeVerifier = this.generateCodeVerifier();\r\n return [4 /*yield*/, this.generateCodeChallengeFromVerifier(codeVerifier)];\r\n case 1:\r\n codeChallenge = _a.sent();\r\n return [2 /*return*/, {\r\n verifier: codeVerifier,\r\n challenge: codeChallenge\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a random 32 byte buffer and returns the base64\r\n * encoded string to be used as a PKCE Code Verifier\r\n */\r\n PkceGenerator.prototype.generateCodeVerifier = function () {\r\n try {\r\n // Generate random values as utf-8\r\n var buffer = new Uint8Array(RANDOM_BYTE_ARR_LENGTH);\r\n this.cryptoObj.getRandomValues(buffer);\r\n // encode verifier as base64\r\n var pkceCodeVerifierB64 = this.base64Encode.urlEncodeArr(buffer);\r\n return pkceCodeVerifierB64;\r\n }\r\n catch (e) {\r\n throw BrowserAuthError.createPkceNotGeneratedError(e);\r\n }\r\n };\r\n /**\r\n * Creates a base64 encoded PKCE Code Challenge string from the\r\n * hash created from the PKCE Code Verifier supplied\r\n */\r\n PkceGenerator.prototype.generateCodeChallengeFromVerifier = function (pkceCodeVerifier) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var pkceHashedCodeVerifier, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, this.cryptoObj.sha256Digest(pkceCodeVerifier)];\r\n case 1:\r\n pkceHashedCodeVerifier = _a.sent();\r\n // encode hash as base64\r\n return [2 /*return*/, this.base64Encode.urlEncodeArr(new Uint8Array(pkceHashedCodeVerifier))];\r\n case 2:\r\n e_1 = _a.sent();\r\n throw BrowserAuthError.createPkceNotGeneratedError(e_1);\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return PkceGenerator;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams\r\n */\r\n// RSA KeyGen Algorithm\r\nvar PKCS1_V15_KEYGEN_ALG = \"RSASSA-PKCS1-v1_5\";\r\n// SHA-256 hashing algorithm\r\nvar S256_HASH_ALG = \"SHA-256\";\r\n// MOD length for PoP tokens\r\nvar MODULUS_LENGTH = 2048;\r\n// Public Exponent\r\nvar PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);\r\n/**\r\n * This class implements functions used by the browser library to perform cryptography operations such as\r\n * hashing and encoding. It also has helper functions to validate the availability of specific APIs.\r\n */\r\nvar BrowserCrypto = /** @class */ (function () {\r\n function BrowserCrypto() {\r\n if (!(this.hasCryptoAPI())) {\r\n throw BrowserAuthError.createCryptoNotAvailableError(\"Browser crypto or msCrypto object not available.\");\r\n }\r\n this._keygenAlgorithmOptions = {\r\n name: PKCS1_V15_KEYGEN_ALG,\r\n hash: S256_HASH_ALG,\r\n modulusLength: MODULUS_LENGTH,\r\n publicExponent: PUBLIC_EXPONENT\r\n };\r\n }\r\n /**\r\n * Returns a sha-256 hash of the given dataString as an ArrayBuffer.\r\n * @param dataString\r\n */\r\n BrowserCrypto.prototype.sha256Digest = function (dataString) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var data;\r\n return __generator(this, function (_a) {\r\n data = BrowserStringUtils.stringToUtf8Arr(dataString);\r\n return [2 /*return*/, this.hasIECrypto() ? this.getMSCryptoDigest(S256_HASH_ALG, data) : this.getSubtleCryptoDigest(S256_HASH_ALG, data)];\r\n });\r\n });\r\n };\r\n /**\r\n * Populates buffer with cryptographically random values.\r\n * @param dataBuffer\r\n */\r\n BrowserCrypto.prototype.getRandomValues = function (dataBuffer) {\r\n var cryptoObj = window[\"msCrypto\"] || window.crypto;\r\n if (!cryptoObj.getRandomValues) {\r\n throw BrowserAuthError.createCryptoNotAvailableError(\"getRandomValues does not exist.\");\r\n }\r\n cryptoObj.getRandomValues(dataBuffer);\r\n };\r\n /**\r\n * Generates a keypair based on current keygen algorithm config.\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.generateKeyPair = function (extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, (this.hasIECrypto() ?\r\n this.msCryptoGenerateKey(extractable, usages)\r\n : window.crypto.subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages))];\r\n });\r\n });\r\n };\r\n /**\r\n * Export key as Json Web Key (JWK)\r\n * @param key\r\n * @param format\r\n */\r\n BrowserCrypto.prototype.exportJwk = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.hasIECrypto() ? this.msCryptoExportJwk(key) : window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key)];\r\n });\r\n });\r\n };\r\n /**\r\n * Imports key as Json Web Key (JWK), can set extractable and usages.\r\n * @param key\r\n * @param format\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.importJwk = function (key, extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var keyString, keyBuffer;\r\n return __generator(this, function (_a) {\r\n keyString = BrowserCrypto.getJwkString(key);\r\n keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);\r\n return [2 /*return*/, this.hasIECrypto() ?\r\n this.msCryptoImportKey(keyBuffer, extractable, usages)\r\n : window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, this._keygenAlgorithmOptions, extractable, usages)];\r\n });\r\n });\r\n };\r\n /**\r\n * Signs given data with given key\r\n * @param key\r\n * @param data\r\n */\r\n BrowserCrypto.prototype.sign = function (key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.hasIECrypto() ?\r\n this.msCryptoSign(key, data)\r\n : window.crypto.subtle.sign(this._keygenAlgorithmOptions, key, data)];\r\n });\r\n });\r\n };\r\n /**\r\n * Check whether IE crypto or other browser cryptography is available.\r\n */\r\n BrowserCrypto.prototype.hasCryptoAPI = function () {\r\n return this.hasIECrypto() || this.hasBrowserCrypto();\r\n };\r\n /**\r\n * Checks whether IE crypto (AKA msCrypto) is available.\r\n */\r\n BrowserCrypto.prototype.hasIECrypto = function () {\r\n return \"msCrypto\" in window;\r\n };\r\n /**\r\n * Check whether browser crypto is available.\r\n */\r\n BrowserCrypto.prototype.hasBrowserCrypto = function () {\r\n return \"crypto\" in window;\r\n };\r\n /**\r\n * Helper function for SHA digest.\r\n * @param algorithm\r\n * @param data\r\n */\r\n BrowserCrypto.prototype.getSubtleCryptoDigest = function (algorithm, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.digest(algorithm, data)];\r\n });\r\n });\r\n };\r\n /**\r\n * IE Helper function for SHA digest.\r\n * @param algorithm\r\n * @param data\r\n */\r\n BrowserCrypto.prototype.getMSCryptoDigest = function (algorithm, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var digestOperation = window[\"msCrypto\"].subtle.digest(algorithm, data.buffer);\r\n digestOperation.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n digestOperation.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * IE Helper function for generating a keypair\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.msCryptoGenerateKey = function (extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msGenerateKey = window[\"msCrypto\"].subtle.generateKey(_this._keygenAlgorithmOptions, extractable, usages);\r\n msGenerateKey.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msGenerateKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * IE Helper function for exportKey\r\n * @param key\r\n * @param format\r\n */\r\n BrowserCrypto.prototype.msCryptoExportJwk = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msExportKey = window[\"msCrypto\"].subtle.exportKey(KEY_FORMAT_JWK, key);\r\n msExportKey.addEventListener(\"complete\", function (e) {\r\n var resultBuffer = e.target.result;\r\n var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))\r\n .replace(/\\r/g, \"\")\r\n .replace(/\\n/g, \"\")\r\n .replace(/\\t/g, \"\")\r\n .split(\" \").join(\"\")\r\n .replace(\"\\u0000\", \"\");\r\n try {\r\n resolve(JSON.parse(resultString));\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n msExportKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * IE Helper function for importKey\r\n * @param key\r\n * @param format\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.msCryptoImportKey = function (keyBuffer, extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msImportKey = window[\"msCrypto\"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, _this._keygenAlgorithmOptions, extractable, usages);\r\n msImportKey.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msImportKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * IE Helper function for sign JWT\r\n * @param key\r\n * @param data\r\n */\r\n BrowserCrypto.prototype.msCryptoSign = function (key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msSign = window[\"msCrypto\"].subtle.sign(_this._keygenAlgorithmOptions, key, data);\r\n msSign.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msSign.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Returns stringified jwk.\r\n * @param jwk\r\n */\r\n BrowserCrypto.getJwkString = function (jwk) {\r\n return JSON.stringify(jwk, Object.keys(jwk).sort());\r\n };\r\n return BrowserCrypto;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\r\n */\r\nvar DatabaseStorage = /** @class */ (function () {\r\n function DatabaseStorage(dbName, tableName, version) {\r\n this.dbName = dbName;\r\n this.tableName = tableName;\r\n this.version = version;\r\n this.dbOpen = false;\r\n }\r\n /**\r\n * Opens IndexedDB instance.\r\n */\r\n DatabaseStorage.prototype.open = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n // TODO: Add timeouts?\r\n var openDB = window.indexedDB.open(_this.dbName, _this.version);\r\n openDB.addEventListener(\"upgradeneeded\", function (e) {\r\n var event = e;\r\n event.target.result.createObjectStore(_this.tableName);\r\n });\r\n openDB.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n _this.db = event.target.result;\r\n _this.dbOpen = true;\r\n resolve();\r\n });\r\n openDB.addEventListener(\"error\", function (error) { return reject(error); });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Retrieves item from IndexedDB instance.\r\n * @param key\r\n */\r\n DatabaseStorage.prototype.get = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!!this.dbOpen) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.open()];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2: return [2 /*return*/, new Promise(function (resolve, reject) {\r\n // TODO: Add timeouts?\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readonly\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbGet = objectStore.get(key);\r\n dbGet.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n resolve(event.target.result);\r\n });\r\n dbGet.addEventListener(\"error\", function (e) { return reject(e); });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Adds item to IndexedDB under given key\r\n * @param key\r\n * @param payload\r\n */\r\n DatabaseStorage.prototype.put = function (key, payload) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!!this.dbOpen) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.open()];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2: return [2 /*return*/, new Promise(function (resolve, reject) {\r\n // TODO: Add timeouts?\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readwrite\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbPut = objectStore.put(payload, key);\r\n dbPut.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n resolve(event.target.result);\r\n });\r\n dbPut.addEventListener(\"error\", function (e) { return reject(e); });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n return DatabaseStorage;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and\r\n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\r\n */\r\nvar CryptoOps = /** @class */ (function () {\r\n function CryptoOps() {\r\n // Browser crypto needs to be validated first before any other classes can be set.\r\n this.browserCrypto = new BrowserCrypto();\r\n this.b64Encode = new Base64Encode();\r\n this.b64Decode = new Base64Decode();\r\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\r\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\r\n this.cache = new DatabaseStorage(CryptoOps.DB_NAME, CryptoOps.TABLE_NAME, CryptoOps.DB_VERSION);\r\n }\r\n /**\r\n * Creates a new random GUID - used to populate state and nonce.\r\n * @returns string (GUID)\r\n */\r\n CryptoOps.prototype.createNewGuid = function () {\r\n return this.guidGenerator.generateGuid();\r\n };\r\n /**\r\n * Encodes input string to base64.\r\n * @param input\r\n */\r\n CryptoOps.prototype.base64Encode = function (input) {\r\n return this.b64Encode.encode(input);\r\n };\r\n /**\r\n * Decodes input string from base64.\r\n * @param input\r\n */\r\n CryptoOps.prototype.base64Decode = function (input) {\r\n return this.b64Decode.decode(input);\r\n };\r\n /**\r\n * Generates PKCE codes used in Authorization Code Flow.\r\n */\r\n CryptoOps.prototype.generatePkceCodes = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.pkceGenerator.generateCodes()];\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a keypair, stores it and returns a thumbprint\r\n * @param resourceRequestMethod\r\n * @param resourceRequestUri\r\n */\r\n CryptoOps.prototype.getPublicKeyThumbprint = function (resourceRequestMethod, resourceRequestUri) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkBuffer, publicJwkHash, privateKeyJwk, unextractablePrivateKey;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];\r\n case 1:\r\n keyPair = _a.sent();\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.publicKey)];\r\n case 2:\r\n publicKeyJwk = _a.sent();\r\n pubKeyThumprintObj = {\r\n e: publicKeyJwk.e,\r\n kty: publicKeyJwk.kty,\r\n n: publicKeyJwk.n\r\n };\r\n publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);\r\n return [4 /*yield*/, this.browserCrypto.sha256Digest(publicJwkString)];\r\n case 3:\r\n publicJwkBuffer = _a.sent();\r\n publicJwkHash = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];\r\n case 4:\r\n privateKeyJwk = _a.sent();\r\n return [4 /*yield*/, this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"])];\r\n case 5:\r\n unextractablePrivateKey = _a.sent();\r\n // Store Keypair data in keystore\r\n this.cache.put(publicJwkHash, {\r\n privateKey: unextractablePrivateKey,\r\n publicKey: keyPair.publicKey,\r\n requestMethod: resourceRequestMethod,\r\n requestUri: resourceRequestUri\r\n });\r\n return [2 /*return*/, publicJwkHash];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Signs the given object as a jwt payload with private key retrieved by given kid.\r\n * @param payload\r\n * @param kid\r\n */\r\n CryptoOps.prototype.signJwt = function (payload, kid) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.cache.get(kid)];\r\n case 1:\r\n cachedKeyPair = _a.sent();\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];\r\n case 2:\r\n publicKeyJwk = _a.sent();\r\n publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);\r\n header = {\r\n alg: publicKeyJwk.alg,\r\n type: KEY_FORMAT_JWK\r\n };\r\n encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));\r\n // Generate payload\r\n payload.cnf = {\r\n jwk: JSON.parse(publicKeyJwkString)\r\n };\r\n encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\r\n tokenString = encodedHeader + \".\" + encodedPayload;\r\n tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\r\n return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];\r\n case 3:\r\n signatureBuffer = _a.sent();\r\n encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\r\n return [2 /*return*/, tokenString + \".\" + encodedSignature];\r\n }\r\n });\r\n });\r\n };\r\n CryptoOps.POP_KEY_USAGES = [\"sign\", \"verify\"];\r\n CryptoOps.EXTRACTABLE = true;\r\n CryptoOps.DB_VERSION = 1;\r\n CryptoOps.DB_NAME = \"msal.db\";\r\n CryptoOps.TABLE_NAME = CryptoOps.DB_NAME + \".keys\";\r\n return CryptoOps;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar BrowserConfigurationAuthErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n storageNotSupportedError: {\r\n code: \"storage_not_supported\",\r\n desc: \"Given storage configuration option was not supported.\"\r\n },\r\n noRedirectCallbacksSet: {\r\n code: \"no_redirect_callbacks\",\r\n desc: \"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n invalidCallbackObject: {\r\n code: \"invalid_callback_object\",\r\n desc: \"The object passed for the callback was invalid. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n stubPcaInstanceCalled: {\r\n code: \"stubbed_public_client_application_called\",\r\n desc: \"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider.\"\r\n },\r\n inMemRedirectUnavailable: {\r\n code: \"in_mem_redirect_unavailable\",\r\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.\"\r\n }\r\n};\r\n/**\r\n * Browser library error class thrown by the MSAL.js library for SPAs\r\n */\r\nvar BrowserConfigurationAuthError = /** @class */ (function (_super) {\r\n __extends(BrowserConfigurationAuthError, _super);\r\n function BrowserConfigurationAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"BrowserConfigurationAuthError\";\r\n Object.setPrototypeOf(_this, BrowserConfigurationAuthError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n BrowserConfigurationAuthError.createRedirectUriEmptyError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code, BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n BrowserConfigurationAuthError.createPostLogoutRedirectUriEmptyError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code, BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);\r\n };\r\n /**\r\n * Creates error thrown when given storage location is not supported.\r\n * @param givenStorageLocation\r\n */\r\n BrowserConfigurationAuthError.createStorageNotSupportedError = function (givenStorageLocation) {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc + \" Given Location: \" + givenStorageLocation);\r\n };\r\n /**\r\n * Creates error thrown when callback object is invalid.\r\n * @param callbackObject\r\n */\r\n BrowserConfigurationAuthError.createInvalidCallbackObjectError = function (callbackObject) {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.invalidCallbackObject.code, BrowserConfigurationAuthErrorMessage.invalidCallbackObject.desc + \" Given value for callback function: \" + callbackObject);\r\n };\r\n /**\r\n * Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().\r\n */\r\n BrowserConfigurationAuthError.createRedirectCallbacksNotSetError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);\r\n };\r\n /**\r\n * Creates error thrown when the stub instance of PublicClientApplication is called.\r\n */\r\n BrowserConfigurationAuthError.createStubPcaInstanceCalledError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code, BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);\r\n };\r\n /*\r\n * Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.\r\n */\r\n BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);\r\n };\r\n return BrowserConfigurationAuthError;\r\n}(AuthError));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserStorage = /** @class */ (function () {\r\n function BrowserStorage(cacheLocation) {\r\n this.validateWindowStorage(cacheLocation);\r\n this.windowStorage = window[cacheLocation];\r\n }\r\n BrowserStorage.prototype.validateWindowStorage = function (cacheLocation) {\r\n if (cacheLocation !== BrowserCacheLocation.LocalStorage && cacheLocation !== BrowserCacheLocation.SessionStorage) {\r\n throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);\r\n }\r\n var storageSupported = !!window[cacheLocation];\r\n if (!storageSupported) {\r\n throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);\r\n }\r\n };\r\n BrowserStorage.prototype.getItem = function (key) {\r\n return this.windowStorage.getItem(key);\r\n };\r\n BrowserStorage.prototype.setItem = function (key, value) {\r\n this.windowStorage.setItem(key, value);\r\n };\r\n BrowserStorage.prototype.removeItem = function (key) {\r\n this.windowStorage.removeItem(key);\r\n };\r\n BrowserStorage.prototype.getKeys = function () {\r\n return Object.keys(this.windowStorage);\r\n };\r\n BrowserStorage.prototype.containsKey = function (key) {\r\n return this.windowStorage.hasOwnProperty(key);\r\n };\r\n return BrowserStorage;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar MemoryStorage = /** @class */ (function () {\r\n function MemoryStorage() {\r\n this.cache = new Map();\r\n }\r\n MemoryStorage.prototype.getItem = function (key) {\r\n return this.cache.get(key) || null;\r\n };\r\n MemoryStorage.prototype.setItem = function (key, value) {\r\n this.cache.set(key, value);\r\n };\r\n MemoryStorage.prototype.removeItem = function (key) {\r\n this.cache.delete(key);\r\n };\r\n MemoryStorage.prototype.getKeys = function () {\r\n var cacheKeys = [];\r\n this.cache.forEach(function (value, key) {\r\n cacheKeys.push(key);\r\n });\r\n return cacheKeys;\r\n };\r\n MemoryStorage.prototype.containsKey = function (key) {\r\n return this.cache.has(key);\r\n };\r\n return MemoryStorage;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserProtocolUtils = /** @class */ (function () {\r\n function BrowserProtocolUtils() {\r\n }\r\n /**\r\n * Extracts the BrowserStateObject from the state string.\r\n * @param browserCrypto\r\n * @param state\r\n */\r\n BrowserProtocolUtils.extractBrowserRequestState = function (browserCrypto, state) {\r\n if (StringUtils.isEmpty(state)) {\r\n return null;\r\n }\r\n try {\r\n var requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);\r\n return requestStateObj.libraryState.meta;\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createInvalidStateError(state, e);\r\n }\r\n };\r\n /**\r\n * Parses properties of server response from url hash\r\n * @param locationHash Hash from url\r\n */\r\n BrowserProtocolUtils.parseServerResponseFromHash = function (locationHash) {\r\n if (!locationHash) {\r\n return {};\r\n }\r\n var hashUrlString = new UrlString(locationHash);\r\n return UrlString.getDeserializedHash(hashUrlString.getHash());\r\n };\r\n return BrowserProtocolUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements the cache storage interface for MSAL through browser local or session storage.\r\n * Cookies are only used if storeAuthStateInCookie is true, and are only used for\r\n * parameters such as state and nonce, generally.\r\n */\r\nvar BrowserCacheManager = /** @class */ (function (_super) {\r\n __extends(BrowserCacheManager, _super);\r\n function BrowserCacheManager(clientId, cacheConfig, cryptoImpl, logger) {\r\n var _this = _super.call(this, clientId, cryptoImpl) || this;\r\n // Cookie life calculation (hours * minutes * seconds * ms)\r\n _this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;\r\n _this.cacheConfig = cacheConfig;\r\n _this.logger = logger;\r\n _this.browserStorage = _this.setupBrowserStorage(cacheConfig.cacheLocation);\r\n _this.internalStorage = new MemoryStorage();\r\n // Migrate any cache entries from older versions of MSAL.\r\n _this.migrateCacheEntries();\r\n return _this;\r\n }\r\n /**\r\n * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.\r\n * @param cacheLocation\r\n */\r\n BrowserCacheManager.prototype.setupBrowserStorage = function (cacheLocation) {\r\n switch (cacheLocation) {\r\n case BrowserCacheLocation.LocalStorage:\r\n case BrowserCacheLocation.SessionStorage:\r\n try {\r\n return new BrowserStorage(cacheLocation);\r\n }\r\n catch (e) {\r\n this.logger.verbose(e);\r\n this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;\r\n return new MemoryStorage();\r\n }\r\n case BrowserCacheLocation.MemoryStorage:\r\n default:\r\n return new MemoryStorage();\r\n }\r\n };\r\n /**\r\n * Migrate all old cache entries to new schema. No rollback supported.\r\n * @param storeAuthStateInCookie\r\n */\r\n BrowserCacheManager.prototype.migrateCacheEntries = function () {\r\n var _this = this;\r\n var idTokenKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ID_TOKEN;\r\n var clientInfoKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.CLIENT_INFO;\r\n var errorKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ERROR;\r\n var errorDescKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ERROR_DESC;\r\n var idTokenValue = this.browserStorage.getItem(idTokenKey);\r\n var clientInfoValue = this.browserStorage.getItem(clientInfoKey);\r\n var errorValue = this.browserStorage.getItem(errorKey);\r\n var errorDescValue = this.browserStorage.getItem(errorDescKey);\r\n var values = [idTokenValue, clientInfoValue, errorValue, errorDescValue];\r\n var keysToMigrate = [PersistentCacheKeys.ID_TOKEN, PersistentCacheKeys.CLIENT_INFO, PersistentCacheKeys.ERROR, PersistentCacheKeys.ERROR_DESC];\r\n keysToMigrate.forEach(function (cacheKey, index) { return _this.migrateCacheEntry(cacheKey, values[index]); });\r\n };\r\n /**\r\n * Utility function to help with migration.\r\n * @param newKey\r\n * @param value\r\n * @param storeAuthStateInCookie\r\n */\r\n BrowserCacheManager.prototype.migrateCacheEntry = function (newKey, value) {\r\n if (value) {\r\n this.setTemporaryCache(newKey, value, true);\r\n }\r\n };\r\n /**\r\n * Parses passed value as JSON object, JSON.parse() will throw an error.\r\n * @param input\r\n */\r\n BrowserCacheManager.prototype.validateAndParseJson = function (jsonValue) {\r\n try {\r\n var parsedJson = JSON.parse(jsonValue);\r\n /**\r\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\r\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\r\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\r\n *\r\n */\r\n return (parsedJson && typeof parsedJson === \"object\") ? parsedJson : null;\r\n }\r\n catch (error) {\r\n return null;\r\n }\r\n };\r\n /**\r\n * fetches the entry from the browser storage based off the key\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getItem = function (key) {\r\n return this.browserStorage.getItem(key);\r\n };\r\n /**\r\n * sets the entry in the browser storage\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setItem = function (key, value) {\r\n this.browserStorage.setItem(key, value);\r\n };\r\n /**\r\n * fetch the account entity from the platform cache\r\n * @param accountKey\r\n */\r\n BrowserCacheManager.prototype.getAccount = function (accountKey) {\r\n var account = this.getItem(accountKey);\r\n if (!account) {\r\n return null;\r\n }\r\n var parsedAccount = this.validateAndParseJson(account);\r\n if (!parsedAccount) {\r\n return null;\r\n }\r\n var accountEntity = CacheManager.toObject(new AccountEntity(), parsedAccount);\r\n if (AccountEntity.isAccountEntity(accountEntity)) {\r\n return accountEntity;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set account entity in the platform cache\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setAccount = function (account) {\r\n var key = account.generateAccountKey();\r\n this.setItem(key, JSON.stringify(account));\r\n };\r\n /**\r\n * generates idToken entity from a string\r\n * @param idTokenKey\r\n */\r\n BrowserCacheManager.prototype.getIdTokenCredential = function (idTokenKey) {\r\n var value = this.getItem(idTokenKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedIdToken = this.validateAndParseJson(value);\r\n if (!parsedIdToken) {\r\n return null;\r\n }\r\n var idToken = CacheManager.toObject(new IdTokenEntity(), parsedIdToken);\r\n if (IdTokenEntity.isIdTokenEntity(idToken)) {\r\n return idToken;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set IdToken credential to the platform cache\r\n * @param idToken\r\n */\r\n BrowserCacheManager.prototype.setIdTokenCredential = function (idToken) {\r\n var idTokenKey = idToken.generateCredentialKey();\r\n this.setItem(idTokenKey, JSON.stringify(idToken));\r\n };\r\n /**\r\n * generates accessToken entity from a string\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getAccessTokenCredential = function (accessTokenKey) {\r\n var value = this.getItem(accessTokenKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedAccessToken = this.validateAndParseJson(value);\r\n if (!parsedAccessToken) {\r\n return null;\r\n }\r\n var accessToken = CacheManager.toObject(new AccessTokenEntity(), parsedAccessToken);\r\n if (AccessTokenEntity.isAccessTokenEntity(accessToken)) {\r\n return accessToken;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set accessToken credential to the platform cache\r\n * @param accessToken\r\n */\r\n BrowserCacheManager.prototype.setAccessTokenCredential = function (accessToken) {\r\n var accessTokenKey = accessToken.generateCredentialKey();\r\n this.setItem(accessTokenKey, JSON.stringify(accessToken));\r\n };\r\n /**\r\n * generates refreshToken entity from a string\r\n * @param refreshTokenKey\r\n */\r\n BrowserCacheManager.prototype.getRefreshTokenCredential = function (refreshTokenKey) {\r\n var value = this.getItem(refreshTokenKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedRefreshToken = this.validateAndParseJson(value);\r\n if (!parsedRefreshToken) {\r\n return null;\r\n }\r\n var refreshToken = CacheManager.toObject(new RefreshTokenEntity(), parsedRefreshToken);\r\n if (RefreshTokenEntity.isRefreshTokenEntity(refreshToken)) {\r\n return refreshToken;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set refreshToken credential to the platform cache\r\n * @param refreshToken\r\n */\r\n BrowserCacheManager.prototype.setRefreshTokenCredential = function (refreshToken) {\r\n var refreshTokenKey = refreshToken.generateCredentialKey();\r\n this.setItem(refreshTokenKey, JSON.stringify(refreshToken));\r\n };\r\n /**\r\n * fetch appMetadata entity from the platform cache\r\n * @param appMetadataKey\r\n */\r\n BrowserCacheManager.prototype.getAppMetadata = function (appMetadataKey) {\r\n var value = this.getItem(appMetadataKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedMetadata = this.validateAndParseJson(value);\r\n if (!parsedMetadata) {\r\n return null;\r\n }\r\n var appMetadata = CacheManager.toObject(new AppMetadataEntity(), parsedMetadata);\r\n if (AppMetadataEntity.isAppMetadataEntity(appMetadataKey, appMetadata)) {\r\n return appMetadata;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set appMetadata entity to the platform cache\r\n * @param appMetadata\r\n */\r\n BrowserCacheManager.prototype.setAppMetadata = function (appMetadata) {\r\n var appMetadataKey = appMetadata.generateAppMetadataKey();\r\n this.setItem(appMetadataKey, JSON.stringify(appMetadata));\r\n };\r\n /**\r\n * fetch server telemetry entity from the platform cache\r\n * @param serverTelemetryKey\r\n */\r\n BrowserCacheManager.prototype.getServerTelemetry = function (serverTelemetryKey) {\r\n var value = this.getItem(serverTelemetryKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedMetadata = this.validateAndParseJson(value);\r\n if (!parsedMetadata) {\r\n return null;\r\n }\r\n var serverTelemetryEntity = CacheManager.toObject(new ServerTelemetryEntity(), parsedMetadata);\r\n if (ServerTelemetryEntity.isServerTelemetryEntity(serverTelemetryKey, serverTelemetryEntity)) {\r\n return serverTelemetryEntity;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set server telemetry entity to the platform cache\r\n * @param serverTelemetryKey\r\n * @param serverTelemetry\r\n */\r\n BrowserCacheManager.prototype.setServerTelemetry = function (serverTelemetryKey, serverTelemetry) {\r\n this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));\r\n };\r\n /**\r\n * fetch throttling entity from the platform cache\r\n * @param throttlingCacheKey\r\n */\r\n BrowserCacheManager.prototype.getThrottlingCache = function (throttlingCacheKey) {\r\n var value = this.getItem(throttlingCacheKey);\r\n if (!value) {\r\n return null;\r\n }\r\n var parsedThrottlingCache = this.validateAndParseJson(value);\r\n if (!parsedThrottlingCache) {\r\n return null;\r\n }\r\n var throttlingCache = CacheManager.toObject(new ThrottlingEntity(), parsedThrottlingCache);\r\n if (ThrottlingEntity.isThrottlingEntity(throttlingCacheKey, throttlingCache)) {\r\n return throttlingCache;\r\n }\r\n return null;\r\n };\r\n /**\r\n * set throttling entity to the platform cache\r\n * @param throttlingCacheKey\r\n * @param throttlingCache\r\n */\r\n BrowserCacheManager.prototype.setThrottlingCache = function (throttlingCacheKey, throttlingCache) {\r\n this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));\r\n };\r\n /**\r\n * Gets cache item with given key.\r\n * Will retrieve frm cookies if storeAuthStateInCookie is set to true.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getTemporaryCache = function (cacheKey, generateKey) {\r\n var key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n var itemCookie = this.getItemCookie(key);\r\n if (itemCookie) {\r\n return itemCookie;\r\n }\r\n }\r\n var value = this.getItem(key);\r\n if (!value) {\r\n return null;\r\n }\r\n return value;\r\n };\r\n /**\r\n * Sets the cache item with the key and value given.\r\n * Stores in cookie if storeAuthStateInCookie is set to true.\r\n * This can cause cookie overflow if used incorrectly.\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setTemporaryCache = function (cacheKey, value, generateKey) {\r\n var key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;\r\n this.setItem(key, value);\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n this.setItemCookie(key, value);\r\n }\r\n };\r\n /**\r\n * Removes the cache item with the given key.\r\n * Will also clear the cookie item if storeAuthStateInCookie is set to true.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeItem = function (key) {\r\n this.browserStorage.removeItem(key);\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n this.clearItemCookie(key);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Checks whether key is in cache.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.containsKey = function (key) {\r\n return this.browserStorage.containsKey(key);\r\n };\r\n /**\r\n * Gets all keys in window.\r\n */\r\n BrowserCacheManager.prototype.getKeys = function () {\r\n return this.browserStorage.getKeys();\r\n };\r\n /**\r\n * Clears all cache entries created by MSAL (except tokens).\r\n */\r\n BrowserCacheManager.prototype.clear = function () {\r\n var _this = this;\r\n this.removeAllAccounts();\r\n this.removeAppMetadata();\r\n this.browserStorage.getKeys().forEach(function (cacheKey) {\r\n // Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js\r\n if (_this.browserStorage.containsKey(cacheKey) && ((cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1) || (cacheKey.indexOf(_this.clientId) !== -1))) {\r\n _this.removeItem(cacheKey);\r\n }\r\n });\r\n };\r\n /**\r\n * Add value to cookies\r\n * @param cookieName\r\n * @param cookieValue\r\n * @param expires\r\n */\r\n BrowserCacheManager.prototype.setItemCookie = function (cookieName, cookieValue, expires) {\r\n var cookieStr = encodeURIComponent(cookieName) + \"=\" + encodeURIComponent(cookieValue) + \";path=/;\";\r\n if (expires) {\r\n var expireTime = this.getCookieExpirationTime(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n document.cookie = cookieStr;\r\n };\r\n /**\r\n * Get one item by key from cookies\r\n * @param cookieName\r\n */\r\n BrowserCacheManager.prototype.getItemCookie = function (cookieName) {\r\n var name = encodeURIComponent(cookieName) + \"=\";\r\n var cookieList = document.cookie.split(\";\");\r\n for (var i = 0; i < cookieList.length; i++) {\r\n var cookie = cookieList[i];\r\n while (cookie.charAt(0) === \" \") {\r\n cookie = cookie.substring(1);\r\n }\r\n if (cookie.indexOf(name) === 0) {\r\n return decodeURIComponent(cookie.substring(name.length, cookie.length));\r\n }\r\n }\r\n return \"\";\r\n };\r\n /**\r\n * Clear an item in the cookies by key\r\n * @param cookieName\r\n */\r\n BrowserCacheManager.prototype.clearItemCookie = function (cookieName) {\r\n this.setItemCookie(cookieName, \"\", -1);\r\n };\r\n /**\r\n * Get cookie expiration time\r\n * @param cookieLifeDays\r\n */\r\n BrowserCacheManager.prototype.getCookieExpirationTime = function (cookieLifeDays) {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);\r\n return expr.toUTCString();\r\n };\r\n /**\r\n * Gets the cache object referenced by the browser\r\n */\r\n BrowserCacheManager.prototype.getCache = function () {\r\n return this.browserStorage;\r\n };\r\n /**\r\n * interface compat, we cannot overwrite browser cache; Functionality is supported by individual entities in browser\r\n */\r\n BrowserCacheManager.prototype.setCache = function () {\r\n // sets nothing\r\n };\r\n /**\r\n * Prepend msal. to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)\r\n * @param key\r\n * @param addInstanceId\r\n */\r\n BrowserCacheManager.prototype.generateCacheKey = function (key) {\r\n var generatedKey = this.validateAndParseJson(key);\r\n if (!generatedKey) {\r\n if (StringUtils.startsWith(key, Constants.CACHE_PREFIX) || StringUtils.startsWith(key, PersistentCacheKeys.ADAL_ID_TOKEN)) {\r\n return key;\r\n }\r\n return Constants.CACHE_PREFIX + \".\" + this.clientId + \".\" + key;\r\n }\r\n return JSON.stringify(key);\r\n };\r\n /**\r\n * Create authorityKey to cache authority\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + \".\" + stateId);\r\n };\r\n /**\r\n * Create Nonce key to cache nonce\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.generateNonceKey = function (stateString) {\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + \".\" + stateId);\r\n };\r\n /**\r\n * Creates full cache key for the request state\r\n * @param stateString State string for the request\r\n */\r\n BrowserCacheManager.prototype.generateStateKey = function (stateString) {\r\n // Use the library state id to key temp storage for uniqueness for multiple concurrent requests\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + \".\" + stateId);\r\n };\r\n /**\r\n * Gets the cached authority based on the cached state. Returns empty if no cached state found.\r\n */\r\n BrowserCacheManager.prototype.getCachedAuthority = function (cachedState) {\r\n var stateCacheKey = this.generateStateKey(cachedState);\r\n var state = this.getTemporaryCache(stateCacheKey);\r\n if (!state) {\r\n return null;\r\n }\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n return this.getTemporaryCache(authorityCacheKey);\r\n };\r\n /**\r\n * Updates account, authority, and state in cache\r\n * @param serverAuthenticationRequest\r\n * @param account\r\n */\r\n BrowserCacheManager.prototype.updateCacheEntries = function (state, nonce, authorityInstance) {\r\n // Cache the request state\r\n var stateCacheKey = this.generateStateKey(state);\r\n this.setTemporaryCache(stateCacheKey, state, false);\r\n // Cache the nonce\r\n var nonceCacheKey = this.generateNonceKey(state);\r\n this.setTemporaryCache(nonceCacheKey, nonce, false);\r\n // Cache authorityKey\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n this.setTemporaryCache(authorityCacheKey, authorityInstance, false);\r\n };\r\n /**\r\n * Reset all temporary cache items\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.resetRequestCache = function (state) {\r\n var _this = this;\r\n // check state and remove associated cache items\r\n this.getKeys().forEach(function (key) {\r\n if (!StringUtils.isEmpty(state) && key.indexOf(state) !== -1) {\r\n _this.removeItem(key);\r\n }\r\n });\r\n // delete generic interactive request parameters\r\n if (state) {\r\n this.removeItem(this.generateStateKey(state));\r\n this.removeItem(this.generateNonceKey(state));\r\n this.removeItem(this.generateAuthorityKey(state));\r\n }\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY));\r\n };\r\n BrowserCacheManager.prototype.cleanRequestByState = function (stateString) {\r\n // Interaction is completed - remove interaction status.\r\n if (stateString) {\r\n var stateKey = this.generateStateKey(stateString);\r\n var cachedState = this.getItem(stateKey);\r\n this.resetRequestCache(cachedState || \"\");\r\n }\r\n };\r\n BrowserCacheManager.prototype.cleanRequestByInteractionType = function (interactionType) {\r\n var _this = this;\r\n this.getKeys().forEach(function (key) {\r\n if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {\r\n return;\r\n }\r\n var value = _this.browserStorage.getItem(key);\r\n if (!value) {\r\n return;\r\n }\r\n var parsedState = BrowserProtocolUtils.extractBrowserRequestState(_this.cryptoImpl, value);\r\n if (parsedState && parsedState.interactionType === interactionType) {\r\n _this.resetRequestCache(value);\r\n }\r\n });\r\n };\r\n BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {\r\n var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));\r\n this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);\r\n };\r\n /**\r\n * Gets the token exchange parameters from the cache. Throws an error if nothing is found.\r\n */\r\n BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {\r\n // Get token request from cache and parse as TokenExchangeParameters.\r\n var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);\r\n if (!encodedTokenRequest) {\r\n throw BrowserAuthError.createNoTokenRequestCacheError();\r\n }\r\n var parsedRequest = this.validateAndParseJson(browserCrypto.base64Decode(encodedTokenRequest));\r\n if (!parsedRequest) {\r\n throw BrowserAuthError.createUnableToParseTokenRequestCacheError();\r\n }\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));\r\n // Get cached authority and use if no authority is cached with request.\r\n if (StringUtils.isEmpty(parsedRequest.authority)) {\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n var cachedAuthority = this.getTemporaryCache(authorityCacheKey);\r\n if (!cachedAuthority) {\r\n throw BrowserAuthError.createNoCachedAuthorityError();\r\n }\r\n parsedRequest.authority = cachedAuthority;\r\n }\r\n return parsedRequest;\r\n };\r\n return BrowserCacheManager;\r\n}(CacheManager));\r\nvar DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {\r\n var cacheOptions = {\r\n cacheLocation: BrowserCacheLocation.MemoryStorage,\r\n storeAuthStateInCookie: false\r\n };\r\n return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);\r\n};\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements the Fetch API for GET and POST requests. See more here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\r\n */\r\nvar FetchClient = /** @class */ (function () {\r\n function FetchClient() {\r\n }\r\n /**\r\n * Fetch Client for REST endpoints - Get request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n FetchClient.prototype.sendGetRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var response, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0: return [4 /*yield*/, fetch(url, {\r\n method: HTTP_REQUEST_TYPE.GET,\r\n headers: this.getFetchHeaders(options)\r\n })];\r\n case 1:\r\n response = _b.sent();\r\n _a = {\r\n headers: this.getHeaderDict(response.headers)\r\n };\r\n return [4 /*yield*/, response.json()];\r\n case 2: return [2 /*return*/, (_a.body = (_b.sent()),\r\n _a.status = response.status,\r\n _a)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Fetch Client for REST endpoints - Post request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n FetchClient.prototype.sendPostRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var reqBody, response, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n reqBody = (options && options.body) || \"\";\r\n return [4 /*yield*/, fetch(url, {\r\n method: HTTP_REQUEST_TYPE.POST,\r\n headers: this.getFetchHeaders(options),\r\n body: reqBody\r\n })];\r\n case 1:\r\n response = _b.sent();\r\n _a = {\r\n headers: this.getHeaderDict(response.headers)\r\n };\r\n return [4 /*yield*/, response.json()];\r\n case 2: return [2 /*return*/, (_a.body = (_b.sent()),\r\n _a.status = response.status,\r\n _a)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get Fetch API Headers object from string map\r\n * @param inputHeaders\r\n */\r\n FetchClient.prototype.getFetchHeaders = function (options) {\r\n var headers = new Headers();\r\n if (!(options && options.headers)) {\r\n return headers;\r\n }\r\n var optionsHeaders = options.headers;\r\n Object.keys(optionsHeaders).forEach(function (key) {\r\n headers.append(key, optionsHeaders[key]);\r\n });\r\n return headers;\r\n };\r\n FetchClient.prototype.getHeaderDict = function (headers) {\r\n var headerDict = {};\r\n headers.forEach(function (value, key) {\r\n headerDict[key] = value;\r\n });\r\n return headerDict;\r\n };\r\n return FetchClient;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This client implements the XMLHttpRequest class to send GET and POST requests.\r\n */\r\nvar XhrClient = /** @class */ (function () {\r\n function XhrClient() {\r\n }\r\n /**\r\n * XhrClient for REST endpoints - Get request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n XhrClient.prototype.sendGetRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.sendRequestAsync(url, HTTP_REQUEST_TYPE.GET, options)];\r\n });\r\n });\r\n };\r\n /**\r\n * XhrClient for REST endpoints - Post request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n XhrClient.prototype.sendPostRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.sendRequestAsync(url, HTTP_REQUEST_TYPE.POST, options)];\r\n });\r\n });\r\n };\r\n /**\r\n * Helper for XhrClient requests.\r\n * @param url\r\n * @param method\r\n * @param options\r\n */\r\n XhrClient.prototype.sendRequestAsync = function (url, method, options) {\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 _this.setXhrHeaders(xhr, options);\r\n xhr.onload = function () {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n reject(xhr.responseText);\r\n }\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n var networkResponse = {\r\n headers: _this.getHeaderDict(xhr),\r\n body: jsonResponse,\r\n status: xhr.status\r\n };\r\n resolve(networkResponse);\r\n }\r\n catch (e) {\r\n reject(xhr.responseText);\r\n }\r\n };\r\n xhr.onerror = function () {\r\n reject(xhr.status);\r\n };\r\n if (method === \"POST\" && options && options.body) {\r\n xhr.send(options.body);\r\n }\r\n else if (method === \"GET\") {\r\n xhr.send();\r\n }\r\n else {\r\n throw BrowserAuthError.createHttpMethodNotImplementedError(method);\r\n }\r\n });\r\n };\r\n /**\r\n * Helper to set XHR headers for request.\r\n * @param xhr\r\n * @param options\r\n */\r\n XhrClient.prototype.setXhrHeaders = function (xhr, options) {\r\n if (options && options.headers) {\r\n var headers_1 = options.headers;\r\n Object.keys(headers_1).forEach(function (key) {\r\n xhr.setRequestHeader(key, headers_1[key]);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets a string map of the headers received in the response.\r\n *\r\n * Algorithm comes from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders\r\n * @param xhr\r\n */\r\n XhrClient.prototype.getHeaderDict = function (xhr) {\r\n var headerString = xhr.getAllResponseHeaders();\r\n var headerArr = headerString.trim().split(/[\\r\\n]+/);\r\n var headerDict = {};\r\n headerArr.forEach(function (value) {\r\n var parts = value.split(\": \");\r\n var headerName = parts.shift();\r\n var headerVal = parts.join(\": \");\r\n if (headerName && headerVal) {\r\n headerDict[headerName] = headerVal;\r\n }\r\n });\r\n return headerDict;\r\n };\r\n return XhrClient;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class for browser specific functions\r\n */\r\nvar BrowserUtils = /** @class */ (function () {\r\n function BrowserUtils() {\r\n }\r\n // #region Window Navigation and URL management\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 * @param {boolean} noHistory - boolean flag, uses .replace() instead of .assign() if true\r\n */\r\n BrowserUtils.navigateWindow = function (urlNavigate, navigationTimeout, logger, noHistory) {\r\n if (noHistory) {\r\n window.location.replace(urlNavigate);\r\n }\r\n else {\r\n window.location.assign(urlNavigate);\r\n }\r\n // To block code from running after navigation, this should not throw if navigation succeeds\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n logger.warning(\"Expected to navigate away from the current page but timeout occurred.\");\r\n resolve();\r\n }, navigationTimeout);\r\n });\r\n };\r\n /**\r\n * Clears hash from window url.\r\n */\r\n BrowserUtils.clearHash = function () {\r\n // Office.js sets history.replaceState to null\r\n if (typeof history.replaceState === \"function\") {\r\n // Full removes \"#\" from url\r\n history.replaceState(null, Constants.EMPTY_STRING, \"\" + window.location.pathname + window.location.search);\r\n }\r\n else {\r\n window.location.hash = \"\";\r\n }\r\n };\r\n /**\r\n * Replaces current hash with hash from provided url\r\n */\r\n BrowserUtils.replaceHash = function (url) {\r\n var urlParts = url.split(\"#\");\r\n urlParts.shift(); // Remove part before the hash\r\n window.location.hash = urlParts.length > 0 ? urlParts.join(\"#\") : \"\";\r\n };\r\n /**\r\n * Returns boolean of whether the current window is in an iframe or not.\r\n */\r\n BrowserUtils.isInIframe = function () {\r\n return window.parent !== window;\r\n };\r\n // #endregion\r\n /**\r\n * Returns current window URL as redirect uri\r\n */\r\n BrowserUtils.getCurrentUri = function () {\r\n return window.location.href.split(\"?\")[0].split(\"#\")[0];\r\n };\r\n /**\r\n * Gets the homepage url for the current window location.\r\n */\r\n BrowserUtils.getHomepage = function () {\r\n var currentUrl = new UrlString(window.location.href);\r\n var urlComponents = currentUrl.getUrlComponents();\r\n return urlComponents.Protocol + \"//\" + urlComponents.HostNameAndPort + \"/\";\r\n };\r\n /**\r\n * Returns best compatible network client object.\r\n */\r\n BrowserUtils.getBrowserNetworkClient = function () {\r\n if (window.fetch && window.Headers) {\r\n return new FetchClient();\r\n }\r\n else {\r\n return new XhrClient();\r\n }\r\n };\r\n /**\r\n * Throws error if we have completed an auth and are\r\n * attempting another auth request inside an iframe.\r\n */\r\n BrowserUtils.blockReloadInHiddenIframes = function () {\r\n var isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);\r\n // return an error if called from the hidden iframe created by the msal js silent calls\r\n if (isResponseHash && BrowserUtils.isInIframe()) {\r\n throw BrowserAuthError.createBlockReloadInHiddenIframeError();\r\n }\r\n };\r\n /**\r\n * Block redirect operations in iframes unless explicitly allowed\r\n * @param interactionType Interaction type for the request\r\n * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe\r\n */\r\n BrowserUtils.blockRedirectInIframe = function (interactionType, allowRedirectInIframe) {\r\n var isIframedApp = BrowserUtils.isInIframe();\r\n if (interactionType === InteractionType.Redirect && isIframedApp && !allowRedirectInIframe) {\r\n // If we are not in top frame, we shouldn't redirect. This is also handled by the service.\r\n throw BrowserAuthError.createRedirectInIframeError(isIframedApp);\r\n }\r\n };\r\n /**\r\n * Throws error if token requests are made in non-browser environment\r\n * @param isBrowserEnvironment Flag indicating if environment is a browser.\r\n */\r\n BrowserUtils.blockNonBrowserEnvironment = function (isBrowserEnvironment) {\r\n if (!isBrowserEnvironment) {\r\n throw BrowserAuthError.createNonBrowserEnvironmentError();\r\n }\r\n };\r\n /**\r\n * Returns boolean of whether current browser is an Internet Explorer or Edge browser.\r\n */\r\n BrowserUtils.detectIEOrEdge = function () {\r\n var ua = window.navigator.userAgent;\r\n var msie = ua.indexOf(\"MSIE \");\r\n var msie11 = ua.indexOf(\"Trident/\");\r\n var msedge = ua.indexOf(\"Edge/\");\r\n var isIE = msie > 0 || msie11 > 0;\r\n var isEdge = msedge > 0;\r\n return isIE || isEdge;\r\n };\r\n return BrowserUtils;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Default timeout for popup windows and iframes in milliseconds\r\nvar DEFAULT_POPUP_TIMEOUT_MS = 60000;\r\nvar DEFAULT_IFRAME_TIMEOUT_MS = 6000;\r\nvar DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\r\n/**\r\n * MSAL function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param auth\r\n * @param cache\r\n * @param system\r\n *\r\n * @returns Configuration object\r\n */\r\nfunction buildConfiguration(_a, isBrowserEnvironment) {\r\n var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system;\r\n // Default auth options for browser\r\n var DEFAULT_AUTH_OPTIONS = {\r\n clientId: \"\",\r\n authority: \"\" + Constants.DEFAULT_AUTHORITY,\r\n knownAuthorities: [],\r\n cloudDiscoveryMetadata: \"\",\r\n redirectUri: \"\",\r\n postLogoutRedirectUri: \"\",\r\n navigateToLoginRequestUrl: true,\r\n clientCapabilities: [],\r\n protocolMode: ProtocolMode.AAD\r\n };\r\n // Default cache options for browser\r\n var DEFAULT_CACHE_OPTIONS = {\r\n cacheLocation: BrowserCacheLocation.SessionStorage,\r\n storeAuthStateInCookie: false\r\n };\r\n // Default logger options for browser\r\n var DEFAULT_LOGGER_OPTIONS = {\r\n loggerCallback: function () { },\r\n logLevel: LogLevel.Info,\r\n piiLoggingEnabled: false\r\n };\r\n // Default system options for browser\r\n var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, loadFrameTimeout: 0, \r\n // If loadFrameTimeout is provided, use that as default.\r\n windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false });\r\n var overlayedConfig = {\r\n auth: __assign(__assign({}, DEFAULT_AUTH_OPTIONS), userInputAuth),\r\n cache: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), userInputCache),\r\n system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem)\r\n };\r\n return overlayedConfig;\r\n}\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Abstract class which defines operations for a browser interaction handling class.\r\n */\r\nvar InteractionHandler = /** @class */ (function () {\r\n function InteractionHandler(authCodeModule, storageImpl, authCodeRequest) {\r\n this.authModule = authCodeModule;\r\n this.browserStorage = storageImpl;\r\n this.authCodeRequest = authCodeRequest;\r\n }\r\n /**\r\n * Function to handle response parameters from hash.\r\n * @param locationHash\r\n */\r\n InteractionHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, tokenResponse;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Check that location hash isn't empty.\r\n if (StringUtils.isEmpty(locationHash)) {\r\n throw BrowserAuthError.createEmptyHashError(locationHash);\r\n }\r\n stateKey = this.browserStorage.generateStateKey(state);\r\n requestState = this.browserStorage.getTemporaryCache(stateKey);\r\n if (!requestState) {\r\n throw ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);\r\n nonceKey = this.browserStorage.generateNonceKey(requestState);\r\n cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);\r\n // Assign code to request\r\n this.authCodeRequest.code = authCodeResponse.code;\r\n if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n authCodeResponse.nonce = cachedNonce || undefined;\r\n authCodeResponse.state = requestState;\r\n return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];\r\n case 3:\r\n tokenResponse = _a.sent();\r\n this.browserStorage.cleanRequestByState(state);\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n InteractionHandler.prototype.updateTokenEndpointAuthority = function (cloudInstanceHostname, authority, networkModule) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cloudInstanceAuthorityUri, cloudInstanceAuthority;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!!authority.isAuthorityAlias(cloudInstanceHostname)) return [3 /*break*/, 2];\r\n cloudInstanceAuthorityUri = \"https://\" + cloudInstanceHostname + \"/\" + authority.tenant + \"/\";\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, authority.protocolMode)];\r\n case 1:\r\n cloudInstanceAuthority = _a.sent();\r\n this.authModule.updateAuthority(cloudInstanceAuthority);\r\n _a.label = 2;\r\n case 2: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return InteractionHandler;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RedirectHandler = /** @class */ (function (_super) {\r\n __extends(RedirectHandler, _super);\r\n function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, browserCrypto) {\r\n var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest) || this;\r\n _this.browserCrypto = browserCrypto;\r\n return _this;\r\n }\r\n /**\r\n * Redirects window to given URL.\r\n * @param urlNavigate\r\n */\r\n RedirectHandler.prototype.initiateAuthRequest = function (requestUrl, params) {\r\n // Navigate if valid URL\r\n if (!StringUtils.isEmpty(requestUrl)) {\r\n // Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true\r\n if (params.redirectStartPage) {\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);\r\n }\r\n // Set interaction status in the library.\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.INTERACTION_STATUS_KEY, BrowserConstants.INTERACTION_IN_PROGRESS_VALUE, true);\r\n this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);\r\n this.authModule.logger.infoPii(\"Navigate to:\" + requestUrl);\r\n // If onRedirectNavigate is implemented, invoke it and provide requestUrl\r\n if (typeof params.onRedirectNavigate === \"function\") {\r\n this.authModule.logger.verbose(\"Invoking onRedirectNavigate callback\");\r\n var navigate = params.onRedirectNavigate(requestUrl);\r\n // Returning false from onRedirectNavigate will stop navigation\r\n if (navigate !== false) {\r\n this.authModule.logger.verbose(\"onRedirectNavigate did not return false, navigating\");\r\n return BrowserUtils.navigateWindow(requestUrl, params.redirectTimeout, this.authModule.logger);\r\n }\r\n else {\r\n this.authModule.logger.verbose(\"onRedirectNavigate returned false, stopping navigation\");\r\n return Promise.resolve();\r\n }\r\n }\r\n else {\r\n // Navigate window to request URL\r\n this.authModule.logger.verbose(\"Navigating window to navigate url\");\r\n return BrowserUtils.navigateWindow(requestUrl, params.redirectTimeout, this.authModule.logger);\r\n }\r\n }\r\n else {\r\n // Throw error if request URL is empty.\r\n this.authModule.logger.info(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n };\r\n /**\r\n * Handle authorization code response in the window.\r\n * @param hash\r\n */\r\n RedirectHandler.prototype.handleCodeResponse = function (locationHash, state, authority, networkModule, clientId) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, tokenResponse;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Check that location hash isn't empty.\r\n if (StringUtils.isEmpty(locationHash)) {\r\n throw BrowserAuthError.createEmptyHashError(locationHash);\r\n }\r\n // Interaction is completed - remove interaction status.\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY));\r\n stateKey = this.browserStorage.generateStateKey(state);\r\n requestState = this.browserStorage.getTemporaryCache(stateKey);\r\n if (!requestState) {\r\n throw ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);\r\n nonceKey = this.browserStorage.generateNonceKey(requestState);\r\n cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);\r\n // Assign code to request\r\n this.authCodeRequest.code = authCodeResponse.code;\r\n if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n authCodeResponse.nonce = cachedNonce || undefined;\r\n authCodeResponse.state = requestState;\r\n // Remove throttle if it exists\r\n if (clientId) {\r\n ThrottlingUtils.removeThrottle(this.browserStorage, clientId, this.authCodeRequest.authority, this.authCodeRequest.scopes);\r\n }\r\n return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];\r\n case 3:\r\n tokenResponse = _a.sent();\r\n this.browserStorage.cleanRequestByState(state);\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n return RedirectHandler;\r\n}(InteractionHandler));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements the interaction handler base class for browsers. It is written specifically for handling\r\n * popup window scenarios. It includes functions for monitoring the popup window for a hash.\r\n */\r\nvar PopupHandler = /** @class */ (function (_super) {\r\n __extends(PopupHandler, _super);\r\n function PopupHandler(authCodeModule, storageImpl, authCodeRequest) {\r\n var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest) || this;\r\n // Properly sets this reference for the unload event.\r\n _this.unloadWindow = _this.unloadWindow.bind(_this);\r\n return _this;\r\n }\r\n /**\r\n * Opens a popup window with given request Url.\r\n * @param requestUrl\r\n */\r\n PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {\r\n // Check that request url is not empty.\r\n if (!StringUtils.isEmpty(requestUrl)) {\r\n // Set interaction status in the library.\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.INTERACTION_STATUS_KEY, BrowserConstants.INTERACTION_IN_PROGRESS_VALUE, true);\r\n this.authModule.logger.infoPii(\"Navigate to:\" + requestUrl);\r\n // Open the popup window to requestUrl.\r\n return this.openPopup(requestUrl, params.popup);\r\n }\r\n else {\r\n // Throw error if request URL is empty.\r\n this.authModule.logger.error(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n };\r\n /**\r\n * Monitors a window until it loads a url with a known hash, or hits a specified timeout.\r\n * @param popupWindow - window that is being monitored\r\n * @param timeout - milliseconds until timeout\r\n * @param urlNavigate - url that was navigated to\r\n */\r\n PopupHandler.prototype.monitorPopupForHash = function (popupWindow, timeout) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (timeout < DEFAULT_POPUP_TIMEOUT_MS) {\r\n _this.authModule.logger.warning(\"system.loadFrameTimeout or system.windowHashTimeout set to lower (\" + timeout + \"ms) than the default (\" + DEFAULT_POPUP_TIMEOUT_MS + \"ms). This may result in timeouts.\");\r\n }\r\n var maxTicks = timeout / BrowserConstants.POLL_INTERVAL_MS;\r\n var ticks = 0;\r\n var intervalId = setInterval(function () {\r\n if (popupWindow.closed) {\r\n // Window is closed\r\n _this.cleanPopup();\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createUserCancelledError());\r\n return;\r\n }\r\n var href = Constants.EMPTY_STRING;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = popupWindow.location.href;\r\n }\r\n catch (e) { }\r\n // Don't process blank pages or cross domain\r\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\r\n return;\r\n }\r\n // Only run clock when we are on same domain\r\n ticks++;\r\n var contentHash = popupWindow.location.hash;\r\n if (UrlString.hashContainsKnownProperties(contentHash)) {\r\n // Success case\r\n _this.cleanPopup(popupWindow);\r\n clearInterval(intervalId);\r\n resolve(contentHash);\r\n return;\r\n }\r\n else if (ticks > maxTicks) {\r\n // Timeout error\r\n _this.cleanPopup(popupWindow);\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createMonitorPopupTimeoutError());\r\n return;\r\n }\r\n }, BrowserConstants.POLL_INTERVAL_MS);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n *\r\n * Configures popup window for login.\r\n *\r\n * @param urlNavigate\r\n * @param title\r\n * @param popUpWidth\r\n * @param popUpHeight\r\n * @ignore\r\n * @hidden\r\n */\r\n PopupHandler.prototype.openPopup = function (urlNavigate, popup) {\r\n try {\r\n var popupWindow = void 0;\r\n // Popup window passed in, setting url to navigate to\r\n if (popup) {\r\n popupWindow = popup;\r\n popupWindow.location.assign(urlNavigate);\r\n }\r\n else if (typeof popup === \"undefined\") {\r\n // Popup will be undefined if it was not passed in\r\n popupWindow = PopupHandler.openSizedPopup(urlNavigate);\r\n }\r\n // Popup will be null if popups are blocked\r\n if (!popupWindow) {\r\n throw BrowserAuthError.createEmptyWindowCreatedError();\r\n }\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n this.currentWindow = popupWindow;\r\n window.addEventListener(\"beforeunload\", this.unloadWindow);\r\n return popupWindow;\r\n }\r\n catch (e) {\r\n this.authModule.logger.error(\"error opening popup \" + e.message);\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY));\r\n throw BrowserAuthError.createPopupWindowError(e.toString());\r\n }\r\n };\r\n PopupHandler.openSizedPopup = function (urlNavigate) {\r\n if (urlNavigate === void 0) { urlNavigate = \"about:blank\"; }\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 = Math.max(0, ((width / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);\r\n var top = Math.max(0, ((height / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);\r\n return window.open(urlNavigate, Constants.LIBRARY_NAME, \"width=\" + BrowserConstants.POPUP_WIDTH + \", height=\" + BrowserConstants.POPUP_HEIGHT + \", top=\" + top + \", left=\" + left);\r\n };\r\n /**\r\n * Event callback to unload main window.\r\n */\r\n PopupHandler.prototype.unloadWindow = function (e) {\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);\r\n if (this.currentWindow) {\r\n this.currentWindow.close();\r\n }\r\n // Guarantees browser unload will happen, so no other errors will be thrown.\r\n e.preventDefault();\r\n };\r\n /**\r\n * Closes popup, removes any state vars created during popup calls.\r\n * @param popupWindow\r\n */\r\n PopupHandler.prototype.cleanPopup = function (popupWindow) {\r\n if (popupWindow) {\r\n // Close window.\r\n popupWindow.close();\r\n }\r\n // Remove window unload function\r\n window.removeEventListener(\"beforeunload\", this.unloadWindow);\r\n // Interaction is completed - remove interaction status.\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.INTERACTION_STATUS_KEY));\r\n };\r\n return PopupHandler;\r\n}(InteractionHandler));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentHandler = /** @class */ (function (_super) {\r\n __extends(SilentHandler, _super);\r\n function SilentHandler(authCodeModule, storageImpl, authCodeRequest, navigateFrameWait) {\r\n var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest) || this;\r\n _this.navigateFrameWait = navigateFrameWait;\r\n return _this;\r\n }\r\n /**\r\n * Creates a hidden iframe to given URL using user-requested scopes as an id.\r\n * @param urlNavigate\r\n * @param userRequestScopes\r\n */\r\n SilentHandler.prototype.initiateAuthRequest = function (requestUrl) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (StringUtils.isEmpty(requestUrl)) {\r\n // Throw error if request URL is empty.\r\n this.authModule.logger.info(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n if (!this.navigateFrameWait) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.loadFrame(requestUrl)];\r\n case 1:\r\n _a = _b.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n _a = this.loadFrameSync(requestUrl);\r\n _b.label = 3;\r\n case 3: return [2 /*return*/, _a];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Monitors an iframe content window until it loads a url with a known hash, or hits a specified timeout.\r\n * @param iframe\r\n * @param timeout\r\n */\r\n SilentHandler.prototype.monitorIframeForHash = function (iframe, timeout) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {\r\n _this.authModule.logger.warning(\"system.loadFrameTimeout or system.iframeHashTimeout set to lower (\" + timeout + \"ms) than the default (\" + DEFAULT_IFRAME_TIMEOUT_MS + \"ms). This may result in timeouts.\");\r\n }\r\n /*\r\n * Polling for iframes can be purely timing based,\r\n * since we don't need to account for interaction.\r\n */\r\n var nowMark = window.performance.now();\r\n var timeoutMark = nowMark + timeout;\r\n var intervalId = setInterval(function () {\r\n if (window.performance.now() > timeoutMark) {\r\n _this.removeHiddenIframe(iframe);\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createMonitorIframeTimeoutError());\r\n return;\r\n }\r\n var href = Constants.EMPTY_STRING;\r\n var contentWindow = iframe.contentWindow;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = contentWindow ? contentWindow.location.href : Constants.EMPTY_STRING;\r\n }\r\n catch (e) { }\r\n if (StringUtils.isEmpty(href)) {\r\n return;\r\n }\r\n var contentHash = contentWindow ? contentWindow.location.hash : Constants.EMPTY_STRING;\r\n if (UrlString.hashContainsKnownProperties(contentHash)) {\r\n // Success case\r\n _this.removeHiddenIframe(iframe);\r\n clearInterval(intervalId);\r\n resolve(contentHash);\r\n return;\r\n }\r\n }, BrowserConstants.POLL_INTERVAL_MS);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n */\r\n SilentHandler.prototype.loadFrame = function (urlNavigate) {\r\n /*\r\n * This trick overcomes iframe navigation in IE\r\n * IE does not load the page consistently in iframe\r\n */\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var frameHandle = _this.createHiddenIframe();\r\n setTimeout(function () {\r\n if (!frameHandle) {\r\n reject(\"Unable to load iframe\");\r\n return;\r\n }\r\n frameHandle.src = urlNavigate;\r\n resolve(frameHandle);\r\n }, _this.navigateFrameWait);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Loads the iframe synchronously when the navigateTimeFrame is set to `0`\r\n * @param urlNavigate\r\n * @param frameName\r\n * @param logger\r\n */\r\n SilentHandler.prototype.loadFrameSync = function (urlNavigate) {\r\n var frameHandle = this.createHiddenIframe();\r\n frameHandle.src = urlNavigate;\r\n return frameHandle;\r\n };\r\n /**\r\n * @hidden\r\n * Creates a new hidden iframe or gets an existing one for silent token renewal.\r\n * @ignore\r\n */\r\n SilentHandler.prototype.createHiddenIframe = function () {\r\n var authFrame = document.createElement(\"iframe\");\r\n authFrame.style.visibility = \"hidden\";\r\n authFrame.style.position = \"absolute\";\r\n authFrame.style.width = authFrame.style.height = \"0\";\r\n authFrame.style.border = \"0\";\r\n authFrame.setAttribute(\"sandbox\", \"allow-scripts allow-same-origin allow-forms\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(authFrame);\r\n return authFrame;\r\n };\r\n /**\r\n * @hidden\r\n * Removes a hidden iframe from the page.\r\n * @ignore\r\n */\r\n SilentHandler.prototype.removeHiddenIframe = function (iframe) {\r\n if (document.body === iframe.parentNode) {\r\n document.body.removeChild(iframe);\r\n }\r\n };\r\n return SilentHandler;\r\n}(InteractionHandler));\n\nvar name$1 = \"@azure/msal-browser\";\nvar version$1 = \"2.9.0\";\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar EventType;\r\n(function (EventType) {\r\n EventType[\"LOGIN_START\"] = \"msal:loginStart\";\r\n EventType[\"LOGIN_SUCCESS\"] = \"msal:loginSuccess\";\r\n EventType[\"LOGIN_FAILURE\"] = \"msal:loginFailure\";\r\n EventType[\"ACQUIRE_TOKEN_START\"] = \"msal:acquireTokenStart\";\r\n EventType[\"ACQUIRE_TOKEN_SUCCESS\"] = \"msal:acquireTokenSuccess\";\r\n EventType[\"ACQUIRE_TOKEN_FAILURE\"] = \"msal:acquireTokenFailure\";\r\n EventType[\"ACQUIRE_TOKEN_NETWORK_START\"] = \"msal:acquireTokenFromNetworkStart\";\r\n EventType[\"SSO_SILENT_START\"] = \"msal:ssoSilentStart\";\r\n EventType[\"SSO_SILENT_SUCCESS\"] = \"msal:ssoSilentSuccess\";\r\n EventType[\"SSO_SILENT_FAILURE\"] = \"msal:ssoSilentFailure\";\r\n EventType[\"HANDLE_REDIRECT_START\"] = \"msal:handleRedirectStart\";\r\n EventType[\"HANDLE_REDIRECT_END\"] = \"msal:handleRedirectEnd\";\r\n EventType[\"LOGOUT_START\"] = \"msal:logoutStart\";\r\n EventType[\"LOGOUT_SUCCESS\"] = \"msal:logoutSuccess\";\r\n EventType[\"LOGOUT_FAILURE\"] = \"msal:logoutFailure\";\r\n})(EventType || (EventType = {}));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ClientApplication = /** @class */ (function () {\r\n /**\r\n * @constructor\r\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\r\n *\r\n * Important attributes in the Configuration object for auth are:\r\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\r\n * - authority: the authority URL for your application.\r\n * - redirect_uri: the uri of your application registered in the portal.\r\n *\r\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\r\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\r\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\r\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\r\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\r\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\r\n *\r\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\r\n * Full B2C functionality will be available in this library in future versions.\r\n *\r\n * @param {@link (Configuration:type)} configuration object for the MSAL PublicClientApplication instance\r\n */\r\n function ClientApplication(configuration) {\r\n /*\r\n * If loaded in an environment where window is not available,\r\n * set internal flag to false so that further requests fail.\r\n * This is to support server-side rendering environments.\r\n */\r\n this.isBrowserEnvironment = typeof window !== \"undefined\";\r\n // Set the configuration.\r\n this.config = buildConfiguration(configuration, this.isBrowserEnvironment);\r\n this.defaultAuthority = null;\r\n this.activeLocalAccountId = null;\r\n // Array of events\r\n this.eventCallbacks = new Map();\r\n // Initialize logger\r\n this.logger = new Logger(this.config.system.loggerOptions, name$1, version$1);\r\n // Initialize the network module class.\r\n this.networkClient = this.config.system.networkClient;\r\n if (!this.isBrowserEnvironment) {\r\n this.browserStorage = DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);\r\n this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;\r\n return;\r\n }\r\n // Initialize the crypto class.\r\n this.browserCrypto = new CryptoOps();\r\n // Initialize the browser storage class.\r\n this.browserStorage = new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger);\r\n // Initialize default authority instance\r\n TrustedAuthority.setTrustedAuthoritiesFromConfig(this.config.auth.knownAuthorities, this.config.auth.cloudDiscoveryMetadata);\r\n }\r\n // #region Redirect Flow\r\n /**\r\n * Event handler function which allows users to fire events after the PublicClientApplication object\r\n * has loaded during redirect flows. This should be invoked on all page loads involved in redirect\r\n * auth flows.\r\n * @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.\r\n * @returns {Promise.} token response or null. If the return value is null, then no auth redirect was detected.\r\n */\r\n ClientApplication.prototype.handleRedirectPromise = function (hash) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var loggedInAccounts;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n this.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);\r\n loggedInAccounts = this.getAllAccounts();\r\n if (this.isBrowserEnvironment) {\r\n return [2 /*return*/, this.handleRedirectResponse(hash)\r\n .then(function (result) {\r\n if (result) {\r\n // Emit login event if number of accounts change\r\n var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;\r\n if (isLoggingIn) {\r\n _this.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);\r\n }\r\n else {\r\n _this.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);\r\n }\r\n }\r\n _this.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\r\n return result;\r\n })\r\n .catch(function (e) {\r\n // Emit login event if there is an account\r\n if (loggedInAccounts.length > 0) {\r\n _this.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n else {\r\n _this.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n _this.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\r\n throw e;\r\n })];\r\n }\r\n return [2 /*return*/, null];\r\n });\r\n });\r\n };\r\n /**\r\n * Checks if navigateToLoginRequestUrl is set, and:\r\n * - if true, performs logic to cache and navigate\r\n * - if false, handles hash string and parses response\r\n */\r\n ClientApplication.prototype.handleRedirectResponse = function (hash) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var responseHash, state, loginRequestUrl, loginRequestUrlNormalized, currentUrlNormalized, handleHashResult, homepage;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!this.interactionInProgress()) {\r\n this.logger.info(\"handleRedirectPromise called but there is no interaction in progress, returning null.\");\r\n return [2 /*return*/, null];\r\n }\r\n responseHash = this.getRedirectResponseHash(hash || window.location.hash);\r\n if (!responseHash) {\r\n // Not a recognized server response hash or hash not associated with a redirect request\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n return [2 /*return*/, null];\r\n }\r\n try {\r\n state = this.validateAndExtractStateFromHash(responseHash, InteractionType.Redirect);\r\n BrowserUtils.clearHash();\r\n }\r\n catch (e) {\r\n this.logger.info(\"handleRedirectPromise was unable to extract state due to: \" + e);\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n return [2 /*return*/, null];\r\n }\r\n loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || \"\";\r\n loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);\r\n currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);\r\n if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.handleHash(responseHash, state)];\r\n case 1:\r\n handleHashResult = _a.sent();\r\n if (loginRequestUrl.indexOf(\"#\") > -1) {\r\n // Replace current hash with non-msal hash, if present\r\n BrowserUtils.replaceHash(loginRequestUrl);\r\n }\r\n return [2 /*return*/, handleHashResult];\r\n case 2:\r\n if (!!this.config.auth.navigateToLoginRequestUrl) return [3 /*break*/, 3];\r\n return [2 /*return*/, this.handleHash(responseHash, state)];\r\n case 3:\r\n if (!!BrowserUtils.isInIframe()) return [3 /*break*/, 7];\r\n /*\r\n * Returned from authority using redirect - need to perform navigation before processing response\r\n * Cache the hash to be retrieved after the next redirect\r\n */\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);\r\n if (!(!loginRequestUrl || loginRequestUrl === \"null\")) return [3 /*break*/, 5];\r\n homepage = BrowserUtils.getHomepage();\r\n // Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);\r\n this.logger.warning(\"Unable to get valid login request url from cache, redirecting to home page\");\r\n return [4 /*yield*/, BrowserUtils.navigateWindow(homepage, this.config.system.redirectNavigationTimeout, this.logger, true)];\r\n case 4:\r\n _a.sent();\r\n return [3 /*break*/, 7];\r\n case 5: \r\n // Navigate to page that initiated the redirect request\r\n return [4 /*yield*/, BrowserUtils.navigateWindow(loginRequestUrl, this.config.system.redirectNavigationTimeout, this.logger, true)];\r\n case 6:\r\n // Navigate to page that initiated the redirect request\r\n _a.sent();\r\n _a.label = 7;\r\n case 7: return [2 /*return*/, null];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Gets the response hash for a redirect request\r\n * Returns null if interactionType in the state value is not \"redirect\" or the hash does not contain known properties\r\n * @returns {string}\r\n */\r\n ClientApplication.prototype.getRedirectResponseHash = function (hash) {\r\n // Get current location hash from window or cache.\r\n var isResponseHash = UrlString.hashContainsKnownProperties(hash);\r\n var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));\r\n return isResponseHash ? hash : cachedHash;\r\n };\r\n /**\r\n *\r\n * @param hash\r\n * @param interactionType\r\n */\r\n ClientApplication.prototype.validateAndExtractStateFromHash = function (hash, interactionType) {\r\n // Deserialize hash fragment response parameters.\r\n var serverParams = UrlString.getDeserializedHash(hash);\r\n if (!serverParams.state) {\r\n throw BrowserAuthError.createHashDoesNotContainStateError();\r\n }\r\n var platformStateObj = BrowserProtocolUtils.extractBrowserRequestState(this.browserCrypto, serverParams.state);\r\n if (!platformStateObj) {\r\n throw BrowserAuthError.createUnableToParseStateError();\r\n }\r\n if (platformStateObj.interactionType !== interactionType) {\r\n throw BrowserAuthError.createStateInteractionTypeMismatchError();\r\n }\r\n return serverParams.state;\r\n };\r\n /**\r\n * Checks if hash exists and handles in window.\r\n * @param responseHash\r\n * @param interactionHandler\r\n */\r\n ClientApplication.prototype.handleHash = function (hash, state) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cachedRequest, serverTelemetryManager, currentAuthority, authClient, interactionHandler, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n cachedRequest = this.browserStorage.getCachedRequest(state, this.browserCrypto);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise, cachedRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 5]);\r\n currentAuthority = this.browserStorage.getCachedAuthority(state);\r\n if (!currentAuthority) {\r\n throw BrowserAuthError.createNoCachedAuthorityError();\r\n }\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, currentAuthority)];\r\n case 2:\r\n authClient = _a.sent();\r\n interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.browserCrypto);\r\n return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient, this.config.auth.clientId)];\r\n case 3: return [2 /*return*/, _a.sent()];\r\n case 4:\r\n e_1 = _a.sent();\r\n serverTelemetryManager.cacheFailedRequest(e_1);\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n throw e_1;\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects\r\n * the page, so any code that follows this function will not execute.\r\n *\r\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\r\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\r\n *\r\n * @param {@link (RedirectRequest:type)}\r\n */\r\n ClientApplication.prototype.acquireTokenRedirect = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var isLoggedIn, validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_2;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Preflight request\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\r\n isLoggedIn = this.getAllAccounts().length > 0;\r\n if (isLoggedIn) {\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Redirect, request);\r\n }\r\n else {\r\n this.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);\r\n }\r\n validRequest = this.preflightInteractiveRequest(request, InteractionType.Redirect);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect, validRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 5, , 6]);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];\r\n case 2:\r\n authCodeRequest = _a.sent();\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];\r\n case 3:\r\n authClient = _a.sent();\r\n interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.browserCrypto);\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];\r\n case 4:\r\n navigateUrl = _a.sent();\r\n redirectStartPage = (request && request.redirectStartPage) || window.location.href;\r\n // Show the UI once the url has been created. Response will come back in the hash, which will be handled in the handleRedirectCallback function.\r\n return [2 /*return*/, interactionHandler.initiateAuthRequest(navigateUrl, {\r\n redirectTimeout: this.config.system.redirectNavigationTimeout,\r\n redirectStartPage: redirectStartPage,\r\n onRedirectNavigate: request.onRedirectNavigate\r\n })];\r\n case 5:\r\n e_2 = _a.sent();\r\n // If logged in, emit acquire token events\r\n if (isLoggedIn) {\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e_2);\r\n }\r\n else {\r\n this.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e_2);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_2);\r\n this.browserStorage.cleanRequestByState(validRequest.state);\r\n throw e_2;\r\n case 6: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Popup Flow\r\n /**\r\n * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser\r\n * @param {@link (PopupRequest:type)}\r\n *\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n ClientApplication.prototype.acquireTokenPopup = function (request) {\r\n try {\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Popup);\r\n }\r\n catch (e) {\r\n // Since this function is syncronous we need to reject\r\n return Promise.reject(e);\r\n }\r\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\r\n if (this.config.system.asyncPopups) {\r\n return this.acquireTokenPopupAsync(request);\r\n }\r\n else {\r\n // asyncPopups flag is set to false. Opens popup before acquiring token.\r\n var popup = PopupHandler.openSizedPopup();\r\n return this.acquireTokenPopupAsync(request, popup);\r\n }\r\n };\r\n /**\r\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\r\n * @param {@link (PopupRequest:type)}\r\n *\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n ClientApplication.prototype.acquireTokenPopupAsync = function (request, popup) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var loggedInAccounts, validRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, isLoggingIn, e_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n loggedInAccounts = this.getAllAccounts();\r\n if (loggedInAccounts.length > 0) {\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Popup, request);\r\n }\r\n else {\r\n this.emitEvent(EventType.LOGIN_START, InteractionType.Popup, request);\r\n }\r\n validRequest = this.preflightInteractiveRequest(request, InteractionType.Popup);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup, validRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 7, , 8]);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];\r\n case 2:\r\n authCodeRequest = _a.sent();\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];\r\n case 3:\r\n authClient = _a.sent();\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];\r\n case 4:\r\n navigateUrl = _a.sent();\r\n interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest);\r\n popupParameters = {\r\n popup: popup\r\n };\r\n popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);\r\n return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow, this.config.system.windowHashTimeout)];\r\n case 5:\r\n hash = _a.sent();\r\n state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup);\r\n // Remove throttle if it exists\r\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest.authority, authCodeRequest.scopes);\r\n return [4 /*yield*/, interactionHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];\r\n case 6:\r\n result = _a.sent();\r\n isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;\r\n if (isLoggingIn) {\r\n this.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Popup, result);\r\n }\r\n else {\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);\r\n }\r\n return [2 /*return*/, result];\r\n case 7:\r\n e_3 = _a.sent();\r\n if (loggedInAccounts.length > 0) {\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Popup, null, e_3);\r\n }\r\n else {\r\n this.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Popup, null, e_3);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_3);\r\n this.browserStorage.cleanRequestByState(validRequest.state);\r\n throw e_3;\r\n case 8: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Silent Flow\r\n /**\r\n * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:\r\n * - Any browser using a form of Intelligent Tracking Prevention\r\n * - If there is not an established session with the service\r\n *\r\n * In these cases, the request must be done inside a popup or full frame redirect.\r\n *\r\n * For the cases where interaction is required, you cannot send a request with prompt=none.\r\n *\r\n * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as\r\n * you session on the server still exists.\r\n * @param {@link AuthorizationUrlRequest}\r\n *\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n ClientApplication.prototype.ssoSilent = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentTokenResult, e_4;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n this.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, request);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.acquireTokenByIframe(request)];\r\n case 2:\r\n silentTokenResult = _a.sent();\r\n this.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, silentTokenResult);\r\n return [2 /*return*/, silentTokenResult];\r\n case 3:\r\n e_4 = _a.sent();\r\n this.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e_4);\r\n throw e_4;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This function uses a hidden iframe to fetch an authorization code from the eSTS. To be used for silent refresh token acquisition and renewal.\r\n * @param {@link AuthorizationUrlRequest}\r\n * @param request\r\n */\r\n ClientApplication.prototype.acquireTokenByIframe = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_5;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Check that we have some SSO data\r\n if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {\r\n throw BrowserAuthError.createSilentSSOInsufficientInfoError();\r\n }\r\n // Check that prompt is set to none, throw error if it is set to anything else.\r\n if (request.prompt && request.prompt !== PromptValue.NONE) {\r\n throw BrowserAuthError.createSilentPromptValueError(request.prompt);\r\n }\r\n silentRequest = this.initializeAuthorizationRequest(__assign(__assign({}, request), { prompt: PromptValue.NONE }), InteractionType.Silent);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.ssoSilent, silentRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 6, , 7]);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];\r\n case 2:\r\n authCodeRequest = _a.sent();\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority)];\r\n case 3:\r\n authClient = _a.sent();\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];\r\n case 4:\r\n navigateUrl = _a.sent();\r\n return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient)];\r\n case 5: return [2 /*return*/, _a.sent()];\r\n case 6:\r\n e_5 = _a.sent();\r\n serverTelemetryManager.cacheFailedRequest(e_5);\r\n this.browserStorage.cleanRequestByState(silentRequest.state);\r\n throw e_5;\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Use this function to obtain a token before every call to the API / resource provider\r\n *\r\n * MSAL return's a cached token when available\r\n * Or it send's a request to the STS to obtain a new token using a refresh token.\r\n *\r\n * @param {@link (SilentRequest:type)}\r\n *\r\n * To renew idToken, please pass clientId as the only scope in the Authentication Parameters\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n *\r\n */\r\n ClientApplication.prototype.acquireTokenByRefreshToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentRequest, serverTelemetryManager, refreshTokenClient, e_6, isServerError, isInteractionRequiredError, isInvalidGrantError;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, request);\r\n // block the reload if it occurred inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n silentRequest = __assign(__assign({}, request), this.initializeBaseRequest(request));\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow, silentRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 7]);\r\n return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];\r\n case 2:\r\n refreshTokenClient = _a.sent();\r\n return [4 /*yield*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)];\r\n case 3: \r\n // Send request to renew token. Auth module will throw errors if token cannot be renewed.\r\n return [2 /*return*/, _a.sent()];\r\n case 4:\r\n e_6 = _a.sent();\r\n serverTelemetryManager.cacheFailedRequest(e_6);\r\n isServerError = e_6 instanceof ServerError;\r\n isInteractionRequiredError = e_6 instanceof InteractionRequiredAuthError;\r\n isInvalidGrantError = (e_6.errorCode === BrowserConstants.INVALID_GRANT_ERROR);\r\n if (!(isServerError && isInvalidGrantError && !isInteractionRequiredError)) return [3 /*break*/, 6];\r\n return [4 /*yield*/, this.acquireTokenByIframe(request)];\r\n case 5: return [2 /*return*/, _a.sent()];\r\n case 6: throw e_6;\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper which acquires an authorization code silently using a hidden iframe from given url\r\n * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.\r\n * @param navigateUrl\r\n * @param userRequestScopes\r\n */\r\n ClientApplication.prototype.silentTokenHelper = function (navigateUrl, authCodeRequest, authClient) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentHandler, msalFrame, hash, state;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.config.system.navigateFrameWait);\r\n return [4 /*yield*/, silentHandler.initiateAuthRequest(navigateUrl)];\r\n case 1:\r\n msalFrame = _a.sent();\r\n return [4 /*yield*/, silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout)];\r\n case 2:\r\n hash = _a.sent();\r\n state = this.validateAndExtractStateFromHash(hash, InteractionType.Silent);\r\n // Handle response from hash string\r\n return [2 /*return*/, silentHandler.handleCodeResponse(hash, state, authClient.authority, this.networkClient)];\r\n }\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Logout\r\n /**\r\n * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param {@link (EndSessionRequest:type)}\r\n */\r\n ClientApplication.prototype.logout = function (logoutRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var validLogoutRequest, serverTelemetryManager, authClient, logoutUri, navigate, e_7;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\r\n validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logout, validLogoutRequest.correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n this.emitEvent(EventType.LOGOUT_START, InteractionType.Redirect, logoutRequest);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority)];\r\n case 2:\r\n authClient = _a.sent();\r\n logoutUri = authClient.getLogoutUri(validLogoutRequest);\r\n this.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Redirect, validLogoutRequest);\r\n if (!validLogoutRequest.account || AccountEntity.accountInfoIsEqual(validLogoutRequest.account, this.getActiveAccount())) {\r\n this.setActiveAccount(null);\r\n }\r\n // Check if onRedirectNavigate is implemented, and invoke it if so\r\n if (logoutRequest && typeof logoutRequest.onRedirectNavigate === \"function\") {\r\n navigate = logoutRequest.onRedirectNavigate(logoutUri);\r\n if (navigate !== false) {\r\n this.logger.verbose(\"Logout onRedirectNavigate did not return false, navigating\");\r\n return [2 /*return*/, BrowserUtils.navigateWindow(logoutUri, this.config.system.redirectNavigationTimeout, this.logger)];\r\n }\r\n else {\r\n this.logger.verbose(\"Logout onRedirectNavigate returned false, stopping navigation\");\r\n }\r\n }\r\n else {\r\n return [2 /*return*/, BrowserUtils.navigateWindow(logoutUri, this.config.system.redirectNavigationTimeout, this.logger)];\r\n }\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_7 = _a.sent();\r\n serverTelemetryManager.cacheFailedRequest(e_7);\r\n this.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Redirect, null, e_7);\r\n throw e_7;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Account APIs\r\n /**\r\n * Returns all accounts that MSAL currently has data for.\r\n * (the account object is created at the time of successful login)\r\n * or empty array when no accounts are found\r\n * @returns {@link AccountInfo[]} - Array of account objects in cache\r\n */\r\n ClientApplication.prototype.getAllAccounts = function () {\r\n return this.isBrowserEnvironment ? this.browserStorage.getAllAccounts() : [];\r\n };\r\n /**\r\n * Returns the signed in account matching username.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found.\r\n * This API is provided for convenience but getAccountById should be used for best reliability\r\n * @returns {@link AccountInfo} - the account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByUsername = function (userName) {\r\n var allAccounts = this.getAllAccounts();\r\n if (!StringUtils.isEmpty(userName) && allAccounts && allAccounts.length) {\r\n return allAccounts.filter(function (accountObj) { return accountObj.username.toLowerCase() === userName.toLowerCase(); })[0] || null;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Returns the signed in account matching homeAccountId.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found\r\n * @returns {@link AccountInfo} - the account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByHomeId = function (homeAccountId) {\r\n var allAccounts = this.getAllAccounts();\r\n if (!StringUtils.isEmpty(homeAccountId) && allAccounts && allAccounts.length) {\r\n return allAccounts.filter(function (accountObj) { return accountObj.homeAccountId === homeAccountId; })[0] || null;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Returns the signed in account matching localAccountId.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found\r\n * @returns {@link AccountInfo} - the account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByLocalId = function (localAccountId) {\r\n var allAccounts = this.getAllAccounts();\r\n if (!StringUtils.isEmpty(localAccountId) && allAccounts && allAccounts.length) {\r\n return allAccounts.filter(function (accountObj) { return accountObj.localAccountId === localAccountId; })[0] || null;\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.\r\n * @param account\r\n */\r\n ClientApplication.prototype.setActiveAccount = function (account) {\r\n this.activeLocalAccountId = account ? account.localAccountId : null;\r\n };\r\n /**\r\n * Gets the currently active account\r\n */\r\n ClientApplication.prototype.getActiveAccount = function () {\r\n if (!this.activeLocalAccountId) {\r\n return null;\r\n }\r\n return this.getAccountByLocalId(this.activeLocalAccountId);\r\n };\r\n // #endregion\r\n // #region Helpers\r\n /**\r\n *\r\n * Use to get the redirect uri configured in MSAL or null.\r\n * @returns {string} redirect URL\r\n *\r\n */\r\n ClientApplication.prototype.getRedirectUri = function (requestRedirectUri) {\r\n var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();\r\n return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());\r\n };\r\n /**\r\n * Use to get the post logout redirect uri configured in MSAL or null.\r\n *\r\n * @returns {string} post logout redirect URL\r\n */\r\n ClientApplication.prototype.getPostLogoutRedirectUri = function (requestPostLogoutRedirectUri) {\r\n var postLogoutRedirectUri = requestPostLogoutRedirectUri || this.config.auth.postLogoutRedirectUri || BrowserUtils.getCurrentUri();\r\n return UrlString.getAbsoluteUrl(postLogoutRedirectUri, BrowserUtils.getCurrentUri());\r\n };\r\n /**\r\n * Used to get a discovered version of the default authority.\r\n */\r\n ClientApplication.prototype.getDiscoveredDefaultAuthority = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (!!this.defaultAuthority) return [3 /*break*/, 2];\r\n _a = this;\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.config.auth.protocolMode)];\r\n case 1:\r\n _a.defaultAuthority = _b.sent();\r\n _b.label = 2;\r\n case 2: return [2 /*return*/, this.defaultAuthority];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper to check whether interaction is in progress.\r\n */\r\n ClientApplication.prototype.interactionInProgress = function () {\r\n // Check whether value in cache is present and equal to expected value\r\n return (this.browserStorage.getTemporaryCache(TemporaryCacheKeys.INTERACTION_STATUS_KEY, true)) === BrowserConstants.INTERACTION_IN_PROGRESS_VALUE;\r\n };\r\n /**\r\n * Creates an Authorization Code Client with the given authority, or the default authority.\r\n * @param authorityUrl\r\n */\r\n ClientApplication.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates an Silent Flow Client with the given authority, or the default authority.\r\n * @param authorityUrl\r\n */\r\n ClientApplication.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new SilentFlowClient(clientConfig)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates a Refresh Client with the given authority, or the default authority.\r\n * @param authorityUrl\r\n */\r\n ClientApplication.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new RefreshTokenClient(clientConfig)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates a Client Configuration object with the given request authority, or the default authority.\r\n * @param requestAuthority\r\n */\r\n ClientApplication.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var discoveredAuthority, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (!(requestAuthority && requestAuthority !== this.config.auth.authority)) return [3 /*break*/, 2];\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.config.auth.protocolMode)];\r\n case 1:\r\n _a = _b.sent();\r\n return [3 /*break*/, 4];\r\n case 2: return [4 /*yield*/, this.getDiscoveredDefaultAuthority()];\r\n case 3:\r\n _a = _b.sent();\r\n _b.label = 4;\r\n case 4:\r\n discoveredAuthority = _a;\r\n return [2 /*return*/, {\r\n authOptions: {\r\n clientId: this.config.auth.clientId,\r\n authority: discoveredAuthority,\r\n knownAuthorities: this.config.auth.knownAuthorities,\r\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\r\n clientCapabilities: this.config.auth.clientCapabilities,\r\n protocolMode: this.config.auth.protocolMode\r\n },\r\n systemOptions: {\r\n tokenRenewalOffsetSeconds: this.config.system.tokenRenewalOffsetSeconds\r\n },\r\n loggerOptions: {\r\n loggerCallback: this.config.system.loggerOptions.loggerCallback,\r\n piiLoggingEnabled: this.config.system.loggerOptions.piiLoggingEnabled\r\n },\r\n cryptoInterface: this.browserCrypto,\r\n networkInterface: this.networkClient,\r\n storageInterface: this.browserStorage,\r\n serverTelemetryManager: serverTelemetryManager,\r\n libraryInfo: {\r\n sku: BrowserConstants.MSAL_SKU,\r\n version: version$1,\r\n cpu: \"\",\r\n os: \"\"\r\n }\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper to validate app environment before making a request.\r\n */\r\n ClientApplication.prototype.preflightInteractiveRequest = function (request, interactionType) {\r\n // block the reload if it occurred inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n // Check if interaction is in progress. Throw error if true.\r\n if (this.interactionInProgress()) {\r\n throw BrowserAuthError.createInteractionInProgressError();\r\n }\r\n return this.initializeAuthorizationRequest(request, interactionType);\r\n };\r\n /**\r\n * Helper to validate app environment before making an auth request\r\n * * @param request\r\n */\r\n ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType) {\r\n // Block request if not in browser environment\r\n BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);\r\n // Block redirects if in an iframe\r\n BrowserUtils.blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);\r\n // Block auth requests inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n // Block redirects if memory storage is enabled but storeAuthStateInCookie is not\r\n if (interactionType === InteractionType.Redirect &&\r\n this.config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&\r\n !this.config.cache.storeAuthStateInCookie) {\r\n throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();\r\n }\r\n };\r\n /**\r\n * Initializer function for all request APIs\r\n * @param request\r\n */\r\n ClientApplication.prototype.initializeBaseRequest = function (request) {\r\n var authority = request.authority || this.config.auth.authority;\r\n var scopes = __spread(((request && request.scopes) || []));\r\n var correlationId = (request && request.correlationId) || this.browserCrypto.createNewGuid();\r\n var validatedRequest = __assign(__assign({}, request), { correlationId: correlationId,\r\n authority: authority,\r\n scopes: scopes });\r\n return validatedRequest;\r\n };\r\n ClientApplication.prototype.initializeServerTelemetryManager = function (apiId, correlationId, forceRefresh) {\r\n var telemetryPayload = {\r\n clientId: this.config.auth.clientId,\r\n correlationId: correlationId,\r\n apiId: apiId,\r\n forceRefresh: forceRefresh || false\r\n };\r\n return new ServerTelemetryManager(telemetryPayload, this.browserStorage);\r\n };\r\n /**\r\n * Helper to initialize required request parameters for interactive APIs and ssoSilent()\r\n * @param request\r\n */\r\n ClientApplication.prototype.initializeAuthorizationRequest = function (request, interactionType) {\r\n var redirectUri = this.getRedirectUri(request.redirectUri);\r\n var browserState = {\r\n interactionType: interactionType\r\n };\r\n var state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || \"\", browserState);\r\n var authenticationScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n var validatedRequest = __assign(__assign({}, this.initializeBaseRequest(request)), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT, authenticationScheme: authenticationScheme });\r\n var account = request.account || this.getActiveAccount();\r\n if (account) {\r\n validatedRequest.account = account;\r\n }\r\n // Check for ADAL SSO\r\n if (StringUtils.isEmpty(validatedRequest.loginHint)) {\r\n // Only check for adal token if no SSO params are being used\r\n var adalIdTokenString = this.browserStorage.getTemporaryCache(PersistentCacheKeys.ADAL_ID_TOKEN);\r\n if (adalIdTokenString) {\r\n var adalIdToken = new AuthToken(adalIdTokenString, this.browserCrypto);\r\n this.browserStorage.removeItem(PersistentCacheKeys.ADAL_ID_TOKEN);\r\n if (adalIdToken.claims && adalIdToken.claims.upn) {\r\n validatedRequest.loginHint = adalIdToken.claims.upn;\r\n }\r\n }\r\n }\r\n this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority);\r\n return validatedRequest;\r\n };\r\n /**\r\n * Generates an auth code request tied to the url request.\r\n * @param request\r\n */\r\n ClientApplication.prototype.initializeAuthorizationCodeRequest = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var generatedPkceParams, authCodeRequest;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];\r\n case 1:\r\n generatedPkceParams = _a.sent();\r\n authCodeRequest = __assign(__assign({}, request), { redirectUri: request.redirectUri, code: \"\", codeVerifier: generatedPkceParams.verifier });\r\n request.codeChallenge = generatedPkceParams.challenge;\r\n request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;\r\n return [2 /*return*/, authCodeRequest];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Initializer for the logout request.\r\n * @param logoutRequest\r\n */\r\n ClientApplication.prototype.initializeLogoutRequest = function (logoutRequest) {\r\n var validLogoutRequest = __assign({ correlationId: this.browserCrypto.createNewGuid() }, logoutRequest);\r\n validLogoutRequest.postLogoutRedirectUri = this.getPostLogoutRedirectUri(logoutRequest ? logoutRequest.postLogoutRedirectUri : \"\");\r\n return validLogoutRequest;\r\n };\r\n /**\r\n * Emits events by calling callback with event message\r\n * @param eventType\r\n * @param interactionType\r\n * @param payload\r\n * @param error\r\n */\r\n ClientApplication.prototype.emitEvent = function (eventType, interactionType, payload, error) {\r\n var _this = this;\r\n if (this.isBrowserEnvironment) {\r\n var message_1 = {\r\n eventType: eventType,\r\n interactionType: interactionType || null,\r\n payload: payload || null,\r\n error: error || null,\r\n timestamp: Date.now()\r\n };\r\n this.logger.info(\"Emitting event: \" + eventType);\r\n this.eventCallbacks.forEach(function (callback, callbackId) {\r\n _this.logger.verbose(\"Emitting event to callback \" + callbackId + \": \" + eventType);\r\n callback.apply(null, [message_1]);\r\n });\r\n }\r\n };\r\n /**\r\n * Adds event callbacks to array\r\n * @param callback\r\n */\r\n ClientApplication.prototype.addEventCallback = function (callback) {\r\n if (this.isBrowserEnvironment) {\r\n var callbackId = this.browserCrypto.createNewGuid();\r\n this.eventCallbacks.set(callbackId, callback);\r\n this.logger.verbose(\"Event callback registered with id: \" + callbackId);\r\n return callbackId;\r\n }\r\n return null;\r\n };\r\n ClientApplication.prototype.removeEventCallback = function (callbackId) {\r\n this.eventCallbacks.delete(callbackId);\r\n this.logger.verbose(\"Event callback \" + callbackId + \" removed.\");\r\n };\r\n /**\r\n * Returns the logger instance\r\n */\r\n ClientApplication.prototype.getLogger = function () {\r\n return this.logger;\r\n };\r\n /**\r\n * Replaces the default logger set in configurations with new Logger with new configurations\r\n * @param logger Logger instance\r\n */\r\n ClientApplication.prototype.setLogger = function (logger) {\r\n this.logger = logger;\r\n };\r\n return ClientApplication;\r\n}());\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\r\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\r\n */\r\nvar PublicClientApplication = /** @class */ (function (_super) {\r\n __extends(PublicClientApplication, _super);\r\n /**\r\n * @constructor\r\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\r\n *\r\n * Important attributes in the Configuration object for auth are:\r\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\r\n * - authority: the authority URL for your application.\r\n * - redirect_uri: the uri of your application registered in the portal.\r\n *\r\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\r\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\r\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\r\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\r\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\r\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\r\n *\r\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\r\n * Full B2C functionality will be available in this library in future versions.\r\n *\r\n * @param {@link (Configuration:type)} configuration object for the MSAL PublicClientApplication instance\r\n */\r\n function PublicClientApplication(configuration) {\r\n return _super.call(this, configuration) || this;\r\n }\r\n /**\r\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\r\n * any code that follows this function will not execute.\r\n *\r\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\r\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\r\n *\r\n * @param {@link (RedirectRequest:type)}\r\n */\r\n PublicClientApplication.prototype.loginRedirect = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.acquireTokenRedirect(request || DEFAULT_REQUEST)];\r\n });\r\n });\r\n };\r\n /**\r\n * Use when initiating the login process via opening a popup window in the user's browser\r\n *\r\n * @param {@link (PopupRequest:type)}\r\n *\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n PublicClientApplication.prototype.loginPopup = function (request) {\r\n return this.acquireTokenPopup(request || DEFAULT_REQUEST);\r\n };\r\n /**\r\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\r\n *\r\n * @param {@link (SilentRequest:type)}\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n PublicClientApplication.prototype.acquireTokenSilent = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var account, silentRequest, serverTelemetryManager, silentAuthClient, cachedToken, e_1, tokenRenewalResult, tokenRenewalError_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n account = request.account || this.getActiveAccount();\r\n if (!account) {\r\n throw BrowserAuthError.createNoAccountError();\r\n }\r\n silentRequest = __assign(__assign(__assign({}, request), this.initializeBaseRequest(request)), { account: account, forceRefresh: request.forceRefresh || false });\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 9]);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow, silentRequest.correlationId);\r\n return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority)];\r\n case 2:\r\n silentAuthClient = _a.sent();\r\n return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];\r\n case 3:\r\n cachedToken = _a.sent();\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, cachedToken);\r\n return [2 /*return*/, cachedToken];\r\n case 4:\r\n e_1 = _a.sent();\r\n _a.label = 5;\r\n case 5:\r\n _a.trys.push([5, 7, , 8]);\r\n return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];\r\n case 6:\r\n tokenRenewalResult = _a.sent();\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);\r\n return [2 /*return*/, tokenRenewalResult];\r\n case 7:\r\n tokenRenewalError_1 = _a.sent();\r\n this.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);\r\n throw tokenRenewalError_1;\r\n case 8: return [3 /*break*/, 9];\r\n case 9: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return PublicClientApplication;\r\n}(ClientApplication));\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar stubbedPublicClientApplication = {\r\n acquireTokenPopup: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n acquireTokenRedirect: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n acquireTokenSilent: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n getAllAccounts: function () {\r\n return [];\r\n },\r\n getAccountByHomeId: function () {\r\n return null;\r\n },\r\n getAccountByUsername: function () {\r\n return null;\r\n },\r\n getAccountByLocalId: function () {\r\n return null;\r\n },\r\n handleRedirectPromise: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n loginPopup: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n loginRedirect: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n logout: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n ssoSilent: function () {\r\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError);\r\n },\r\n addEventCallback: function () {\r\n return null;\r\n },\r\n removeEventCallback: function () {\r\n return;\r\n },\r\n getLogger: function () {\r\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\r\n },\r\n setLogger: function () {\r\n return;\r\n },\r\n setActiveAccount: function () {\r\n return;\r\n },\r\n getActiveAccount: function () {\r\n return null;\r\n }\r\n};\n\nexport { AccountEntity, AuthError, AuthErrorMessage, AuthenticationScheme, BrowserAuthError, BrowserAuthErrorMessage, BrowserCacheLocation, BrowserConfigurationAuthError, BrowserConfigurationAuthErrorMessage, BrowserUtils, EventType, InteractionRequiredAuthError, InteractionType, LogLevel, Logger, ProtocolMode, PublicClientApplication, StringUtils, UrlString, stubbedPublicClientApplication };\n//# sourceMappingURL=index.es.js.map\n"],"sourceRoot":""}