@azure/msal-common 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/account/AccountInfo.d.ts +4 -0
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AuthToken.js +1 -1
- package/dist/account/AuthToken.js.map +1 -1
- package/dist/account/CcsCredential.js +1 -1
- package/dist/account/CcsCredential.js.map +1 -1
- package/dist/account/ClientInfo.js +1 -1
- package/dist/account/ClientInfo.js.map +1 -1
- package/dist/authority/Authority.js +1 -1
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.js +1 -1
- package/dist/authority/AuthorityFactory.js.map +1 -1
- package/dist/authority/AuthorityMetadata.js +1 -1
- package/dist/authority/AuthorityMetadata.js.map +1 -1
- package/dist/authority/AuthorityOptions.js +1 -1
- package/dist/authority/AuthorityOptions.js.map +1 -1
- package/dist/authority/AuthorityType.js +1 -1
- package/dist/authority/AuthorityType.js.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -1
- package/dist/authority/OpenIdConfigResponse.js +1 -1
- package/dist/authority/OpenIdConfigResponse.js.map +1 -1
- package/dist/authority/ProtocolMode.js +1 -1
- package/dist/authority/ProtocolMode.js.map +1 -1
- package/dist/authority/RegionDiscovery.js +1 -1
- package/dist/authority/RegionDiscovery.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +13 -0
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +35 -3
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.js +1 -1
- package/dist/cache/entities/AccessTokenEntity.js.map +1 -1
- package/dist/cache/entities/AccountEntity.js +1 -1
- package/dist/cache/entities/AccountEntity.js.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.js +1 -1
- package/dist/cache/entities/AppMetadataEntity.js.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -1
- package/dist/cache/entities/CacheRecord.js +1 -1
- package/dist/cache/entities/CacheRecord.js.map +1 -1
- package/dist/cache/entities/CredentialEntity.js +1 -1
- package/dist/cache/entities/CredentialEntity.js.map +1 -1
- package/dist/cache/entities/IdTokenEntity.js +1 -1
- package/dist/cache/entities/IdTokenEntity.js.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.js +1 -1
- package/dist/cache/entities/RefreshTokenEntity.js.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.js +1 -1
- package/dist/cache/entities/ThrottlingEntity.js.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.js +1 -1
- package/dist/cache/persistence/TokenCacheContext.js.map +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +1 -0
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +2 -2
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.js +1 -1
- package/dist/client/BaseClient.js.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +3 -1
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.js +34 -9
- package/dist/client/ClientCredentialClient.js.map +1 -1
- package/dist/client/DeviceCodeClient.js +1 -1
- package/dist/client/DeviceCodeClient.js.map +1 -1
- package/dist/client/OnBehalfOfClient.js +1 -1
- package/dist/client/OnBehalfOfClient.js.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +2 -2
- package/dist/client/RefreshTokenClient.js.map +1 -1
- package/dist/client/SilentFlowClient.js +1 -1
- package/dist/client/SilentFlowClient.js.map +1 -1
- package/dist/client/UsernamePasswordClient.js +1 -1
- package/dist/client/UsernamePasswordClient.js.map +1 -1
- package/dist/config/AppTokenProvider.d.ts +39 -0
- package/dist/config/AppTokenProvider.d.ts.map +1 -0
- package/dist/config/ClientConfiguration.d.ts +1 -1
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +2 -2
- package/dist/config/ClientConfiguration.js.map +1 -1
- package/dist/crypto/ICrypto.js +1 -1
- package/dist/crypto/ICrypto.js.map +1 -1
- package/dist/crypto/JoseHeader.js +1 -1
- package/dist/crypto/JoseHeader.js.map +1 -1
- package/dist/crypto/PopTokenGenerator.js +1 -1
- package/dist/crypto/PopTokenGenerator.js.map +1 -1
- package/dist/error/AuthError.js +1 -1
- package/dist/error/AuthError.js.map +1 -1
- package/dist/error/ClientAuthError.js +1 -1
- package/dist/error/ClientAuthError.js.map +1 -1
- package/dist/error/ClientConfigurationError.js +1 -1
- package/dist/error/ClientConfigurationError.js.map +1 -1
- package/dist/error/InteractionRequiredAuthError.js +1 -1
- package/dist/error/InteractionRequiredAuthError.js.map +1 -1
- package/dist/error/JoseHeaderError.js +1 -1
- package/dist/error/JoseHeaderError.js.map +1 -1
- package/dist/error/ServerError.js +1 -1
- package/dist/error/ServerError.js.map +1 -1
- package/dist/index.cjs.js +99 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/Logger.js +1 -1
- package/dist/logger/Logger.js.map +1 -1
- package/dist/network/INetworkModule.js +1 -1
- package/dist/network/INetworkModule.js.map +1 -1
- package/dist/network/NetworkManager.js +1 -1
- package/dist/network/NetworkManager.js.map +1 -1
- package/dist/network/ThrottlingUtils.js +1 -1
- package/dist/network/ThrottlingUtils.js.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthenticationHeaderParser.js +1 -1
- package/dist/request/AuthenticationHeaderParser.js.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +4 -2
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +1 -1
- package/dist/request/RequestParameterBuilder.js.map +1 -1
- package/dist/request/RequestValidator.js +1 -1
- package/dist/request/RequestValidator.js.map +1 -1
- package/dist/request/ScopeSet.js +1 -1
- package/dist/request/ScopeSet.js.map +1 -1
- package/dist/response/ResponseHandler.d.ts +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.js +6 -5
- package/dist/response/ResponseHandler.js.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.js +8 -2
- package/dist/telemetry/performance/PerformanceClient.js.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +27 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.js +14 -1
- package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
- package/dist/url/UrlString.js +1 -1
- package/dist/url/UrlString.js.map +1 -1
- package/dist/utils/Constants.d.ts +3 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +4 -2
- package/dist/utils/Constants.js.map +1 -1
- package/dist/utils/ProtocolUtils.js +1 -1
- package/dist/utils/ProtocolUtils.js.map +1 -1
- package/dist/utils/StringUtils.js +1 -1
- package/dist/utils/StringUtils.js.map +1 -1
- package/dist/utils/TimeUtils.js +1 -1
- package/dist/utils/TimeUtils.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseHandler.js","sources":["../../src/response/ResponseHandler.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationTokenResponse } from \"./ServerAuthorizationTokenResponse\";\nimport { buildClientInfo} from \"../account/ClientInfo\";\nimport { ICrypto } from \"../crypto/ICrypto\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ServerAuthorizationCodeResponse } from \"./ServerAuthorizationCodeResponse\";\nimport { Logger } from \"../logger/Logger\";\nimport { ServerError } from \"../error/ServerError\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AuthenticationResult } from \"./AuthenticationResult\";\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\nimport { Authority } from \"../authority/Authority\";\nimport { AuthorityType } from \"../authority/AuthorityType\";\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\nimport { RefreshTokenEntity } from \"../cache/entities/RefreshTokenEntity\";\nimport { InteractionRequiredAuthError } from \"../error/InteractionRequiredAuthError\";\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\nimport { CacheManager } from \"../cache/CacheManager\";\nimport { ProtocolUtils, RequestStateObject } from \"../utils/ProtocolUtils\";\nimport { AuthenticationScheme, Constants, THE_FAMILY_ID } from \"../utils/Constants\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { AppMetadataEntity } from \"../cache/entities/AppMetadataEntity\";\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\nimport { TokenCacheContext } from \"../cache/persistence/TokenCacheContext\";\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\nimport { AuthorizationCodePayload } from \"./AuthorizationCodePayload\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\n\n/**\n * Class that handles response parsing.\n */\nexport class ResponseHandler {\n private clientId: string;\n private cacheStorage: CacheManager;\n private cryptoObj: ICrypto;\n private logger: Logger;\n private homeAccountIdentifier: string;\n private serializableCache: ISerializableTokenCache | null;\n private persistencePlugin: ICachePlugin | null;\n\n constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null) {\n this.clientId = clientId;\n this.cacheStorage = cacheStorage;\n this.cryptoObj = cryptoObj;\n this.logger = logger;\n this.serializableCache = serializableCache;\n this.persistencePlugin = persistencePlugin;\n }\n\n /**\n * Function which validates server authorization code response.\n * @param serverResponseHash\n * @param cachedState\n * @param cryptoObj\n */\n validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void {\n\n if (!serverResponseHash.state || !cachedState) {\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\n }\n\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\n throw ClientAuthError.createStateMismatchError();\n }\n\n // Check for error\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n if (serverResponseHash.client_info) {\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\n }\n }\n\n /**\n * Function which validates server authorization token response.\n * @param serverResponse\n */\n validateTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void {\n // Check for error\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);\n }\n\n const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;\n throw new ServerError(serverResponse.error, errString, serverResponse.suberror);\n }\n }\n\n /**\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\n * @param serverTokenResponse\n * @param authority\n */\n async handleServerTokenResponse(\n serverTokenResponse: ServerAuthorizationTokenResponse,\n authority: Authority,\n reqTimestamp: number,\n request: BaseAuthRequest,\n authCodePayload?: AuthorizationCodePayload,\n userAssertionHash?: string,\n handlingRefreshTokenResponse?: boolean): Promise<AuthenticationResult> {\n\n // create an idToken object (not entity)\n let idTokenObj: AuthToken | undefined;\n if (serverTokenResponse.id_token) {\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\n\n // token nonce check (TODO: Add a warning if no nonce is given?)\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\n throw ClientAuthError.createNonceMismatchError();\n }\n }\n }\n\n // generate homeAccountId\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\n\n // save the response tokens\n let requestStateObj: RequestStateObject | undefined;\n if (!!authCodePayload && !!authCodePayload.state) {\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\n }\n\n // Add keyId from request to serverTokenResponse if defined\n serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;\n\n const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);\n let cacheContext;\n try {\n if (this.persistencePlugin && this.serializableCache) {\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\n cacheContext = new TokenCacheContext(this.serializableCache, true);\n await this.persistencePlugin.beforeCacheAccess(cacheContext);\n }\n /*\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\n * If not present, we should return null, as it's the case that another application called removeAccount in between\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal.\n */\n if (handlingRefreshTokenResponse && cacheRecord.account) {\n const key = cacheRecord.account.generateAccountKey();\n const account = this.cacheStorage.getAccount(key);\n if (!account) {\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj);\n }\n }\n await this.cacheStorage.saveCacheRecord(cacheRecord);\n } finally {\n if (this.persistencePlugin && this.serializableCache && cacheContext) {\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\n await this.persistencePlugin.afterCacheAccess(cacheContext);\n }\n }\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code);\n }\n\n /**\n * Generates CacheRecord\n * @param serverTokenResponse\n * @param idTokenObj\n * @param authority\n */\n private generateCacheRecord(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, reqTimestamp: number, request: BaseAuthRequest, idTokenObj?: AuthToken, userAssertionHash?: string, authCodePayload?: AuthorizationCodePayload): CacheRecord {\n const env = authority.getPreferredCache();\n if (StringUtils.isEmpty(env)) {\n throw ClientAuthError.createInvalidCacheEnvironmentError();\n }\n\n // IdToken: non AAD scenarios can have empty realm\n let cachedIdToken: IdTokenEntity | undefined;\n let cachedAccount: AccountEntity | undefined;\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\n cachedIdToken = IdTokenEntity.createIdTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.id_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj.claims.tid || Constants.EMPTY_STRING,\n );\n\n cachedAccount = this.generateAccountEntity(\n serverTokenResponse,\n idTokenObj,\n authority,\n authCodePayload\n );\n }\n\n // AccessToken\n let cachedAccessToken: AccessTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\n\n // If scopes not returned in server response, use request scopes\n const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);\n\n /*\n * Use timestamp calculated before request\n * Server may return timestamps as strings, parse to numbers if so.\n */\n const expiresIn: number = (typeof serverTokenResponse.expires_in === \"string\" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;\n const extExpiresIn: number = (typeof serverTokenResponse.ext_expires_in === \"string\" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;\n const refreshIn: number | undefined = (typeof serverTokenResponse.refresh_in === \"string\" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\n const extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;\n const refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;\n\n // non AAD scenarios can have empty realm\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.access_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant,\n responseScopes.printScopes(),\n tokenExpirationSeconds,\n extendedTokenExpirationSeconds,\n this.cryptoObj,\n refreshOnSeconds,\n serverTokenResponse.token_type,\n userAssertionHash,\n serverTokenResponse.key_id,\n request.claims,\n request.requestedClaimsHash\n );\n }\n\n // refreshToken\n let cachedRefreshToken: RefreshTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.refresh_token || Constants.EMPTY_STRING,\n this.clientId,\n serverTokenResponse.foci,\n userAssertionHash\n );\n }\n\n // appMetadata\n let cachedAppMetadata: AppMetadataEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\n }\n\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\n }\n\n /**\n * Generate Account\n * @param serverTokenResponse\n * @param idToken\n * @param authority\n */\n private generateAccountEntity(serverTokenResponse: ServerAuthorizationTokenResponse, idToken: AuthToken, authority: Authority, authCodePayload?: AuthorizationCodePayload): AccountEntity {\n const authorityType = authority.authorityType;\n const cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;\n const msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;\n\n // ADFS does not require client_info in the response\n if (authorityType === AuthorityType.Adfs) {\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\n return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\n }\n\n // This fallback applies to B2C as well as they fall under an AAD account type.\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\n throw ClientAuthError.createClientInfoEmptyError();\n }\n\n return serverTokenResponse.client_info ?\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :\n AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\n }\n\n /**\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\n *\n * Optionally takes a state string that is set as-is in the response.\n *\n * @param cacheRecord\n * @param idTokenObj\n * @param fromTokenCache\n * @param stateString\n */\n static async generateAuthenticationResult(\n cryptoObj: ICrypto,\n authority: Authority,\n cacheRecord: CacheRecord,\n fromTokenCache: boolean,\n request: BaseAuthRequest,\n idTokenObj?: AuthToken,\n requestState?: RequestStateObject,\n code?: string\n ): Promise<AuthenticationResult> {\n let accessToken: string = Constants.EMPTY_STRING;\n let responseScopes: Array<string> = [];\n let expiresOn: Date | null = null;\n let extExpiresOn: Date | undefined;\n let familyId: string = Constants.EMPTY_STRING;\n\n if (cacheRecord.accessToken) {\n if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(cryptoObj);\n const { secret, keyId } = cacheRecord.accessToken;\n\n if (!keyId) {\n throw ClientAuthError.createKeyIdMissingError();\n }\n\n accessToken = await popTokenGenerator.signPopToken(secret, keyId, request);\n } else {\n accessToken = cacheRecord.accessToken.secret;\n }\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\n }\n\n if (cacheRecord.appMetadata) {\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\n }\n const uid = idTokenObj?.claims.oid || idTokenObj?.claims.sub || Constants.EMPTY_STRING;\n const tid = idTokenObj?.claims.tid || Constants.EMPTY_STRING;\n\n return {\n authority: authority.canonicalAuthority,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes,\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\n accessToken: accessToken,\n fromCache: fromTokenCache,\n expiresOn: expiresOn,\n correlationId: request.correlationId,\n extExpiresOn: extExpiresOn,\n familyId: familyId,\n tokenType: cacheRecord.accessToken?.tokenType || Constants.EMPTY_STRING,\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\n cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || Constants.EMPTY_STRING,\n msGraphHost: cacheRecord.account?.msGraphHost || Constants.EMPTY_STRING,\n code,\n fromNativeBroker: false\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AAmCA;;;;IAYI,yBAAY,QAAgB,EAAE,YAA0B,EAAE,SAAkB,EAAE,MAAc,EAAE,iBAAiD,EAAE,iBAAsC;QACnL,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;;;;;;;IAQD,iEAAuC,GAAvC,UAAwC,kBAAmD,EAAE,WAAmB,EAAE,SAAkB;QAEhI,IAAI,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE;YAC3C,MAAM,CAAC,kBAAkB,CAAC,KAAK,GAAG,eAAe,CAAC,wBAAwB,CAAC,cAAc,CAAC,GAAG,eAAe,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC;SACzJ;QAED,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,kBAAkB,CAAC,WAAW,CAAC,EAAE;YAClF,MAAM,eAAe,CAAC,wBAAwB,EAAE,CAAC;SACpD;;QAGD,IAAI,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,CAAC,iBAAiB,IAAI,kBAAkB,CAAC,QAAQ,EAAE;YACjG,IAAI,4BAA4B,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,CAAC,iBAAiB,EAAE,kB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AAY;gCACrF,WAAW,EAAE,OAAA,WAAW,CAAC,OAAO,0CAAE,WAAW,KAAI,SAAS,CAAC,YAAY;gCACvE,IAAI,MAAA;gCACJ,gBAAgB,EAAE,KAAK;6BAC1B,EAAC;;;;KACL;IACL,sBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ResponseHandler.js","sources":["../../src/response/ResponseHandler.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationTokenResponse } from \"./ServerAuthorizationTokenResponse\";\nimport { buildClientInfo} from \"../account/ClientInfo\";\nimport { ICrypto } from \"../crypto/ICrypto\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ServerAuthorizationCodeResponse } from \"./ServerAuthorizationCodeResponse\";\nimport { Logger } from \"../logger/Logger\";\nimport { ServerError } from \"../error/ServerError\";\nimport { AuthToken } from \"../account/AuthToken\";\nimport { ScopeSet } from \"../request/ScopeSet\";\nimport { AuthenticationResult } from \"./AuthenticationResult\";\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\nimport { Authority } from \"../authority/Authority\";\nimport { AuthorityType } from \"../authority/AuthorityType\";\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\nimport { RefreshTokenEntity } from \"../cache/entities/RefreshTokenEntity\";\nimport { InteractionRequiredAuthError } from \"../error/InteractionRequiredAuthError\";\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\nimport { CacheManager } from \"../cache/CacheManager\";\nimport { ProtocolUtils, RequestStateObject } from \"../utils/ProtocolUtils\";\nimport { AuthenticationScheme, Constants, THE_FAMILY_ID } from \"../utils/Constants\";\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\nimport { AppMetadataEntity } from \"../cache/entities/AppMetadataEntity\";\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\nimport { TokenCacheContext } from \"../cache/persistence/TokenCacheContext\";\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\nimport { AuthorizationCodePayload } from \"./AuthorizationCodePayload\";\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\n\n/**\n * Class that handles response parsing.\n */\nexport class ResponseHandler {\n private clientId: string;\n private cacheStorage: CacheManager;\n private cryptoObj: ICrypto;\n private logger: Logger;\n private homeAccountIdentifier: string;\n private serializableCache: ISerializableTokenCache | null;\n private persistencePlugin: ICachePlugin | null;\n\n constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null) {\n this.clientId = clientId;\n this.cacheStorage = cacheStorage;\n this.cryptoObj = cryptoObj;\n this.logger = logger;\n this.serializableCache = serializableCache;\n this.persistencePlugin = persistencePlugin;\n }\n\n /**\n * Function which validates server authorization code response.\n * @param serverResponseHash\n * @param cachedState\n * @param cryptoObj\n */\n validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void {\n\n if (!serverResponseHash.state || !cachedState) {\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\n }\n\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\n throw ClientAuthError.createStateMismatchError();\n }\n\n // Check for error\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\n }\n\n if (serverResponseHash.client_info) {\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\n }\n }\n\n /**\n * Function which validates server authorization token response.\n * @param serverResponse\n */\n validateTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void {\n // Check for error\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);\n }\n\n const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;\n throw new ServerError(serverResponse.error, errString, serverResponse.suberror);\n }\n }\n\n /**\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\n * @param serverTokenResponse\n * @param authority\n */\n async handleServerTokenResponse(\n serverTokenResponse: ServerAuthorizationTokenResponse,\n authority: Authority,\n reqTimestamp: number,\n request: BaseAuthRequest,\n authCodePayload?: AuthorizationCodePayload,\n userAssertionHash?: string,\n handlingRefreshTokenResponse?: boolean,\n forceCacheRefreshTokenResponse?: boolean): Promise<AuthenticationResult> {\n\n // create an idToken object (not entity)\n let idTokenObj: AuthToken | undefined;\n if (serverTokenResponse.id_token) {\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\n\n // token nonce check (TODO: Add a warning if no nonce is given?)\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\n throw ClientAuthError.createNonceMismatchError();\n }\n }\n }\n\n // generate homeAccountId\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\n\n // save the response tokens\n let requestStateObj: RequestStateObject | undefined;\n if (!!authCodePayload && !!authCodePayload.state) {\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\n }\n\n // Add keyId from request to serverTokenResponse if defined\n serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;\n\n const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);\n let cacheContext;\n try {\n if (this.persistencePlugin && this.serializableCache) {\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\n cacheContext = new TokenCacheContext(this.serializableCache, true);\n await this.persistencePlugin.beforeCacheAccess(cacheContext);\n }\n /*\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\n * If not present, we should return null, as it's the case that another application called removeAccount in between\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal, unless explicitly flagged by\n * the developer, as in the case of refresh token flow used in ADAL Node to MSAL Node migration.\n */\n if (handlingRefreshTokenResponse && !forceCacheRefreshTokenResponse && cacheRecord.account) {\n const key = cacheRecord.account.generateAccountKey();\n const account = this.cacheStorage.getAccount(key);\n if (!account) {\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined);\n }\n }\n await this.cacheStorage.saveCacheRecord(cacheRecord);\n } finally {\n if (this.persistencePlugin && this.serializableCache && cacheContext) {\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\n await this.persistencePlugin.afterCacheAccess(cacheContext);\n }\n }\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code);\n }\n\n /**\n * Generates CacheRecord\n * @param serverTokenResponse\n * @param idTokenObj\n * @param authority\n */\n private generateCacheRecord(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, reqTimestamp: number, request: BaseAuthRequest, idTokenObj?: AuthToken, userAssertionHash?: string, authCodePayload?: AuthorizationCodePayload): CacheRecord {\n const env = authority.getPreferredCache();\n if (StringUtils.isEmpty(env)) {\n throw ClientAuthError.createInvalidCacheEnvironmentError();\n }\n\n // IdToken: non AAD scenarios can have empty realm\n let cachedIdToken: IdTokenEntity | undefined;\n let cachedAccount: AccountEntity | undefined;\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\n cachedIdToken = IdTokenEntity.createIdTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.id_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj.claims.tid || Constants.EMPTY_STRING,\n );\n\n cachedAccount = this.generateAccountEntity(\n serverTokenResponse,\n idTokenObj,\n authority,\n authCodePayload\n );\n }\n\n // AccessToken\n let cachedAccessToken: AccessTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\n\n // If scopes not returned in server response, use request scopes\n const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);\n\n /*\n * Use timestamp calculated before request\n * Server may return timestamps as strings, parse to numbers if so.\n */\n const expiresIn: number = (typeof serverTokenResponse.expires_in === \"string\" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;\n const extExpiresIn: number = (typeof serverTokenResponse.ext_expires_in === \"string\" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;\n const refreshIn: number | undefined = (typeof serverTokenResponse.refresh_in === \"string\" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\n const extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;\n const refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;\n\n // non AAD scenarios can have empty realm\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.access_token || Constants.EMPTY_STRING,\n this.clientId,\n idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant,\n responseScopes.printScopes(),\n tokenExpirationSeconds,\n extendedTokenExpirationSeconds,\n this.cryptoObj,\n refreshOnSeconds,\n serverTokenResponse.token_type,\n userAssertionHash,\n serverTokenResponse.key_id,\n request.claims,\n request.requestedClaimsHash\n );\n }\n\n // refreshToken\n let cachedRefreshToken: RefreshTokenEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(\n this.homeAccountIdentifier,\n env,\n serverTokenResponse.refresh_token || Constants.EMPTY_STRING,\n this.clientId,\n serverTokenResponse.foci,\n userAssertionHash\n );\n }\n\n // appMetadata\n let cachedAppMetadata: AppMetadataEntity | null = null;\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\n }\n\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\n }\n\n /**\n * Generate Account\n * @param serverTokenResponse\n * @param idToken\n * @param authority\n */\n private generateAccountEntity(serverTokenResponse: ServerAuthorizationTokenResponse, idToken: AuthToken, authority: Authority, authCodePayload?: AuthorizationCodePayload): AccountEntity {\n const authorityType = authority.authorityType;\n const cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;\n const msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;\n\n // ADFS does not require client_info in the response\n if (authorityType === AuthorityType.Adfs) {\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\n return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\n }\n\n // This fallback applies to B2C as well as they fall under an AAD account type.\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\n throw ClientAuthError.createClientInfoEmptyError();\n }\n\n return serverTokenResponse.client_info ?\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :\n AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\n }\n\n /**\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\n *\n * Optionally takes a state string that is set as-is in the response.\n *\n * @param cacheRecord\n * @param idTokenObj\n * @param fromTokenCache\n * @param stateString\n */\n static async generateAuthenticationResult(\n cryptoObj: ICrypto,\n authority: Authority,\n cacheRecord: CacheRecord,\n fromTokenCache: boolean,\n request: BaseAuthRequest,\n idTokenObj?: AuthToken,\n requestState?: RequestStateObject,\n code?: string,\n ): Promise<AuthenticationResult> {\n let accessToken: string = Constants.EMPTY_STRING;\n let responseScopes: Array<string> = [];\n let expiresOn: Date | null = null;\n let extExpiresOn: Date | undefined;\n let familyId: string = Constants.EMPTY_STRING;\n\n if (cacheRecord.accessToken) {\n if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(cryptoObj);\n const { secret, keyId } = cacheRecord.accessToken;\n\n if (!keyId) {\n throw ClientAuthError.createKeyIdMissingError();\n }\n\n accessToken = await popTokenGenerator.signPopToken(secret, keyId, request);\n } else {\n accessToken = cacheRecord.accessToken.secret;\n }\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\n }\n\n if (cacheRecord.appMetadata) {\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\n }\n const uid = idTokenObj?.claims.oid || idTokenObj?.claims.sub || Constants.EMPTY_STRING;\n const tid = idTokenObj?.claims.tid || Constants.EMPTY_STRING;\n\n return {\n authority: authority.canonicalAuthority,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes,\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\n accessToken: accessToken,\n fromCache: fromTokenCache,\n expiresOn: expiresOn,\n correlationId: request.correlationId,\n extExpiresOn: extExpiresOn,\n familyId: familyId,\n tokenType: cacheRecord.accessToken?.tokenType || Constants.EMPTY_STRING,\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\n cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || Constants.EMPTY_STRING,\n msGraphHost: cacheRecord.account?.msGraphHost || Constants.EMPTY_STRING,\n code,\n fromNativeBroker: false\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;AAGG;AAgCH;;AAEG;AACH,IAAA,eAAA,kBAAA,YAAA;IASI,SAAY,eAAA,CAAA,QAAgB,EAAE,YAA0B,EAAE,SAAkB,EAAE,MAAc,EAAE,iBAAiD,EAAE,iBAAsC,EAAA;AACnL,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AAC3C,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;AAED;;;;;AAKG;AACH,IAAA,eAAA,CAAA,SAAA,CAAA,uCAAuC,GAAvC,UAAwC,kBAAmD,EAAE,WAAmB,EAAE,SAAkB,EAAA;AAEhI,QAAA,IAAI,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC,WAAW,EAAE;YAC3C,MAAM,CAA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AQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,oBAAoB;IAYxJ;;;;;;;OAOG;IACH,QAAQ,CAAC,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,uBAAuB;IAE1G;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,IAAI,MAAM;IAE7B;;;;;;OAMG;IACH,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,0BAA0B;IA0DpG;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,IAAI;IA6BhE;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IA8E9E;;;;OAIG;IACH,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAKhD;;;;;OAKG;IACH,sBAAsB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;IAQrE;;;;;OAKG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAYtD;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;CAStE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v7.
|
|
1
|
+
/*! @azure/msal-common v7.2.0 2022-07-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __assign } from '../../_virtual/_tslib.js';
|
|
4
4
|
import { PerformanceEventStatus } from './PerformanceEvent.js';
|
|
@@ -59,7 +59,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
59
59
|
clientId: this.clientId,
|
|
60
60
|
name: measureName,
|
|
61
61
|
startTimeMs: Date.now(),
|
|
62
|
-
correlationId: eventCorrelationId
|
|
62
|
+
correlationId: eventCorrelationId,
|
|
63
63
|
};
|
|
64
64
|
// Store in progress events so they can be discarded if not ended properly
|
|
65
65
|
this.cacheEventByCorrelationId(inProgressEvent);
|
|
@@ -204,6 +204,12 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
204
204
|
else {
|
|
205
205
|
_this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
|
|
206
206
|
}
|
|
207
|
+
if (current.accessTokenSize) {
|
|
208
|
+
previous.accessTokenSize = current.accessTokenSize;
|
|
209
|
+
}
|
|
210
|
+
if (current.idTokenSize) {
|
|
211
|
+
previous.idTokenSize = current.idTokenSize;
|
|
212
|
+
}
|
|
207
213
|
}
|
|
208
214
|
return previous;
|
|
209
215
|
}, topLevelEvent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceClient.js","sources":["../../../src/telemetry/performance/PerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ApplicationTelemetry } from \"../../config/ClientConfiguration\";\nimport { Logger } from \"../../logger/Logger\";\nimport { InProgressPerformanceEvent, IPerformanceClient, PerformanceCallbackFunction } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceEvent, PerformanceEvents, PerformanceEventStatus } from \"./PerformanceEvent\";\n\nexport abstract class PerformanceClient implements IPerformanceClient {\n protected authority: string;\n protected libraryName: string;\n protected libraryVersion: string;\n protected applicationTelemetry: ApplicationTelemetry;\n protected clientId: string;\n protected logger: Logger;\n protected callbacks: Map<string, PerformanceCallbackFunction>;\n \n /**\n * Multiple events with the same correlation id.\n * Double keyed by correlation id and event id.\n * @protected\n * @type {Map<string, Map<string, PerformanceEvent>>}\n */\n protected eventsByCorrelationId: Map<string, Map<string, PerformanceEvent>>;\n \n /**\n * Underlying performance measurements for each operation\n *\n * @protected\n * @type {Map<string, IPerformanceMeasurement>}\n */\n protected measurementsById: Map<string, IPerformanceMeasurement>;\n \n /**\n * Creates an instance of PerformanceClient, \n * an abstract class containing core performance telemetry logic.\n *\n * @constructor\n * @param {string} clientId Client ID of the application\n * @param {string} authority Authority used by the application\n * @param {Logger} logger Logger used by the application\n * @param {string} libraryName Name of the library\n * @param {string} libraryVersion Version of the library\n */\n constructor(clientId: string, authority: string, logger: Logger, libraryName: string, libraryVersion: string, applicationTelemetry: ApplicationTelemetry) {\n this.authority = authority;\n this.libraryName = libraryName;\n this.libraryVersion = libraryVersion;\n this.applicationTelemetry = applicationTelemetry;\n this.clientId = clientId;\n this.logger = logger;\n this.callbacks = new Map();\n this.eventsByCorrelationId = new Map();\n this.measurementsById = new Map();\n }\n \n /**\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\n *\n * @abstract\n * @param {string} measureName\n * @param {string} correlationId\n * @returns {IPerformanceMeasurement}\n */\n abstract startPerformanceMeasuremeant(measureName: string, correlationId: string): IPerformanceMeasurement;\n \n /**\n * Generates and returns a unique id, typically a guid.\n *\n * @abstract\n * @returns {string}\n */\n abstract generateId(): string;\n \n /**\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\n *\n * @param {PerformanceEvents} measureName\n * @param {?string} [correlationId]\n * @returns {InProgressPerformanceEvent}\n */\n startMeasurement(measureName: PerformanceEvents, correlationId?: string): InProgressPerformanceEvent {\n // Generate a placeholder correlation if the request does not provide one\n const eventCorrelationId = correlationId || this.generateId();\n if (!correlationId) {\n this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);\n }\n\n this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);\n const performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);\n performanceMeasurement.startMeasurement();\n\n const inProgressEvent: PerformanceEvent = {\n eventId: this.generateId(),\n status: PerformanceEventStatus.InProgress,\n authority: this.authority,\n libraryName: this.libraryName,\n libraryVersion: this.libraryVersion,\n appName: this.applicationTelemetry?.appName,\n appVersion: this.applicationTelemetry?.appVersion,\n clientId: this.clientId,\n name: measureName,\n startTimeMs: Date.now(),\n correlationId: eventCorrelationId\n };\n\n // Store in progress events so they can be discarded if not ended properly\n this.cacheEventByCorrelationId(inProgressEvent);\n this.cacheMeasurement(inProgressEvent, performanceMeasurement);\n\n // Return the event and functions the caller can use to properly end/flush the measurement\n return {\n endMeasurement: (event?: Partial<PerformanceEvent>): PerformanceEvent | null => {\n const completedEvent = this.endMeasurement({\n // Initial set of event properties\n ...inProgressEvent,\n // Properties set when event ends\n ...event\n });\n \n if (completedEvent) {\n // Cache event so that submeasurements can be added downstream\n this.cacheEventByCorrelationId(completedEvent);\n }\n \n return completedEvent;\n },\n flushMeasurement: () => {\n return this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);\n },\n discardMeasurement: () => {\n return this.discardMeasurements(inProgressEvent.correlationId);\n },\n measurement: performanceMeasurement,\n event: inProgressEvent\n };\n \n }\n \n /**\n * Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,\n * as consumers should instead use the function returned by startMeasurement.\n *\n * @param {PerformanceEvent} event\n * @returns {(PerformanceEvent | null)}\n */\n endMeasurement(event: PerformanceEvent): PerformanceEvent | null {\n const performanceMeasurement = this.measurementsById.get(event.eventId);\n if (performanceMeasurement) {\n // Immediately delete so that the same event isnt ended twice\n this.measurementsById.delete(event.eventId);\n performanceMeasurement.endMeasurement();\n const durationMs = performanceMeasurement.flushMeasurement();\n // null indicates no measurement was taken (e.g. needed performance APIs not present)\n if (durationMs !== null) {\n this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);\n \n const completedEvent: PerformanceEvent = {\n // Allow duration to be overwritten when event ends (e.g. testing), but not status\n durationMs: Math.round(durationMs),\n ...event,\n status: PerformanceEventStatus.Completed,\n };\n \n return completedEvent;\n } else {\n this.logger.trace(\"PerformanceClient: Performance measurement not taken\", event.correlationId);\n }\n } else {\n this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);\n }\n\n return null;\n }\n \n /**\n * Upserts event into event cache.\n * First key is the correlation id, second key is the event id.\n * Allows for events to be grouped by correlation id,\n * and to easily allow for properties on them to be updated.\n *\n * @private\n * @param {PerformanceEvent} event\n */\n private cacheEventByCorrelationId(event: PerformanceEvent) {\n const existingEvents = this.eventsByCorrelationId.get(event.correlationId);\n if (existingEvents) {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);\n existingEvents.set(event.eventId, event);\n } else {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);\n this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));\n }\n }\n \n /**\n * Cache measurements by their id.\n *\n * @private\n * @param {PerformanceEvent} event\n * @param {IPerformanceMeasurement} measurement\n */\n private cacheMeasurement(event: PerformanceEvent, measurement: IPerformanceMeasurement) {\n this.measurementsById.set(event.eventId, measurement);\n }\n \n /**\n * Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.\n *\n * @param {PerformanceEvents} measureName\n * @param {string} correlationId\n */\n flushMeasurements(measureName: PerformanceEvents, correlationId: string): void {\n this.logger.trace(`PerformanceClient: Performance measurements flushed for ${measureName}`, correlationId);\n const eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);\n if (eventsForCorrelationId) {\n this.discardMeasurements(correlationId);\n \n /*\n * Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.\n * Incomplete submeasurements are likely an instrumentation bug that should be fixed.\n * IE only supports Map.forEach.\n */\n const completedEvents: PerformanceEvent[] = [];\n eventsForCorrelationId.forEach(event => {\n if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {\n this.logger.trace(`PerformanceClient: Incomplete submeasurement ${event.name} found for ${measureName}`, correlationId);\n\n const completedEvent = this.endMeasurement(event);\n if (completedEvent) {\n completedEvents.push(completedEvent);\n }\n }\n\n completedEvents.push(event);\n });\n\n // Sort events by start time (earliest first)\n const sortedCompletedEvents = completedEvents.sort((eventA, eventB) => eventA.startTimeMs - eventB.startTimeMs);\n\n // Take completed top level event and add completed submeasurements durations as properties\n const topLevelEvents = sortedCompletedEvents.filter(event => event.name === measureName && event.status === PerformanceEventStatus.Completed);\n if (topLevelEvents.length > 0) {\n /*\n * Only take the first top-level event if there are multiple events with the same correlation id.\n * This greatly simplifies logic for submeasurements.\n */\n if (topLevelEvents.length > 1) {\n this.logger.verbose(\"PerformanceClient: Multiple distinct top-level performance events found, using the first\", correlationId);\n }\n const topLevelEvent = topLevelEvents[0];\n\n this.logger.verbose(`PerformanceClient: Measurement found for ${measureName}`, correlationId);\n\n // Build event object with top level and sub measurements\n const eventToEmit = sortedCompletedEvents.reduce((previous, current) => {\n if (current.name !== measureName) {\n this.logger.trace(`PerformanceClient: Complete submeasurement found for ${current.name}`, correlationId);\n // TODO: Emit additional properties for each subMeasurement\n const subMeasurementName = `${current.name}DurationMs`;\n /*\n * Some code paths, such as resolving an authority, can occur multiple times.\n * Only take the first measurement, since the second could be read from the cache,\n * or due to the same correlation id being used for two distinct requests.\n */\n if (!previous[subMeasurementName]) {\n previous[subMeasurementName] = current.durationMs;\n } else {\n this.logger.verbose(`PerformanceClient: Submeasurement for ${measureName} already exists for ${current.name}, ignoring`, correlationId);\n }\n }\n\n return previous;\n }, topLevelEvent);\n\n this.emitEvents([eventToEmit], eventToEmit.correlationId);\n } else {\n this.logger.verbose(`PerformanceClient: No completed top-level measurements found for ${measureName}`, correlationId);\n }\n } else {\n this.logger.verbose(\"PerformanceClient: No measurements found\", correlationId);\n }\n }\n \n /**\n * Removes measurements for a given correlation id.\n *\n * @param {string} correlationId\n */\n discardMeasurements(correlationId: string): void {\n this.logger.trace(\"PerformanceClient: Performance measurements discarded\", correlationId);\n this.eventsByCorrelationId.delete(correlationId);\n }\n \n /**\n * Registers a callback function to receive performance events.\n *\n * @param {PerformanceCallbackFunction} callback\n * @returns {string}\n */\n addPerformanceCallback(callback: PerformanceCallbackFunction): string {\n const callbackId = this.generateId();\n this.callbacks.set(callbackId, callback);\n this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);\n\n return callbackId;\n }\n \n /**\n * Removes a callback registered with addPerformanceCallback.\n *\n * @param {string} callbackId\n * @returns {boolean}\n */\n removePerformanceCallback(callbackId: string): boolean {\n const result = this.callbacks.delete(callbackId);\n\n if (result) {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);\n } else {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);\n }\n \n return result;\n }\n \n /**\n * Emits events to all registered callbacks.\n *\n * @param {PerformanceEvent[]} events\n * @param {?string} [correlationId]\n */\n emitEvents(events: PerformanceEvent[], correlationId: string): void {\n this.logger.verbose(\"PerformanceClient: Emitting performance events\", correlationId);\n\n this.callbacks.forEach((callback: PerformanceCallbackFunction, callbackId: string) => {\n this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);\n callback.apply(null, [events]);\n });\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;IA+CI,2BAAY,QAAgB,EAAE,SAAiB,EAAE,MAAc,EAAE,WAAmB,EAAE,cAAsB,EAAE,oBAA0C;QACpJ,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IAA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AI,CAAC,MAAM,CAAC,OAAO,CAAC,iEAA+D,UAAY,CAAC,CAAC;QAEjG,OAAO,UAAU,CAAC;KACrB;;;;;;;IAQD,qDAAyB,GAAzB,UAA0B,UAAkB;QACxC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,6CAA2C,UAAU,cAAW,CAAC,CAAC;SACzF;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,6CAA2C,UAAU,kBAAe,CAAC,CAAC;SAC7F;QAED,OAAO,MAAM,CAAC;KACjB;;;;;;;IAQD,sCAAU,GAAV,UAAW,MAA0B,EAAE,aAAqB;QAA5D,iBAOC;QANG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gDAAgD,EAAE,aAAa,CAAC,CAAC;QAErF,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAC,QAAqC,EAAE,UAAkB;YAC7E,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAiD,UAAY,EAAE,aAAa,CAAC,CAAC;YAChG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;SAClC,CAAC,CAAC;KACN;IACL,wBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"PerformanceClient.js","sources":["../../../src/telemetry/performance/PerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ApplicationTelemetry } from \"../../config/ClientConfiguration\";\nimport { Logger } from \"../../logger/Logger\";\nimport { InProgressPerformanceEvent, IPerformanceClient, PerformanceCallbackFunction } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceEvent, PerformanceEvents, PerformanceEventStatus } from \"./PerformanceEvent\";\n\nexport abstract class PerformanceClient implements IPerformanceClient {\n protected authority: string;\n protected libraryName: string;\n protected libraryVersion: string;\n protected applicationTelemetry: ApplicationTelemetry;\n protected clientId: string;\n protected logger: Logger;\n protected callbacks: Map<string, PerformanceCallbackFunction>;\n\n /**\n * Multiple events with the same correlation id.\n * Double keyed by correlation id and event id.\n * @protected\n * @type {Map<string, Map<string, PerformanceEvent>>}\n */\n protected eventsByCorrelationId: Map<string, Map<string, PerformanceEvent>>;\n\n /**\n * Underlying performance measurements for each operation\n *\n * @protected\n * @type {Map<string, IPerformanceMeasurement>}\n */\n protected measurementsById: Map<string, IPerformanceMeasurement>;\n\n /**\n * Creates an instance of PerformanceClient, \n * an abstract class containing core performance telemetry logic.\n *\n * @constructor\n * @param {string} clientId Client ID of the application\n * @param {string} authority Authority used by the application\n * @param {Logger} logger Logger used by the application\n * @param {string} libraryName Name of the library\n * @param {string} libraryVersion Version of the library\n */\n constructor(clientId: string, authority: string, logger: Logger, libraryName: string, libraryVersion: string, applicationTelemetry: ApplicationTelemetry) {\n this.authority = authority;\n this.libraryName = libraryName;\n this.libraryVersion = libraryVersion;\n this.applicationTelemetry = applicationTelemetry;\n this.clientId = clientId;\n this.logger = logger;\n this.callbacks = new Map();\n this.eventsByCorrelationId = new Map();\n this.measurementsById = new Map();\n }\n\n /**\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\n *\n * @abstract\n * @param {string} measureName\n * @param {string} correlationId\n * @returns {IPerformanceMeasurement}\n */\n abstract startPerformanceMeasuremeant(measureName: string, correlationId: string): IPerformanceMeasurement;\n\n /**\n * Generates and returns a unique id, typically a guid.\n *\n * @abstract\n * @returns {string}\n */\n abstract generateId(): string;\n\n /**\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\n *\n * @param {PerformanceEvents} measureName\n * @param {?string} [correlationId]\n * @returns {InProgressPerformanceEvent}\n */\n startMeasurement(measureName: PerformanceEvents, correlationId?: string): InProgressPerformanceEvent {\n // Generate a placeholder correlation if the request does not provide one\n const eventCorrelationId = correlationId || this.generateId();\n if (!correlationId) {\n this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);\n }\n\n this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);\n const performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);\n performanceMeasurement.startMeasurement();\n\n const inProgressEvent: PerformanceEvent = {\n eventId: this.generateId(),\n status: PerformanceEventStatus.InProgress,\n authority: this.authority,\n libraryName: this.libraryName,\n libraryVersion: this.libraryVersion,\n appName: this.applicationTelemetry?.appName,\n appVersion: this.applicationTelemetry?.appVersion,\n clientId: this.clientId,\n name: measureName,\n startTimeMs: Date.now(),\n correlationId: eventCorrelationId,\n };\n\n // Store in progress events so they can be discarded if not ended properly\n this.cacheEventByCorrelationId(inProgressEvent);\n this.cacheMeasurement(inProgressEvent, performanceMeasurement);\n\n // Return the event and functions the caller can use to properly end/flush the measurement\n return {\n endMeasurement: (event?: Partial<PerformanceEvent>): PerformanceEvent | null => {\n const completedEvent = this.endMeasurement({\n // Initial set of event properties\n ...inProgressEvent,\n // Properties set when event ends\n ...event\n });\n\n if (completedEvent) {\n // Cache event so that submeasurements can be added downstream\n this.cacheEventByCorrelationId(completedEvent);\n }\n\n return completedEvent;\n },\n flushMeasurement: () => {\n return this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);\n },\n discardMeasurement: () => {\n return this.discardMeasurements(inProgressEvent.correlationId);\n },\n measurement: performanceMeasurement,\n event: inProgressEvent\n };\n\n }\n\n /**\n * Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,\n * as consumers should instead use the function returned by startMeasurement.\n *\n * @param {PerformanceEvent} event\n * @returns {(PerformanceEvent | null)}\n */\n endMeasurement(event: PerformanceEvent): PerformanceEvent | null {\n const performanceMeasurement = this.measurementsById.get(event.eventId);\n if (performanceMeasurement) {\n // Immediately delete so that the same event isnt ended twice\n this.measurementsById.delete(event.eventId);\n performanceMeasurement.endMeasurement();\n const durationMs = performanceMeasurement.flushMeasurement();\n // null indicates no measurement was taken (e.g. needed performance APIs not present)\n if (durationMs !== null) {\n this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);\n\n const completedEvent: PerformanceEvent = {\n // Allow duration to be overwritten when event ends (e.g. testing), but not status\n durationMs: Math.round(durationMs),\n ...event,\n status: PerformanceEventStatus.Completed,\n };\n\n return completedEvent;\n } else {\n this.logger.trace(\"PerformanceClient: Performance measurement not taken\", event.correlationId);\n }\n } else {\n this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);\n }\n\n return null;\n }\n\n /**\n * Upserts event into event cache.\n * First key is the correlation id, second key is the event id.\n * Allows for events to be grouped by correlation id,\n * and to easily allow for properties on them to be updated.\n *\n * @private\n * @param {PerformanceEvent} event\n */\n private cacheEventByCorrelationId(event: PerformanceEvent) {\n const existingEvents = this.eventsByCorrelationId.get(event.correlationId);\n if (existingEvents) {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);\n existingEvents.set(event.eventId, event);\n } else {\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);\n this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));\n }\n }\n\n /**\n * Cache measurements by their id.\n *\n * @private\n * @param {PerformanceEvent} event\n * @param {IPerformanceMeasurement} measurement\n */\n private cacheMeasurement(event: PerformanceEvent, measurement: IPerformanceMeasurement) {\n this.measurementsById.set(event.eventId, measurement);\n }\n\n /**\n * Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.\n *\n * @param {PerformanceEvents} measureName\n * @param {string} correlationId\n */\n flushMeasurements(measureName: PerformanceEvents, correlationId: string): void {\n this.logger.trace(`PerformanceClient: Performance measurements flushed for ${measureName}`, correlationId);\n const eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);\n if (eventsForCorrelationId) {\n this.discardMeasurements(correlationId);\n\n /*\n * Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.\n * Incomplete submeasurements are likely an instrumentation bug that should be fixed.\n * IE only supports Map.forEach.\n */\n const completedEvents: PerformanceEvent[] = [];\n eventsForCorrelationId.forEach(event => {\n if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {\n this.logger.trace(`PerformanceClient: Incomplete submeasurement ${event.name} found for ${measureName}`, correlationId);\n\n const completedEvent = this.endMeasurement(event);\n if (completedEvent) {\n completedEvents.push(completedEvent);\n }\n }\n\n completedEvents.push(event);\n });\n\n // Sort events by start time (earliest first)\n const sortedCompletedEvents = completedEvents.sort((eventA, eventB) => eventA.startTimeMs - eventB.startTimeMs);\n\n // Take completed top level event and add completed submeasurements durations as properties\n const topLevelEvents = sortedCompletedEvents.filter(event => event.name === measureName && event.status === PerformanceEventStatus.Completed);\n if (topLevelEvents.length > 0) {\n /*\n * Only take the first top-level event if there are multiple events with the same correlation id.\n * This greatly simplifies logic for submeasurements.\n */\n if (topLevelEvents.length > 1) {\n this.logger.verbose(\"PerformanceClient: Multiple distinct top-level performance events found, using the first\", correlationId);\n }\n const topLevelEvent = topLevelEvents[0];\n\n this.logger.verbose(`PerformanceClient: Measurement found for ${measureName}`, correlationId);\n\n // Build event object with top level and sub measurements\n const eventToEmit = sortedCompletedEvents.reduce((previous, current) => {\n if (current.name !== measureName) {\n this.logger.trace(`PerformanceClient: Complete submeasurement found for ${current.name}`, correlationId);\n // TODO: Emit additional properties for each subMeasurement\n const subMeasurementName = `${current.name}DurationMs`;\n /*\n * Some code paths, such as resolving an authority, can occur multiple times.\n * Only take the first measurement, since the second could be read from the cache,\n * or due to the same correlation id being used for two distinct requests.\n */\n if (!previous[subMeasurementName]) {\n previous[subMeasurementName] = current.durationMs;\n } else {\n this.logger.verbose(`PerformanceClient: Submeasurement for ${measureName} already exists for ${current.name}, ignoring`, correlationId);\n }\n if (current.accessTokenSize) {\n previous.accessTokenSize = current.accessTokenSize;\n }\n if (current.idTokenSize) {\n previous.idTokenSize = current.idTokenSize;\n }\n }\n\n return previous;\n }, topLevelEvent);\n\n this.emitEvents([eventToEmit], eventToEmit.correlationId);\n } else {\n this.logger.verbose(`PerformanceClient: No completed top-level measurements found for ${measureName}`, correlationId);\n }\n } else {\n this.logger.verbose(\"PerformanceClient: No measurements found\", correlationId);\n }\n }\n\n /**\n * Removes measurements for a given correlation id.\n *\n * @param {string} correlationId\n */\n discardMeasurements(correlationId: string): void {\n this.logger.trace(\"PerformanceClient: Performance measurements discarded\", correlationId);\n this.eventsByCorrelationId.delete(correlationId);\n }\n\n /**\n * Registers a callback function to receive performance events.\n *\n * @param {PerformanceCallbackFunction} callback\n * @returns {string}\n */\n addPerformanceCallback(callback: PerformanceCallbackFunction): string {\n const callbackId = this.generateId();\n this.callbacks.set(callbackId, callback);\n this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);\n\n return callbackId;\n }\n\n /**\n * Removes a callback registered with addPerformanceCallback.\n *\n * @param {string} callbackId\n * @returns {boolean}\n */\n removePerformanceCallback(callbackId: string): boolean {\n const result = this.callbacks.delete(callbackId);\n\n if (result) {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);\n } else {\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);\n }\n\n return result;\n }\n\n /**\n * Emits events to all registered callbacks.\n *\n * @param {PerformanceEvent[]} events\n * @param {?string} [correlationId]\n */\n emitEvents(events: PerformanceEvent[], correlationId: string): void {\n this.logger.verbose(\"PerformanceClient: Emitting performance events\", correlationId);\n\n this.callbacks.forEach((callback: PerformanceCallbackFunction, callbackId: string) => {\n this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);\n callback.apply(null, [events]);\n });\n }\n\n}\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAQH,IAAA,iBAAA,kBAAA,YAAA;AAyBI;;;;;;;;;;AAUG;IACH,SAAY,iBAAA,CAAA,QAAgB,EAAE,SAAiB,EAAE,MAAc,E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AC,gDAAgD,EAAE,aAAa,CAAC,CAAC;QAErF,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAC,QAAqC,EAAE,UAAkB,EAAA;YAC7E,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAiD,UAAY,EAAE,aAAa,CAAC,CAAC;YAChG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACnC,SAAC,CAAC,CAAC;KACN,CAAA;IAEL,OAAC,iBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
|
|
@@ -74,7 +74,20 @@ export declare enum PerformanceEvents {
|
|
|
74
74
|
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
75
75
|
* Used to acquire a token from Native component when native brokering is enabled.
|
|
76
76
|
*/
|
|
77
|
-
NativeInteractionClientAcquireToken = "nativeInteractionClientAcquireToken"
|
|
77
|
+
NativeInteractionClientAcquireToken = "nativeInteractionClientAcquireToken",
|
|
78
|
+
/**
|
|
79
|
+
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
80
|
+
*/
|
|
81
|
+
BrokerHandhshake = "brokerHandshake",
|
|
82
|
+
/**
|
|
83
|
+
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
84
|
+
*/
|
|
85
|
+
AcquireTokenByRefreshTokenInBroker = "acquireTokenByRefreshTokenInBroker",
|
|
86
|
+
/**
|
|
87
|
+
* acquireToken API in BrokerClientApplication.
|
|
88
|
+
* Used to acquire a token on behalf of the embedded application (PW-Broker).
|
|
89
|
+
*/
|
|
90
|
+
AcquireTokenByBroker = "acquireTokenByBroker"
|
|
78
91
|
}
|
|
79
92
|
/**
|
|
80
93
|
* State of the performance event.
|
|
@@ -193,6 +206,19 @@ export declare type PerformanceEvent = {
|
|
|
193
206
|
* @type {string}
|
|
194
207
|
*/
|
|
195
208
|
libraryVersion: string;
|
|
209
|
+
/**
|
|
210
|
+
* Size of the id token
|
|
211
|
+
*
|
|
212
|
+
* @type {number}
|
|
213
|
+
*/
|
|
214
|
+
idTokenSize?: number;
|
|
215
|
+
/**
|
|
216
|
+
*
|
|
217
|
+
* Size of the access token
|
|
218
|
+
*
|
|
219
|
+
* @type {number}
|
|
220
|
+
*/
|
|
221
|
+
accessTokenSize?: number;
|
|
196
222
|
/**
|
|
197
223
|
* Application name as specified by the app.
|
|
198
224
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceEvent.d.ts","sourceRoot":"","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,oBAAY,iBAAiB;IAEzB;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,0BAA0B,+BAA+B;IAEzD;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,uBAAuB,4BAA4B;IAEnD;;;OAGG;IACH,iBAAiB,sBAAsB;IAEvC;;;OAGG;IACH,gCAAgC,qCAAqC;IAErE;;;OAGG;IACH,iBAAiB,sBAAsB;IAEvC;;;OAGG;IACH,6BAA6B,kCAAkC;IAE/D;;;OAGG;IACH,8BAA8B,mCAAmC;IAEjE;;;OAGG;IACH,+BAA+B,oCAAoC;IAEnE;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,+CAA+C,oDAAoD;IAEnG;;;OAGG;IACH,8BAA8B,mCAAmC;IAEjE;;;OAGG;IACH,mCAAmC,wCAAwC;
|
|
1
|
+
{"version":3,"file":"PerformanceEvent.d.ts","sourceRoot":"","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,oBAAY,iBAAiB;IAEzB;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,0BAA0B,+BAA+B;IAEzD;;;OAGG;IACH,kBAAkB,uBAAuB;IAEzC;;;OAGG;IACH,uBAAuB,4BAA4B;IAEnD;;;OAGG;IACH,iBA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;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IAEH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v7.
|
|
1
|
+
/*! @azure/msal-common v7.2.0 2022-07-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
/*
|
|
4
4
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -82,6 +82,19 @@ var PerformanceEvents;
|
|
|
82
82
|
* Used to acquire a token from Native component when native brokering is enabled.
|
|
83
83
|
*/
|
|
84
84
|
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
85
|
+
/**
|
|
86
|
+
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
87
|
+
*/
|
|
88
|
+
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
|
|
89
|
+
/**
|
|
90
|
+
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
91
|
+
*/
|
|
92
|
+
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
93
|
+
/**
|
|
94
|
+
* acquireToken API in BrokerClientApplication.
|
|
95
|
+
* Used to acquire a token on behalf of the embedded application (PW-Broker).
|
|
96
|
+
*/
|
|
97
|
+
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
85
98
|
})(PerformanceEvents || (PerformanceEvents = {}));
|
|
86
99
|
/**
|
|
87
100
|
* State of the performance event.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerformanceEvent.js","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEvents {\n\n /**\n * acquireTokenByCode API (msal-browser and msal-node).\n * Used to acquire tokens by trading an authorization code against the token endpoint.\n */\n AcquireTokenByCode = \"acquireTokenByCode\",\n\n /**\n * acquireTokenByRefreshToken API (msal-browser and msal-node).\n * Used to renew an access token using a refresh token against the token endpoint.\n */\n AcquireTokenByRefreshToken = \"acquireTokenByRefreshToken\",\n\n /**\n * acquireTokenSilent API (msal-browser and msal-node).\n * Used to silently acquire a new access token (from the cache or the network).\n */\n AcquireTokenSilent = \"acquireTokenSilent\",\n\n /**\n * acquireTokenSilentAsync (msal-browser).\n * Internal API for acquireTokenSilent.\n */\n AcquireTokenSilentAsync = \"acquireTokenSilentAsync\",\n\n /**\n * acquireTokenPopup (msal-browser).\n * Used to acquire a new access token interactively through pop ups\n */\n AcquireTokenPopup = \"acquireTokenPopup\",\n\n /**\n * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).\n * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.\n */\n CryptoOptsGetPublicKeyThumbprint = \"cryptoOptsGetPublicKeyThumbprint\",\n\n /**\n * signJwt API in CryptoOpts class (msal-browser).\n * Used to signed a pop token.\n */\n CryptoOptsSignJwt = \"cryptoOptsSignJwt\",\n\n /**\n * acquireToken API in the SilentCacheClient class (msal-browser).\n * Used to read access tokens from the cache.\n */\n SilentCacheClientAcquireToken = \"silentCacheClientAcquireToken\",\n\n /**\n * acquireToken API in the SilentIframeClient class (msal-browser).\n * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.\n */\n SilentIframeClientAcquireToken = \"silentIframeClientAcquireToken\",\n\n /**\n * acquireToken API in SilentRereshClient (msal-browser).\n * Used to acquire a new set of tokens from the token endpoint using a refresh token.\n */\n SilentRefreshClientAcquireToken = \"silentRefreshClientAcquireToken\",\n\n /**\n * ssoSilent API (msal-browser).\n * Used to silently acquire an authorization code and set of tokens using a hidden iframe.\n */\n SsoSilent = \"ssoSilent\",\n\n /**\n * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).\n * Used to load authority metadata for a request.\n */\n StandardInteractionClientGetDiscoveredAuthority = \"standardInteractionClientGetDiscoveredAuthority\",\n\n /**\n * acquireToken APIs in msal-browser.\n * Used to make an /authorize endpoint call with native brokering enabled.\n */\n FetchAccountIdWithNativeBroker = \"fetchAccountIdWithNativeBroker\",\n\n /**\n * acquireToken API in NativeInteractionClient class (msal-browser).\n * Used to acquire a token from Native component when native brokering is enabled.\n */\n NativeInteractionClientAcquireToken = \"nativeInteractionClientAcquireToken\",\n}\n\n/**\n * State of the performance event.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEventStatus {\n NotStarted,\n InProgress,\n Completed\n}\n\n/**\n * Performance measurement taken by the library, including metadata about the request and application.\n *\n * @export\n * @typedef {PerformanceEvent}\n */\nexport type PerformanceEvent = {\n /**\n * Unique id for the event\n *\n * @type {string}\n */\n eventId: string,\n\n /**\n * State of the perforance measure.\n *\n * @type {PerformanceEventStatus}\n */\n status: PerformanceEventStatus,\n\n /**\n * Login authority used for the request\n *\n * @type {string}\n */\n authority: string,\n\n /**\n * Client id for the application\n *\n * @type {string}\n */\n clientId: string\n\n /**\n * Correlation ID used for the request\n *\n * @type {string}\n */\n correlationId: string,\n\n /**\n * End-to-end duration in milliseconds.\n * @date 3/22/2022 - 3:40:05 PM\n *\n * @type {number}\n */\n durationMs?: number,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n endPageVisibility?: string | null,\n\n /**\n * Whether the result was retrieved from the cache.\n *\n * @type {(boolean | null)}\n */\n fromCache?: boolean | null,\n\n /**\n * Event name (usually in the form of classNameFunctionName)\n *\n * @type {PerformanceEvents}\n */\n name: PerformanceEvents,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n startPageVisibility?: string | null,\n\n /**\n * Unix millisecond timestamp when the event was initiated.\n *\n * @type {number}\n */\n startTimeMs: number,\n\n /**\n * Whether or the operation completed successfully.\n *\n * @type {(boolean | null)}\n */\n success?: boolean | null,\n\n /**\n * Add specific error code in case of failure\n *\n * @type {string}\n */\n errorCode?: string,\n\n /**\n * Add specific sub error code in case of failure\n *\n * @type {string}\n */\n subErrorCode?: string,\n\n /**\n * Name of the library used for the operation.\n *\n * @type {string}\n */\n libraryName: string,\n\n /**\n * Version of the library used for the operation.\n *\n * @type {string}\n */\n libraryVersion: string,\n\n /**\n * Application name as specified by the app.\n *\n * @type {?string}\n */\n appName?: string,\n\n /**\n * Application version as specified by the app.\n *\n * @type {?string}\n */\n appVersion?: string,\n\n /**\n * Whether the response is from a native component (e.g., WAM)\n *\n * @type {?boolean}\n */\n isNativeBroker?: boolean\n};\n"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"PerformanceEvent.js","sources":["../../../src/telemetry/performance/PerformanceEvent.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEvents {\n\n /**\n * acquireTokenByCode API (msal-browser and msal-node).\n * Used to acquire tokens by trading an authorization code against the token endpoint.\n */\n AcquireTokenByCode = \"acquireTokenByCode\",\n\n /**\n * acquireTokenByRefreshToken API (msal-browser and msal-node).\n * Used to renew an access token using a refresh token against the token endpoint.\n */\n AcquireTokenByRefreshToken = \"acquireTokenByRefreshToken\",\n\n /**\n * acquireTokenSilent API (msal-browser and msal-node).\n * Used to silently acquire a new access token (from the cache or the network).\n */\n AcquireTokenSilent = \"acquireTokenSilent\",\n\n /**\n * acquireTokenSilentAsync (msal-browser).\n * Internal API for acquireTokenSilent.\n */\n AcquireTokenSilentAsync = \"acquireTokenSilentAsync\",\n\n /**\n * acquireTokenPopup (msal-browser).\n * Used to acquire a new access token interactively through pop ups\n */\n AcquireTokenPopup = \"acquireTokenPopup\",\n\n /**\n * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).\n * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.\n */\n CryptoOptsGetPublicKeyThumbprint = \"cryptoOptsGetPublicKeyThumbprint\",\n\n /**\n * signJwt API in CryptoOpts class (msal-browser).\n * Used to signed a pop token.\n */\n CryptoOptsSignJwt = \"cryptoOptsSignJwt\",\n\n /**\n * acquireToken API in the SilentCacheClient class (msal-browser).\n * Used to read access tokens from the cache.\n */\n SilentCacheClientAcquireToken = \"silentCacheClientAcquireToken\",\n\n /**\n * acquireToken API in the SilentIframeClient class (msal-browser).\n * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.\n */\n SilentIframeClientAcquireToken = \"silentIframeClientAcquireToken\",\n\n /**\n * acquireToken API in SilentRereshClient (msal-browser).\n * Used to acquire a new set of tokens from the token endpoint using a refresh token.\n */\n SilentRefreshClientAcquireToken = \"silentRefreshClientAcquireToken\",\n\n /**\n * ssoSilent API (msal-browser).\n * Used to silently acquire an authorization code and set of tokens using a hidden iframe.\n */\n SsoSilent = \"ssoSilent\",\n\n /**\n * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).\n * Used to load authority metadata for a request.\n */\n StandardInteractionClientGetDiscoveredAuthority = \"standardInteractionClientGetDiscoveredAuthority\",\n\n /**\n * acquireToken APIs in msal-browser.\n * Used to make an /authorize endpoint call with native brokering enabled.\n */\n FetchAccountIdWithNativeBroker = \"fetchAccountIdWithNativeBroker\",\n\n /**\n * acquireToken API in NativeInteractionClient class (msal-browser).\n * Used to acquire a token from Native component when native brokering is enabled.\n */\n NativeInteractionClientAcquireToken = \"nativeInteractionClientAcquireToken\",\n\n /**\n * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).\n */\n BrokerHandhshake = \"brokerHandshake\",\n\n /**\n * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .\n */\n AcquireTokenByRefreshTokenInBroker = \"acquireTokenByRefreshTokenInBroker\",\n\n /**\n * acquireToken API in BrokerClientApplication.\n * Used to acquire a token on behalf of the embedded application (PW-Broker).\n */\n AcquireTokenByBroker = \"acquireTokenByBroker\"\n}\n\n/**\n * State of the performance event.\n *\n * @export\n * @enum {number}\n */\nexport enum PerformanceEventStatus {\n NotStarted,\n InProgress,\n Completed\n}\n\n/**\n * Performance measurement taken by the library, including metadata about the request and application.\n *\n * @export\n * @typedef {PerformanceEvent}\n */\nexport type PerformanceEvent = {\n /**\n * Unique id for the event\n *\n * @type {string}\n */\n eventId: string,\n\n /**\n * State of the perforance measure.\n *\n * @type {PerformanceEventStatus}\n */\n status: PerformanceEventStatus,\n\n /**\n * Login authority used for the request\n *\n * @type {string}\n */\n authority: string,\n\n /**\n * Client id for the application\n *\n * @type {string}\n */\n clientId: string\n\n /**\n * Correlation ID used for the request\n *\n * @type {string}\n */\n correlationId: string,\n\n /**\n * End-to-end duration in milliseconds.\n * @date 3/22/2022 - 3:40:05 PM\n *\n * @type {number}\n */\n durationMs?: number,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n endPageVisibility?: string | null,\n\n /**\n * Whether the result was retrieved from the cache.\n *\n * @type {(boolean | null)}\n */\n fromCache?: boolean | null,\n\n /**\n * Event name (usually in the form of classNameFunctionName)\n *\n * @type {PerformanceEvents}\n */\n name: PerformanceEvents,\n\n /**\n * Visibility of the page when the event completed.\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\n *\n * @type {?(string | null)}\n */\n startPageVisibility?: string | null,\n\n /**\n * Unix millisecond timestamp when the event was initiated.\n *\n * @type {number}\n */\n startTimeMs: number,\n\n /**\n * Whether or the operation completed successfully.\n *\n * @type {(boolean | null)}\n */\n success?: boolean | null,\n\n /**\n * Add specific error code in case of failure\n *\n * @type {string}\n */\n errorCode?: string,\n\n /**\n * Add specific sub error code in case of failure\n *\n * @type {string}\n */\n subErrorCode?: string,\n\n /**\n * Name of the library used for the operation.\n *\n * @type {string}\n */\n libraryName: string,\n\n /**\n * Version of the library used for the operation.\n *\n * @type {string}\n */\n libraryVersion: string,\n\n /**\n * Size of the id token\n *\n * @type {number}\n */\n idTokenSize?: number,\n\n /**\n * \n * Size of the access token\n *\n * @type {number}\n */\n\n accessTokenSize?: number,\n\n /**\n * Application name as specified by the app.\n *\n * @type {?string}\n */\n appName?: string,\n\n /**\n * Application version as specified by the app.\n *\n * @type {?string}\n */\n appVersion?: string,\n\n /**\n * Whether the response is from a native component (e.g., WAM)\n *\n * @type {?boolean}\n */\n isNativeBroker?: boolean\n};\n"],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;;;;AAKG;IACS,kBAqGX;AArGD,CAAA,UAAY,iBAAiB,EAAA;AAEzB;;;AAGG;AACH,IAAA,iBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,CAAA;AAEzC;;;AAGG;AACH,IAAA,iBAAA,CAAA,4BAAA,CAAA,GAAA,4BAAyD,CAAA;AAEzD;;;AAGG;AACH,IAAA,iBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,CAAA;AAEzC;;;AAGG;AACH,IAAA,iBAAA,CAAA,yBAAA,CAAA,GAAA,yBAAmD,CAAA;AAEnD;;;AAGG;AACH,IAAA,iBAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AAEvC;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AAA,CAAA,GAAA,WAAS,CAAA;AACb,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,GAIjC,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StubPerformanceClient.js","sources":["../../../src/telemetry/performance/StubPerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IPerformanceClient } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceClient } from \"./PerformanceClient\";\n\nexport class StubPerformanceMeasurement implements IPerformanceMeasurement {\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n startMeasurement(): void { }\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n endMeasurement(): void { }\n flushMeasurement(): number | null {\n return null;\n }\n \n}\n\nexport class StubPerformanceClient extends PerformanceClient implements IPerformanceClient {\n generateId(): string {\n return \"callback-id\";\n }\n \n startPerformanceMeasuremeant(): IPerformanceMeasurement {\n return new StubPerformanceMeasurement();\n }\n}\n"],"names":[],"mappings":";;;;;AAAA
|
|
1
|
+
{"version":3,"file":"StubPerformanceClient.js","sources":["../../../src/telemetry/performance/StubPerformanceClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IPerformanceClient } from \"./IPerformanceClient\";\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\nimport { PerformanceClient } from \"./PerformanceClient\";\n\nexport class StubPerformanceMeasurement implements IPerformanceMeasurement {\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n startMeasurement(): void { }\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n endMeasurement(): void { }\n flushMeasurement(): number | null {\n return null;\n }\n \n}\n\nexport class StubPerformanceClient extends PerformanceClient implements IPerformanceClient {\n generateId(): string {\n return \"callback-id\";\n }\n \n startPerformanceMeasuremeant(): IPerformanceMeasurement {\n return new StubPerformanceMeasurement();\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAMH,IAAA,0BAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,0BAAA,GAAA;KASC;;IAPG,0BAAgB,CAAA,SAAA,CAAA,gBAAA,GAAhB,eAA4B,CAAA;;IAE5B,0BAAc,CAAA,SAAA,CAAA,cAAA,GAAd,eAA0B,CAAA;AAC1B,IAAA,0BAAA,CAAA,SAAA,CAAA,gBAAgB,GAAhB,YAAA;AACI,QAAA,OAAO,IAAI,CAAC;KACf,CAAA;IAEL,OAAC,0BAAA,CAAA;AAAD,CAAC,EAAA,EAAA;AAED,IAAA,qBAAA,kBAAA,UAAA,MAAA,EAAA;IAA2C,SAAiB,CAAA,qBAAA,EAAA,MAAA,CAAA,CAAA;AAA5D,IAAA,SAAA,qBAAA,GAAA;;KAQC;AAPG,IAAA,qBAAA,CAAA,SAAA,CAAA,UAAU,GAAV,YAAA;AACI,QAAA,OAAO,aAAa,CAAC;KACxB,CAAA;AAED,IAAA,qBAAA,CAAA,SAAA,CAAA,4BAA4B,GAA5B,YAAA;QACI,OAAO,IAAI,0BAA0B,EAAE,CAAC;KAC3C,CAAA;IACL,OAAC,qBAAA,CAAA;AAAD,CARA,CAA2C,iBAAiB,CAQ3D;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v7.
|
|
1
|
+
/*! @azure/msal-common v7.2.0 2022-07-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { SERVER_TELEM_CONSTANTS, CacheOutcome, Constants, Separators } from '../../utils/Constants.js';
|
|
4
4
|
import { ServerTelemetryEntity } from '../../cache/entities/ServerTelemetryEntity.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTelemetryManager.js","sources":["../../../src/telemetry/server/ServerTelemetryManager.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SERVER_TELEM_CONSTANTS, Separators, CacheOutcome, Constants, RegionDiscoverySources, RegionDiscoveryOutcomes } from \"../../utils/Constants\";\nimport { CacheManager } from \"../../cache/CacheManager\";\nimport { AuthError } from \"../../error/AuthError\";\nimport { ServerTelemetryRequest } from \"./ServerTelemetryRequest\";\nimport { ServerTelemetryEntity } from \"../../cache/entities/ServerTelemetryEntity\";\nimport { StringUtils } from \"../../utils/StringUtils\";\nimport { RegionDiscoveryMetadata } from \"../../authority/RegionDiscoveryMetadata\";\n\nexport class ServerTelemetryManager {\n private cacheManager: CacheManager;\n private apiId: number;\n private correlationId: string;\n private telemetryCacheKey: string;\n private wrapperSKU: String;\n private wrapperVer: String;\n private regionUsed: string | undefined;\n private regionSource: RegionDiscoverySources | undefined;\n private regionOutcome: RegionDiscoveryOutcomes | undefined;\n private cacheOutcome: CacheOutcome = CacheOutcome.NO_CACHE_HIT;\n\n constructor(telemetryRequest: ServerTelemetryRequest, cacheManager: CacheManager) {\n this.cacheManager = cacheManager;\n this.apiId = telemetryRequest.apiId;\n this.correlationId = telemetryRequest.correlationId;\n this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;\n this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;\n\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\n }\n\n /**\n * API to add MSER Telemetry to request\n */\n generateCurrentRequestHeaderValue(): string {\n const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;\n const platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const regionDiscoveryFields = this.getRegionDiscoveryFields();\n const requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to add MSER Telemetry for the last failed request\n */\n generateLastRequestHeaderValue(): string {\n const lastRequests = this.getLastRequests();\n\n const maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const failedRequests = lastRequests.failedRequests.slice(0, 2*maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errorCount = lastRequests.errors.length;\n\n // Indicate whether this header contains all data or partial data\n const overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\n const platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to cache token failures for MSER data capture\n * @param error\n */\n cacheFailedRequest(error: AuthError): void {\n const lastRequests = this.getLastRequests();\n if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {\n // Remove a cached error to make room, first in first out\n lastRequests.failedRequests.shift(); // apiId\n lastRequests.failedRequests.shift(); // correlationId\n lastRequests.errors.shift();\n }\n \n lastRequests.failedRequests.push(this.apiId, this.correlationId);\n\n if (!StringUtils.isEmpty(error.subError)) {\n lastRequests.errors.push(error.subError);\n } else if (!StringUtils.isEmpty(error.errorCode)) {\n lastRequests.errors.push(error.errorCode);\n } else if (!!error && error.toString()) {\n lastRequests.errors.push(error.toString());\n } else {\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\n }\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n\n return;\n }\n\n /**\n * Update server telemetry cache entry by incrementing cache hit counter\n */\n incrementCacheHits(): number {\n const lastRequests = this.getLastRequests();\n lastRequests.cacheHits += 1;\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n return lastRequests.cacheHits;\n }\n\n /**\n * Get the server telemetry entity from cache or initialize a new one\n */\n getLastRequests(): ServerTelemetryEntity {\n const initialValue: ServerTelemetryEntity = new ServerTelemetryEntity();\n const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey) as ServerTelemetryEntity;\n\n return lastRequests || initialValue;\n }\n\n /**\n * Remove server telemetry cache entry\n */\n clearTelemetryCache(): void {\n const lastRequests = this.getLastRequests();\n const numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const errorCount = lastRequests.errors.length;\n if (numErrorsFlushed === errorCount) {\n // All errors were sent on last request, clear Telemetry cache\n this.cacheManager.removeItem(this.telemetryCacheKey);\n } else {\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\n const serverTelemEntity = new ServerTelemetryEntity();\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed*2); // failedRequests contains 2 items for each error\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\n }\n }\n\n /**\n * Returns the maximum number of errors that can be flushed to the server in the next network request\n * @param serverTelemetryEntity\n */\n static maxErrorsToSend(serverTelemetryEntity: ServerTelemetryEntity): number {\n let i;\n let maxErrors = 0;\n let dataSize = 0;\n const errorCount = serverTelemetryEntity.errors.length;\n for (i = 0; i < errorCount; i++) {\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\n const apiId = serverTelemetryEntity.failedRequests[2*i] || Constants.EMPTY_STRING;\n const correlationId = serverTelemetryEntity.failedRequests[2*i + 1] || Constants.EMPTY_STRING;\n const errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\n\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\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\n\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {\n // Adding this entry to the header would still keep header size below the limit\n maxErrors += 1;\n } else {\n break;\n }\n }\n\n return maxErrors;\n }\n\n /**\n * Get the region discovery fields\n * \n * @returns string\n */\n getRegionDiscoveryFields(): string {\n const regionDiscoveryFields: string[] = [];\n\n regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);\n\n return regionDiscoveryFields.join(\",\");\n }\n\n /**\n * Update the region discovery metadata\n * \n * @param regionDiscoveryMetadata\n * @returns void\n */\n updateRegionDiscoveryMetadata(regionDiscoveryMetadata: RegionDiscoveryMetadata): void {\n this.regionUsed = regionDiscoveryMetadata.region_used;\n this.regionSource = regionDiscoveryMetadata.region_source;\n this.regionOutcome = regionDiscoveryMetadata.region_outcome;\n }\n\n /**\n * Set cache outcome \n */\n setCacheOutcome(cacheOutcome: CacheOutcome): void {\n this.cacheOutcome = cacheOutcome;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;;IAyBI,gCAAY,gBAAwC,EAAE,YAA0B;QAFxE,iBAAY,GAAiB,YAAY,CAAC,YAAY,CAAC;QAG3D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;QAExE,IAA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I,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;QAEzE,OAAO,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1C;;;;;;;IAQD,8DAA6B,GAA7B,UAA8B,uBAAgD;QAC1E,IAAI,CAAC,UAAU,GAAG,uBAAuB,CAAC,WAAW,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,uBAAuB,CAAC,aAAa,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,uBAAuB,CAAC,cAAc,CAAC;KAC/D;;;;IAKD,gDAAe,GAAf,UAAgB,YAA0B;QACtC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KACpC;IACL,6BAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ServerTelemetryManager.js","sources":["../../../src/telemetry/server/ServerTelemetryManager.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SERVER_TELEM_CONSTANTS, Separators, CacheOutcome, Constants, RegionDiscoverySources, RegionDiscoveryOutcomes } from \"../../utils/Constants\";\nimport { CacheManager } from \"../../cache/CacheManager\";\nimport { AuthError } from \"../../error/AuthError\";\nimport { ServerTelemetryRequest } from \"./ServerTelemetryRequest\";\nimport { ServerTelemetryEntity } from \"../../cache/entities/ServerTelemetryEntity\";\nimport { StringUtils } from \"../../utils/StringUtils\";\nimport { RegionDiscoveryMetadata } from \"../../authority/RegionDiscoveryMetadata\";\n\nexport class ServerTelemetryManager {\n private cacheManager: CacheManager;\n private apiId: number;\n private correlationId: string;\n private telemetryCacheKey: string;\n private wrapperSKU: String;\n private wrapperVer: String;\n private regionUsed: string | undefined;\n private regionSource: RegionDiscoverySources | undefined;\n private regionOutcome: RegionDiscoveryOutcomes | undefined;\n private cacheOutcome: CacheOutcome = CacheOutcome.NO_CACHE_HIT;\n\n constructor(telemetryRequest: ServerTelemetryRequest, cacheManager: CacheManager) {\n this.cacheManager = cacheManager;\n this.apiId = telemetryRequest.apiId;\n this.correlationId = telemetryRequest.correlationId;\n this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;\n this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;\n\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\n }\n\n /**\n * API to add MSER Telemetry to request\n */\n generateCurrentRequestHeaderValue(): string {\n const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;\n const platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const regionDiscoveryFields = this.getRegionDiscoveryFields();\n const requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to add MSER Telemetry for the last failed request\n */\n generateLastRequestHeaderValue(): string {\n const lastRequests = this.getLastRequests();\n\n const maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const failedRequests = lastRequests.failedRequests.slice(0, 2*maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n const errorCount = lastRequests.errors.length;\n\n // Indicate whether this header contains all data or partial data\n const overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\n const platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\n\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\n }\n\n /**\n * API to cache token failures for MSER data capture\n * @param error\n */\n cacheFailedRequest(error: AuthError): void {\n const lastRequests = this.getLastRequests();\n if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {\n // Remove a cached error to make room, first in first out\n lastRequests.failedRequests.shift(); // apiId\n lastRequests.failedRequests.shift(); // correlationId\n lastRequests.errors.shift();\n }\n \n lastRequests.failedRequests.push(this.apiId, this.correlationId);\n\n if (!StringUtils.isEmpty(error.subError)) {\n lastRequests.errors.push(error.subError);\n } else if (!StringUtils.isEmpty(error.errorCode)) {\n lastRequests.errors.push(error.errorCode);\n } else if (!!error && error.toString()) {\n lastRequests.errors.push(error.toString());\n } else {\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\n }\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n\n return;\n }\n\n /**\n * Update server telemetry cache entry by incrementing cache hit counter\n */\n incrementCacheHits(): number {\n const lastRequests = this.getLastRequests();\n lastRequests.cacheHits += 1;\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\n return lastRequests.cacheHits;\n }\n\n /**\n * Get the server telemetry entity from cache or initialize a new one\n */\n getLastRequests(): ServerTelemetryEntity {\n const initialValue: ServerTelemetryEntity = new ServerTelemetryEntity();\n const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey) as ServerTelemetryEntity;\n\n return lastRequests || initialValue;\n }\n\n /**\n * Remove server telemetry cache entry\n */\n clearTelemetryCache(): void {\n const lastRequests = this.getLastRequests();\n const numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\n const errorCount = lastRequests.errors.length;\n if (numErrorsFlushed === errorCount) {\n // All errors were sent on last request, clear Telemetry cache\n this.cacheManager.removeItem(this.telemetryCacheKey);\n } else {\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\n const serverTelemEntity = new ServerTelemetryEntity();\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed*2); // failedRequests contains 2 items for each error\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\n\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\n }\n }\n\n /**\n * Returns the maximum number of errors that can be flushed to the server in the next network request\n * @param serverTelemetryEntity\n */\n static maxErrorsToSend(serverTelemetryEntity: ServerTelemetryEntity): number {\n let i;\n let maxErrors = 0;\n let dataSize = 0;\n const errorCount = serverTelemetryEntity.errors.length;\n for (i = 0; i < errorCount; i++) {\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\n const apiId = serverTelemetryEntity.failedRequests[2*i] || Constants.EMPTY_STRING;\n const correlationId = serverTelemetryEntity.failedRequests[2*i + 1] || Constants.EMPTY_STRING;\n const errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\n\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\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\n\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {\n // Adding this entry to the header would still keep header size below the limit\n maxErrors += 1;\n } else {\n break;\n }\n }\n\n return maxErrors;\n }\n\n /**\n * Get the region discovery fields\n * \n * @returns string\n */\n getRegionDiscoveryFields(): string {\n const regionDiscoveryFields: string[] = [];\n\n regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);\n regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);\n\n return regionDiscoveryFields.join(\",\");\n }\n\n /**\n * Update the region discovery metadata\n * \n * @param regionDiscoveryMetadata\n * @returns void\n */\n updateRegionDiscoveryMetadata(regionDiscoveryMetadata: RegionDiscoveryMetadata): void {\n this.regionUsed = regionDiscoveryMetadata.region_used;\n this.regionSource = regionDiscoveryMetadata.region_source;\n this.regionOutcome = regionDiscoveryMetadata.region_outcome;\n }\n\n /**\n * Set cache outcome \n */\n setCacheOutcome(cacheOutcome: CacheOutcome): void {\n this.cacheOutcome = cacheOutcome;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;AAUH,IAAA,sBAAA,kBAAA,YAAA;IAYI,SAAY,sBAAA,CAAA,gBAAwC,EAAE,YAA0B,EAAA;AAFxE,QAAA,IAAA,CAAA,YAAY,GAAiB,YAAY,CAAC,YAAY,CAAC;AAG3D,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;AACjC,QAAA,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC;AACpC,QAAA,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,IAAI,SAAS,CAAC,YAAY,CAAC;AAExE,QAAA,IAAI,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,SAAS,GAAG,UAAU,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,QAAQ,CAAC;KAC1H;AAED;;AAEG;AACH,IAAA,sBAAA,CAAA,SAAA,CAAA,iCAAiC,GAAjC,YAAA;AACI,QAAA,IAAM,OAAO,GAAG,EAAG,GAAA,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,eAAe,GAAG,IAAI,CAAC,YAAc,CAAC;AAC7F,QAAA,IAAM,cAAc,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,CAAC;AACvG,QAAA,IAAM,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;AAC9D,QAAA,IAAM,gCAAgC,GAAG,CAAC,OA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,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;QACxE,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;AAEzE,QAAA,OAAO,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1C,CAAA;AAED;;;;;AAKG;IACH,sBAA6B,CAAA,SAAA,CAAA,6BAAA,GAA7B,UAA8B,uBAAgD,EAAA;AAC1E,QAAA,IAAI,CAAC,UAAU,GAAG,uBAAuB,CAAC,WAAW,CAAC;AACtD,QAAA,IAAI,CAAC,YAAY,GAAG,uBAAuB,CAAC,aAAa,CAAC;AAC1D,QAAA,IAAI,CAAC,aAAa,GAAG,uBAAuB,CAAC,cAAc,CAAC;KAC/D,CAAA;AAED;;AAEG;IACH,sBAAe,CAAA,SAAA,CAAA,eAAA,GAAf,UAAgB,YAA0B,EAAA;AACtC,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;KACpC,CAAA;IACL,OAAC,sBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
|
package/dist/url/UrlString.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlString.js","sources":["../../src/url/UrlString.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { IUri } from \"./IUri\";\nimport { AADAuthorityConstants, Constants } from \"../utils/Constants\";\n\n/**\n * Url object class which can perform various transformations on url strings.\n */\nexport class UrlString {\n\n // internal url string field\n private _urlString: string;\n public get urlString(): string {\n return this._urlString;\n }\n\n constructor(url: string) {\n this._urlString = url;\n if (StringUtils.isEmpty(this._urlString)) {\n // Throws error if url is empty\n throw ClientConfigurationError.createUrlEmptyError();\n }\n\n if (StringUtils.isEmpty(this.getHash())) {\n this._urlString = UrlString.canonicalizeUri(url);\n }\n }\n\n /**\n * Ensure urls are lower case and end with a / character.\n * @param url\n */\n static canonicalizeUri(url: string): string {\n if (url) {\n let lowerCaseUrl = url.toLowerCase();\n\n if (StringUtils.endsWith(lowerCaseUrl, \"?\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -1);\n } else if (StringUtils.endsWith(lowerCaseUrl, \"?/\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -2);\n }\n\n if (!StringUtils.endsWith(lowerCaseUrl, \"/\")) {\n lowerCaseUrl += \"/\";\n }\n\n return lowerCaseUrl;\n }\n\n return url;\n }\n\n /**\n * Throws if urlString passed is not a valid authority URI string.\n */\n validateAsUri(): void {\n // Attempts to parse url for uri components\n let components;\n try {\n components = this.getUrlComponents();\n } catch (e) {\n throw ClientConfigurationError.createUrlParseError(e);\n }\n\n // Throw error if URI or path segments are not parseable.\n if (!components.HostNameAndPort || !components.PathSegments) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Throw error if uri is insecure.\n if(!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\n }\n }\n\n /**\n * Given a url and a query string return the url with provided query string appended\n * @param url\n * @param queryString\n */\n static appendQueryString(url: string, queryString: string): string {\n if (StringUtils.isEmpty(queryString)) {\n return url;\n }\n\n return url.indexOf(\"?\") < 0 ? `${url}?${queryString}` : `${url}&${queryString}`;\n }\n\n /**\n * Returns a url with the hash removed\n * @param url\n */\n static removeHashFromUrl(url: string): string {\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\n }\n\n /**\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\n * @param href The url\n * @param tenantId The tenant id to replace\n */\n replaceTenantPath(tenantId: string): UrlString {\n const urlObject = this.getUrlComponents();\n const pathArray = urlObject.PathSegments;\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\n pathArray[0] = tenantId;\n }\n return UrlString.constructAuthorityUriFromObject(urlObject);\n }\n\n /**\n * Returns the anchor part(#) of the URL\n */\n getHash(): string {\n return UrlString.parseHash(this.urlString);\n }\n\n /**\n * Parses out the components from a url string.\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\n */\n getUrlComponents(): IUri {\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\n const regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\n\n // If url string does not match regEx, we throw an error\n const match = this.urlString.match(regEx);\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Url component object\n const urlComponents = {\n Protocol: match[1],\n HostNameAndPort: match[4],\n AbsolutePath: match[5],\n QueryString: match[7]\n } as IUri;\n\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\n urlComponents.PathSegments = pathSegments;\n\n if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length-1);\n }\n return urlComponents;\n }\n\n static getDomainFromUrl(url: string): string {\n const regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\n\n const match = url.match(regEx);\n\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${url}`);\n }\n\n return match[2];\n }\n\n static getAbsoluteUrl(relativeUrl: string, baseUrl: string): string {\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\n const url = new UrlString(baseUrl);\n const baseComponents = url.getUrlComponents();\n\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\n }\n\n return relativeUrl;\n }\n\n /**\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\n * @param hashString\n */\n static parseHash(hashString: string): string {\n const hashIndex1 = hashString.indexOf(\"#\");\n const hashIndex2 = hashString.indexOf(\"#/\");\n if (hashIndex2 > -1) {\n return hashString.substring(hashIndex2 + 2);\n } else if (hashIndex1 > -1) {\n return hashString.substring(hashIndex1 + 1);\n }\n return Constants.EMPTY_STRING;\n }\n\n static constructAuthorityUriFromObject(urlObject: IUri): UrlString {\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\n }\n\n /**\n * Returns URL hash as server auth code response object.\n */\n static getDeserializedHash(hash: string): ServerAuthorizationCodeResponse {\n // Check if given hash is empty\n if (StringUtils.isEmpty(hash)) {\n return {};\n }\n // Strip the # symbol if present\n const parsedHash = UrlString.parseHash(hash);\n // If # symbol was not present, above will return empty string, so give original hash value\n const deserializedHash: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\n // Check if deserialization didn't work\n if (!deserializedHash) {\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\n }\n return deserializedHash;\n }\n\n /**\n * Check if the hash of the URL string contains known properties\n */\n static hashContainsKnownProperties(hash: string): boolean {\n if (StringUtils.isEmpty(hash) || hash.indexOf(\"=\") < 0) {\n // Hash doesn't contain key/value pairs\n return false;\n }\n\n const parameters: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\n return !!(\n parameters.code ||\n parameters.error_description ||\n parameters.error ||\n parameters.state\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;AAYA;;;;IAWI,mBAAY,GAAW;QACnB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,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;QAE7C,IAAM,gBAAgB,GAAoC,WAAW,CAAC,mBAAmB,CAAkC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,UAAU,CAAC,CAAC;;QAEhL,IAAI,CAAC,gBAAgB,EAAE;YACnB,MAAM,eAAe,CAAC,8BAA8B,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAC1F;QACD,OAAO,gBAAgB,CAAC;KAC3B;;;;IAKM,qCAA2B,GAAlC,UAAmC,IAAY;QAC3C,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;;YAEpD,OAAO,KAAK,CAAC;SAChB;QAED,IAAM,UAAU,GAAoC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACxF,OAAO,CAAC,EACJ,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,iBAAiB;YAC5B,UAAU,CAAC,KAAK;YAChB,UAAU,CAAC,KAAK,CACnB,CAAC;KACL;IACL,gBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"UrlString.js","sources":["../../src/url/UrlString.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { IUri } from \"./IUri\";\nimport { AADAuthorityConstants, Constants } from \"../utils/Constants\";\n\n/**\n * Url object class which can perform various transformations on url strings.\n */\nexport class UrlString {\n\n // internal url string field\n private _urlString: string;\n public get urlString(): string {\n return this._urlString;\n }\n\n constructor(url: string) {\n this._urlString = url;\n if (StringUtils.isEmpty(this._urlString)) {\n // Throws error if url is empty\n throw ClientConfigurationError.createUrlEmptyError();\n }\n\n if (StringUtils.isEmpty(this.getHash())) {\n this._urlString = UrlString.canonicalizeUri(url);\n }\n }\n\n /**\n * Ensure urls are lower case and end with a / character.\n * @param url\n */\n static canonicalizeUri(url: string): string {\n if (url) {\n let lowerCaseUrl = url.toLowerCase();\n\n if (StringUtils.endsWith(lowerCaseUrl, \"?\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -1);\n } else if (StringUtils.endsWith(lowerCaseUrl, \"?/\")) {\n lowerCaseUrl = lowerCaseUrl.slice(0, -2);\n }\n\n if (!StringUtils.endsWith(lowerCaseUrl, \"/\")) {\n lowerCaseUrl += \"/\";\n }\n\n return lowerCaseUrl;\n }\n\n return url;\n }\n\n /**\n * Throws if urlString passed is not a valid authority URI string.\n */\n validateAsUri(): void {\n // Attempts to parse url for uri components\n let components;\n try {\n components = this.getUrlComponents();\n } catch (e) {\n throw ClientConfigurationError.createUrlParseError(e);\n }\n\n // Throw error if URI or path segments are not parseable.\n if (!components.HostNameAndPort || !components.PathSegments) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Throw error if uri is insecure.\n if(!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\n }\n }\n\n /**\n * Given a url and a query string return the url with provided query string appended\n * @param url\n * @param queryString\n */\n static appendQueryString(url: string, queryString: string): string {\n if (StringUtils.isEmpty(queryString)) {\n return url;\n }\n\n return url.indexOf(\"?\") < 0 ? `${url}?${queryString}` : `${url}&${queryString}`;\n }\n\n /**\n * Returns a url with the hash removed\n * @param url\n */\n static removeHashFromUrl(url: string): string {\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\n }\n\n /**\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\n * @param href The url\n * @param tenantId The tenant id to replace\n */\n replaceTenantPath(tenantId: string): UrlString {\n const urlObject = this.getUrlComponents();\n const pathArray = urlObject.PathSegments;\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\n pathArray[0] = tenantId;\n }\n return UrlString.constructAuthorityUriFromObject(urlObject);\n }\n\n /**\n * Returns the anchor part(#) of the URL\n */\n getHash(): string {\n return UrlString.parseHash(this.urlString);\n }\n\n /**\n * Parses out the components from a url string.\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\n */\n getUrlComponents(): IUri {\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\n const regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\n\n // If url string does not match regEx, we throw an error\n const match = this.urlString.match(regEx);\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\n }\n\n // Url component object\n const urlComponents = {\n Protocol: match[1],\n HostNameAndPort: match[4],\n AbsolutePath: match[5],\n QueryString: match[7]\n } as IUri;\n\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\n urlComponents.PathSegments = pathSegments;\n\n if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length-1);\n }\n return urlComponents;\n }\n\n static getDomainFromUrl(url: string): string {\n const regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\n\n const match = url.match(regEx);\n\n if (!match) {\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${url}`);\n }\n\n return match[2];\n }\n\n static getAbsoluteUrl(relativeUrl: string, baseUrl: string): string {\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\n const url = new UrlString(baseUrl);\n const baseComponents = url.getUrlComponents();\n\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\n }\n\n return relativeUrl;\n }\n\n /**\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\n * @param hashString\n */\n static parseHash(hashString: string): string {\n const hashIndex1 = hashString.indexOf(\"#\");\n const hashIndex2 = hashString.indexOf(\"#/\");\n if (hashIndex2 > -1) {\n return hashString.substring(hashIndex2 + 2);\n } else if (hashIndex1 > -1) {\n return hashString.substring(hashIndex1 + 1);\n }\n return Constants.EMPTY_STRING;\n }\n\n static constructAuthorityUriFromObject(urlObject: IUri): UrlString {\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\n }\n\n /**\n * Returns URL hash as server auth code response object.\n */\n static getDeserializedHash(hash: string): ServerAuthorizationCodeResponse {\n // Check if given hash is empty\n if (StringUtils.isEmpty(hash)) {\n return {};\n }\n // Strip the # symbol if present\n const parsedHash = UrlString.parseHash(hash);\n // If # symbol was not present, above will return empty string, so give original hash value\n const deserializedHash: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject<ServerAuthorizationCodeResponse>(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\n // Check if deserialization didn't work\n if (!deserializedHash) {\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\n }\n return deserializedHash;\n }\n\n /**\n * Check if the hash of the URL string contains known properties\n */\n static hashContainsKnownProperties(hash: string): boolean {\n if (StringUtils.isEmpty(hash) || hash.indexOf(\"=\") < 0) {\n // Hash doesn't contain key/value pairs\n return false;\n }\n\n const parameters: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\n return !!(\n parameters.code ||\n parameters.error_description ||\n parameters.error ||\n parameters.state\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;AAGG;AASH;;AAEG;AACH,IAAA,SAAA,kBAAA,YAAA;AAQI,IAAA,SAAA,SAAA,CAAY,GAAW,EAAA;AACnB,QAAA,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,WAAW,CAAC,OAAO,CAAC,IAA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