@azure/msal-common 6.0.0 → 6.3.0-beta.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/LICENSE +21 -21
- package/README.md +62 -62
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/account/AccountInfo.d.ts +6 -1
- 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/account/TokenClaims.d.ts +30 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.d.ts +9 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +36 -11
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +2 -2
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.js +5 -5
- package/dist/authority/AuthorityFactory.js.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +8 -0
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.js +24 -0
- package/dist/authority/AuthorityOptions.js.map +1 -0
- 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/ImdsOptions.d.ts +7 -0
- package/dist/authority/ImdsOptions.d.ts.map +1 -0
- 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.d.ts +3 -6
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.js +19 -11
- package/dist/authority/RegionDiscovery.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +1 -1
- package/dist/cache/CacheManager.js +3 -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.d.ts +3 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.js +16 -12
- 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 +5 -5
- 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/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +122 -93
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.js +2 -2
- package/dist/client/BaseClient.js.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.js +4 -3
- package/dist/client/ClientCredentialClient.js.map +1 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.js +4 -2
- package/dist/client/DeviceCodeClient.js.map +1 -1
- package/dist/client/OnBehalfOfClient.js +3 -2
- package/dist/client/OnBehalfOfClient.js.map +1 -1
- package/dist/client/RefreshTokenClient.js +2 -1
- 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.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.js +3 -1
- package/dist/client/UsernamePasswordClient.js.map +1 -1
- package/dist/config/ClientConfiguration.d.ts +29 -1
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +21 -8
- package/dist/config/ClientConfiguration.js.map +1 -1
- package/dist/crypto/ICrypto.d.ts +4 -2
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.js +1 -1
- package/dist/crypto/ICrypto.js.map +1 -1
- package/dist/crypto/IGuidGenerator.d.ts +5 -0
- package/dist/crypto/IGuidGenerator.d.ts.map +1 -0
- package/dist/crypto/PopTokenGenerator.d.ts +30 -0
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.js +38 -2
- package/dist/crypto/PopTokenGenerator.js.map +1 -1
- package/dist/error/AuthError.js +3 -3
- 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.d.ts +11 -0
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +12 -2
- 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/ServerError.js +1 -1
- package/dist/error/ServerError.js.map +1 -1
- package/dist/index.cjs.js +764 -176
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/logger/Logger.js +13 -13
- package/dist/logger/Logger.js.map +1 -1
- package/dist/network/INetworkModule.d.ts +1 -0
- package/dist/network/INetworkModule.d.ts.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.d.ts.map +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthenticationHeaderParser.js +3 -3
- package/dist/request/AuthenticationHeaderParser.js.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +8 -5
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -0
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonEndSessionRequest.d.ts +2 -0
- package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +18 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +37 -3
- 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 +4 -4
- package/dist/request/ScopeSet.js.map +1 -1
- package/dist/response/AuthenticationResult.d.ts +1 -0
- package/dist/response/AuthenticationResult.d.ts.map +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/response/ServerAuthorizationCodeResponse.d.ts +1 -0
- package/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +22 -0
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -0
- package/dist/telemetry/performance/IPerformanceMeasurement.d.ts +6 -0
- package/dist/telemetry/performance/IPerformanceMeasurement.d.ts.map +1 -0
- package/dist/telemetry/performance/PerformanceClient.d.ts +125 -0
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -0
- package/dist/telemetry/performance/PerformanceClient.js +275 -0
- package/dist/telemetry/performance/PerformanceClient.js.map +1 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts +203 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -0
- package/dist/telemetry/performance/PerformanceEvent.js +100 -0
- package/dist/telemetry/performance/PerformanceEvent.js.map +1 -0
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +13 -0
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -0
- package/dist/telemetry/performance/StubPerformanceClient.js +37 -0
- package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -0
- package/dist/telemetry/server/ServerTelemetryManager.js +4 -4
- package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -1
- package/dist/url/UrlString.js +2 -2
- package/dist/url/UrlString.js.map +1 -1
- package/dist/utils/Constants.d.ts +8 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +9 -2
- package/dist/utils/Constants.js.map +1 -1
- package/dist/utils/ProtocolUtils.js +3 -3
- 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 +74 -76
- package/CHANGELOG.json +0 -1282
- package/CHANGELOG.md +0 -491
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorityMetadataEntity.js","sources":["../../../src/cache/entities/AuthorityMetadataEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { CloudDiscoveryMetadata } from \"../../authority/CloudDiscoveryMetadata\";\nimport { OpenIdConfigResponse } from \"../../authority/OpenIdConfigResponse\";\nimport { AUTHORITY_METADATA_CONSTANTS } from \"../../utils/Constants\";\nimport { TimeUtils } from \"../../utils/TimeUtils\";\n\nexport class AuthorityMetadataEntity {\n aliases: Array<string>;\n preferred_cache: string;\n preferred_network: string;\n canonical_authority: string;\n authorization_endpoint: string;\n token_endpoint: string;\n end_session_endpoint?: string;\n issuer: string;\n aliasesFromNetwork: boolean;\n endpointsFromNetwork: boolean;\n expiresAt: number;\n\n constructor() {\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\n }\n\n /**\n * Update the entity with new aliases, preferred_cache and preferred_network values\n * @param metadata \n * @param fromNetwork \n */\n updateCloudDiscoveryMetadata(metadata: CloudDiscoveryMetadata, fromNetwork: boolean): void {\n this.aliases = metadata.aliases;\n this.preferred_cache = metadata.preferred_cache;\n this.preferred_network = metadata.preferred_network;\n this.aliasesFromNetwork = fromNetwork;\n }\n\n /**\n * Update the entity with new endpoints\n * @param metadata \n * @param fromNetwork \n */\n updateEndpointMetadata(metadata: OpenIdConfigResponse, fromNetwork: boolean): void {\n this.authorization_endpoint = metadata.authorization_endpoint;\n this.token_endpoint = metadata.token_endpoint;\n this.end_session_endpoint = metadata.end_session_endpoint;\n this.issuer = metadata.issuer;\n this.endpointsFromNetwork = fromNetwork;\n }\n\n /**\n * Save the authority that was used to create this cache entry\n * @param authority \n */\n updateCanonicalAuthority(authority: string): void {\n this.canonical_authority = authority;\n }\n\n /**\n * Reset the exiresAt value\n */\n resetExpiresAt(): void {\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\n }\n\n /**\n * Returns whether or not the data needs to be refreshed\n */\n isExpired(): boolean {\n return this.expiresAt <= TimeUtils.nowSeconds();\n }\n\n /**\n * Validates an entity: checks for all expected params\n * @param entity\n */\n static isAuthorityMetadataEntity(key: string, entity: object): boolean {\n\n if (!entity) {\n return false;\n }\n\n return (\n key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&\n entity.hasOwnProperty(\"aliases\") &&\n entity.hasOwnProperty(\"preferred_cache\") &&\n entity.hasOwnProperty(\"preferred_network\") &&\n entity.hasOwnProperty(\"canonical_authority\") &&\n entity.hasOwnProperty(\"authorization_endpoint\") &&\n entity.hasOwnProperty(\"token_endpoint\") &&\n entity.hasOwnProperty(\"issuer\") &&\n entity.hasOwnProperty(\"aliasesFromNetwork\") &&\n entity.hasOwnProperty(\"endpointsFromNetwork\") &&\n entity.hasOwnProperty(\"expiresAt\")\n );\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;;IAuBI;QACI,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,UAAU,EAAE,GAAG,4BAA4B,CAAC,oBAAoB,CAAC;KAC/F;;;;;;IAOD,8DAA4B,GAA5B,UAA6B,QAAgC,EAAE,WAAoB;QAC/E,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QAChD,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;QACpD,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC;KACzC;;;;;;IAOD,wDAAsB,GAAtB,UAAuB,QAA8B,EAAE,WAAoB;QACvE,IAAI,CAAC,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;QAC9D,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;QAC9C,IAAI,CAAC,oBAAoB,G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corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CloudDiscoveryMetadata } from \"../../authority/CloudDiscoveryMetadata\";\r\nimport { OpenIdConfigResponse } from \"../../authority/OpenIdConfigResponse\";\r\nimport { AUTHORITY_METADATA_CONSTANTS } from \"../../utils/Constants\";\r\nimport { TimeUtils } from \"../../utils/TimeUtils\";\r\n\r\nexport class AuthorityMetadataEntity {\r\n aliases: Array<string>;\r\n preferred_cache: string;\r\n preferred_network: string;\r\n canonical_authority: string;\r\n authorization_endpoint: string;\r\n token_endpoint: string;\r\n end_session_endpoint?: string;\r\n issuer: string;\r\n aliasesFromNetwork: boolean;\r\n endpointsFromNetwork: boolean;\r\n expiresAt: number;\r\n\r\n constructor() {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n }\r\n\r\n /**\r\n * Update the entity with new aliases, preferred_cache and preferred_network values\r\n * @param metadata \r\n * @param fromNetwork \r\n */\r\n updateCloudDiscoveryMetadata(metadata: CloudDiscoveryMetadata, fromNetwork: boolean): void {\r\n this.aliases = metadata.aliases;\r\n this.preferred_cache = metadata.preferred_cache;\r\n this.preferred_network = metadata.preferred_network;\r\n this.aliasesFromNetwork = fromNetwork;\r\n }\r\n\r\n /**\r\n * Update the entity with new endpoints\r\n * @param metadata \r\n * @param fromNetwork \r\n */\r\n updateEndpointMetadata(metadata: OpenIdConfigResponse, fromNetwork: boolean): void {\r\n this.authorization_endpoint = metadata.authorization_endpoint;\r\n this.token_endpoint = metadata.token_endpoint;\r\n this.end_session_endpoint = metadata.end_session_endpoint;\r\n this.issuer = metadata.issuer;\r\n this.endpointsFromNetwork = fromNetwork;\r\n }\r\n\r\n /**\r\n * Save the authority that was used to create this cache entry\r\n * @param authority \r\n */\r\n updateCanonicalAuthority(authority: string): void {\r\n this.canonical_authority = authority;\r\n }\r\n\r\n /**\r\n * Reset the exiresAt value\r\n */\r\n resetExpiresAt(): void {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n }\r\n\r\n /**\r\n * Returns whether or not the data needs to be refreshed\r\n */\r\n isExpired(): boolean {\r\n return this.expiresAt <= TimeUtils.nowSeconds();\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAuthorityMetadataEntity(key: string, entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&\r\n entity.hasOwnProperty(\"aliases\") &&\r\n entity.hasOwnProperty(\"preferred_cache\") &&\r\n entity.hasOwnProperty(\"preferred_network\") &&\r\n entity.hasOwnProperty(\"canonical_authority\") &&\r\n entity.hasOwnProperty(\"authorization_endpoint\") &&\r\n entity.hasOwnProperty(\"token_endpoint\") &&\r\n entity.hasOwnProperty(\"issuer\") &&\r\n entity.hasOwnProperty(\"aliasesFromNetwork\") &&\r\n entity.hasOwnProperty(\"endpointsFromNetwork\") &&\r\n entity.hasOwnProperty(\"expiresAt\")\r\n );\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAAA;;;;;IAuBI;QACI,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,UAAU,EAAE,GAAG,4BAA4B,CAAC,oBAAoB,CAAC;KAC/F;;;;;;IAOD,8DAA4B,GAA5B,UAA6B,QAAgC,EAAE,WAAoB;QAC/E,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC;QAChD,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;QACpD,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC;KACzC;;;;;;IAOD,wDAAsB,GAAtB,UAAuB,QAA8B,EAAE,WAAoB;QACvE,IAAI,CAAC,sBAAsB,GAAG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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheRecord.js","sources":["../../../src/cache/entities/CacheRecord.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IdTokenEntity } from \"./IdTokenEntity\";\nimport { AccessTokenEntity } from \"./AccessTokenEntity\";\nimport { RefreshTokenEntity } from \"./RefreshTokenEntity\";\nimport { AccountEntity } from \"./AccountEntity\";\nimport { AppMetadataEntity } from \"./AppMetadataEntity\";\n\nexport class CacheRecord {\n account: AccountEntity | null;\n idToken: IdTokenEntity | null;\n accessToken: AccessTokenEntity | null;\n refreshToken: RefreshTokenEntity | null;\n appMetadata: AppMetadataEntity | null;\n\n constructor(accountEntity?: AccountEntity | null, idTokenEntity?: IdTokenEntity | null, accessTokenEntity?: AccessTokenEntity | null, refreshTokenEntity?: RefreshTokenEntity | null, appMetadataEntity?: AppMetadataEntity | null) {\n this.account = accountEntity || null;\n this.idToken = idTokenEntity || null;\n this.accessToken = accessTokenEntity || null;\n this.refreshToken = refreshTokenEntity || null;\n this.appMetadata = appMetadataEntity || null;\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;IAkBI,qBAAY,aAAoC,EAAE,aAAoC,EAAE,iBAA4C,EAAE,kBAA8C,EAAE,iBAA4C;QAC9N,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,kBAAkB,IAAI,IAAI,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;KAChD;IACL,kBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"CacheRecord.js","sources":["../../../src/cache/entities/CacheRecord.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { IdTokenEntity } from \"./IdTokenEntity\";\r\nimport { AccessTokenEntity } from \"./AccessTokenEntity\";\r\nimport { RefreshTokenEntity } from \"./RefreshTokenEntity\";\r\nimport { AccountEntity } from \"./AccountEntity\";\r\nimport { AppMetadataEntity } from \"./AppMetadataEntity\";\r\n\r\nexport class CacheRecord {\r\n account: AccountEntity | null;\r\n idToken: IdTokenEntity | null;\r\n accessToken: AccessTokenEntity | null;\r\n refreshToken: RefreshTokenEntity | null;\r\n appMetadata: AppMetadataEntity | null;\r\n\r\n constructor(accountEntity?: AccountEntity | null, idTokenEntity?: IdTokenEntity | null, accessTokenEntity?: AccessTokenEntity | null, refreshTokenEntity?: RefreshTokenEntity | null, appMetadataEntity?: AppMetadataEntity | null) {\r\n this.account = accountEntity || null;\r\n this.idToken = idTokenEntity || null;\r\n this.accessToken = accessTokenEntity || null;\r\n this.refreshToken = refreshTokenEntity || null;\r\n this.appMetadata = appMetadataEntity || null;\r\n }\r\n}\r\n"],"names":[],"mappings":";;AAAA;;;;;IAkBI,qBAAY,aAAoC,EAAE,aAAoC,EAAE,iBAA4C,EAAE,kBAA8C,EAAE,iBAA4C;QAC9N,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,kBAAkB,IAAI,IAAI,CAAC;QAC/C,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;KAChD;IACL,kBAAC;AAAD,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v6.0.0 2022-
|
|
1
|
+
/*! @azure/msal-common v6.3.0-beta.0 2022-04-27 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { CredentialType, CacheType, Constants, Separators, AuthenticationScheme } from '../../utils/Constants.js';
|
|
4
4
|
import { ClientAuthError } from '../../error/ClientAuthError.js';
|
|
@@ -131,7 +131,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
131
131
|
var credentialId = [
|
|
132
132
|
credentialType,
|
|
133
133
|
clientOrFamilyId,
|
|
134
|
-
realm ||
|
|
134
|
+
realm || Constants.EMPTY_STRING,
|
|
135
135
|
];
|
|
136
136
|
return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
137
137
|
};
|
|
@@ -139,13 +139,13 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
139
139
|
* Generate target key component as per schema: <target>
|
|
140
140
|
*/
|
|
141
141
|
CredentialEntity.generateTargetForCacheKey = function (scopes) {
|
|
142
|
-
return (scopes ||
|
|
142
|
+
return (scopes || Constants.EMPTY_STRING).toLowerCase();
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
145
|
* Generate requested claims key component as per schema: <requestedClaims>
|
|
146
146
|
*/
|
|
147
147
|
CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
|
|
148
|
-
return (requestedClaimsHash ||
|
|
148
|
+
return (requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();
|
|
149
149
|
};
|
|
150
150
|
/**
|
|
151
151
|
* Generate scheme key componenet as per schema: <scheme>
|
|
@@ -155,7 +155,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
155
155
|
* PoP Tokens and SSH certs include scheme in cache key
|
|
156
156
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
157
157
|
*/
|
|
158
|
-
return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() :
|
|
158
|
+
return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
159
159
|
};
|
|
160
160
|
return CredentialEntity;
|
|
161
161
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialEntity.js","sources":["../../../src/cache/entities/CredentialEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Separators, CredentialType, CacheType, Constants, AuthenticationScheme } from \"../../utils/Constants\";\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\n\n/**\n * Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc\n *\n * Key:Value Schema:\n *\n * Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>\n *\n * Value Schema:\n * {\n * homeAccountId: home account identifier for the auth scheme,\n * environment: entity that issued the token, represented as a full host\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\n * clientId: client ID of the application\n * secret: Actual credential as a string\n * familyId: Family ID identifier, usually only used for refresh tokens\n * realm: Full tenant or organizational identifier that the account belongs to\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\n * oboAssertion: access token passed in as part of OBO request\n * tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)\n * requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request\n * }\n */\nexport class CredentialEntity {\n homeAccountId: string;\n environment: string;\n credentialType: CredentialType;\n clientId: string;\n secret: string;\n familyId?: string;\n realm?: string;\n target?: string;\n oboAssertion?: string;\n tokenType?: AuthenticationScheme;\n keyId?: string;\n requestedClaimsHash?: string;\n\n /**\n * Generate Account Id key component as per the schema: <home_account_id>-<environment>\n */\n generateAccountId(): string {\n return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);\n }\n\n /**\n * Generate Credential Id key component as per the schema: <credential_type>-<client_id>-<realm>\n */\n generateCredentialId(): string {\n return CredentialEntity.generateCredentialIdForCacheKey(\n this.credentialType,\n this.clientId,\n this.realm,\n this.familyId\n );\n }\n\n /**\n * Generate target key component as per schema: <target>\n */\n generateTarget(): string {\n return CredentialEntity.generateTargetForCacheKey(this.target);\n }\n\n /**\n * generates credential key\n */\n generateCredentialKey(): string {\n return CredentialEntity.generateCredentialCacheKey(\n this.homeAccountId,\n this.environment,\n this.credentialType,\n this.clientId,\n this.realm,\n this.target,\n this.familyId,\n this.tokenType,\n this.requestedClaimsHash\n );\n }\n\n /**\n * returns the type of the cache (in this case credential)\n */\n generateType(): number {\n switch (this.credentialType) {\n case CredentialType.ID_TOKEN:\n return CacheType.ID_TOKEN;\n case CredentialType.ACCESS_TOKEN:\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\n return CacheType.ACCESS_TOKEN;\n case CredentialType.REFRESH_TOKEN:\n return CacheType.REFRESH_TOKEN;\n default: {\n throw ClientAuthError.createUnexpectedCredentialTypeError();\n }\n }\n }\n\n /**\n * helper function to return `CredentialType`\n * @param key\n */\n static getCredentialType(key: string): string {\n // First keyword search will match all \"AccessToken\" and \"AccessToken_With_AuthScheme\" credentials\n if (key.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) !== -1) {\n // Perform second search to differentiate between \"AccessToken\" and \"AccessToken_With_AuthScheme\" credential types\n if (key.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) !== -1) {\n return CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\n }\n return CredentialType.ACCESS_TOKEN;\n } else if (key.indexOf(CredentialType.ID_TOKEN.toLowerCase()) !== -1) {\n return CredentialType.ID_TOKEN;\n } else if (key.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) !== -1) {\n return CredentialType.REFRESH_TOKEN;\n }\n\n return Constants.NOT_DEFINED;\n }\n\n /**\n * generates credential key\n * <home_account_id*>-\\<environment>-<credential_type>-<client_id>-<realm\\*>-<target\\*>-<scheme\\*>\n */\n static generateCredentialCacheKey(\n homeAccountId: string,\n environment: string,\n credentialType: CredentialType,\n clientId: string,\n realm?: string,\n target?: string,\n familyId?: string,\n tokenType?: AuthenticationScheme,\n requestedClaimsHash?: string\n ): string {\n const credentialKey = [\n this.generateAccountIdForCacheKey(homeAccountId, environment),\n this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),\n this.generateTargetForCacheKey(target),\n this.generateClaimsHashForCacheKey(requestedClaimsHash),\n this.generateSchemeForCacheKey(tokenType)\n ];\n\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\n }\n\n /**\n * generates Account Id for keys\n * @param homeAccountId\n * @param environment\n */\n private static generateAccountIdForCacheKey(\n homeAccountId: string,\n environment: string\n ): string {\n const accountId: Array<string> = [homeAccountId, environment];\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\n }\n\n /**\n * Generates Credential Id for keys\n * @param credentialType\n * @param realm\n * @param clientId\n * @param familyId\n */\n private static generateCredentialIdForCacheKey(\n credentialType: CredentialType,\n clientId: string,\n realm?: string,\n familyId?: string\n ): string {\n const clientOrFamilyId =\n credentialType === CredentialType.REFRESH_TOKEN\n ? familyId || clientId\n : clientId;\n const credentialId: Array<string> = [\n credentialType,\n clientOrFamilyId,\n realm || \"\",\n ];\n\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\n }\n\n /**\n * Generate target key component as per schema: <target>\n */\n private static generateTargetForCacheKey(scopes?: string): string {\n return (scopes || \"\").toLowerCase();\n }\n\n /**\n * Generate requested claims key component as per schema: <requestedClaims>\n */\n private static generateClaimsHashForCacheKey(requestedClaimsHash?: string): string {\n return(requestedClaimsHash || \"\").toLowerCase();\n }\n\n /**\n * Generate scheme key componenet as per schema: <scheme>\n */\n private static generateSchemeForCacheKey(tokenType?: string): string {\n /*\n * PoP Tokens and SSH certs include scheme in cache key\n * Cast to lowercase to handle \"bearer\" from ADFS\n */\n return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : \"\";\n }\n}\n"],"names":[],"mappings":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C;QAC9D,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;KACvE;;;;;;;;IASc,gDAA+B,GAA9C,UACI,cAA8B,EAC9B,QAAgB,EAChB,KAAc,EACd,QAAiB;QAEjB,IAAM,gBAAgB,GAClB,cAAc,KAAK,cAAc,CAAC,aAAa;cACzC,QAAQ,IAAI,QAAQ;cACpB,QAAQ,CAAC;QACnB,IAAM,YAAY,GAAkB;YAChC,cAAc;YACd,gBAAgB;YAChB,KAAK,IAAI,EAAE;SACd,CAAC;QAEF,OAAO,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;KAC1E;;;;IAKc,0CAAyB,GAAxC,UAAyC,MAAe;QACpD,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC;KACvC;;;;IAKc,8CAA6B,GAA5C,UAA6C,mBAA4B;QACrE,OAAM,CAAC,mBAAmB,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC;KACnD;;;;IAKc,0CAAyB,GAAxC,UAAyC,SAAkB;;;;;QAKvD,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,oBAAoB,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC;KAC9H;IACL,uBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"CredentialEntity.js","sources":["../../../src/cache/entities/CredentialEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { Separators, CredentialType, CacheType, Constants, AuthenticationScheme } from \"../../utils/Constants\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\n\r\n/**\r\n * Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * oboAssertion: access token passed in as part of OBO request\r\n * tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)\r\n * requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request\r\n * }\r\n */\r\nexport class CredentialEntity {\r\n homeAccountId: string;\r\n environment: string;\r\n credentialType: CredentialType;\r\n clientId: string;\r\n secret: string;\r\n familyId?: string;\r\n realm?: string;\r\n target?: string;\r\n oboAssertion?: string;\r\n tokenType?: AuthenticationScheme;\r\n keyId?: string;\r\n requestedClaimsHash?: string;\r\n\r\n /**\r\n * Generate Account Id key component as per the schema: <home_account_id>-<environment>\r\n */\r\n generateAccountId(): string {\r\n return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);\r\n }\r\n\r\n /**\r\n * Generate Credential Id key component as per the schema: <credential_type>-<client_id>-<realm>\r\n */\r\n generateCredentialId(): string {\r\n return CredentialEntity.generateCredentialIdForCacheKey(\r\n this.credentialType,\r\n this.clientId,\r\n this.realm,\r\n this.familyId\r\n );\r\n }\r\n\r\n /**\r\n * Generate target key component as per schema: <target>\r\n */\r\n generateTarget(): string {\r\n return CredentialEntity.generateTargetForCacheKey(this.target);\r\n }\r\n\r\n /**\r\n * generates credential key\r\n */\r\n generateCredentialKey(): string {\r\n return CredentialEntity.generateCredentialCacheKey(\r\n this.homeAccountId,\r\n this.environment,\r\n this.credentialType,\r\n this.clientId,\r\n this.realm,\r\n this.target,\r\n this.familyId,\r\n this.tokenType,\r\n this.requestedClaimsHash\r\n );\r\n }\r\n\r\n /**\r\n * returns the type of the cache (in this case credential)\r\n */\r\n generateType(): number {\r\n switch (this.credentialType) {\r\n case CredentialType.ID_TOKEN:\r\n return CacheType.ID_TOKEN;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n return CacheType.ACCESS_TOKEN;\r\n case CredentialType.REFRESH_TOKEN:\r\n return CacheType.REFRESH_TOKEN;\r\n default: {\r\n throw ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * helper function to return `CredentialType`\r\n * @param key\r\n */\r\n static getCredentialType(key: string): string {\r\n // First keyword search will match all \"AccessToken\" and \"AccessToken_With_AuthScheme\" credentials\r\n if (key.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) !== -1) {\r\n // Perform second search to differentiate between \"AccessToken\" and \"AccessToken_With_AuthScheme\" credential types\r\n if (key.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) !== -1) {\r\n return CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\r\n }\r\n return CredentialType.ACCESS_TOKEN;\r\n } else if (key.indexOf(CredentialType.ID_TOKEN.toLowerCase()) !== -1) {\r\n return CredentialType.ID_TOKEN;\r\n } else if (key.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) !== -1) {\r\n return CredentialType.REFRESH_TOKEN;\r\n }\r\n\r\n return Constants.NOT_DEFINED;\r\n }\r\n\r\n /**\r\n * generates credential key\r\n * <home_account_id*>-\\<environment>-<credential_type>-<client_id>-<realm\\*>-<target\\*>-<scheme\\*>\r\n */\r\n static generateCredentialCacheKey(\r\n homeAccountId: string,\r\n environment: string,\r\n credentialType: CredentialType,\r\n clientId: string,\r\n realm?: string,\r\n target?: string,\r\n familyId?: string,\r\n tokenType?: AuthenticationScheme,\r\n requestedClaimsHash?: string\r\n ): string {\r\n const credentialKey = [\r\n this.generateAccountIdForCacheKey(homeAccountId, environment),\r\n this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),\r\n this.generateTargetForCacheKey(target),\r\n this.generateClaimsHashForCacheKey(requestedClaimsHash),\r\n this.generateSchemeForCacheKey(tokenType)\r\n ];\r\n\r\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * generates Account Id for keys\r\n * @param homeAccountId\r\n * @param environment\r\n */\r\n private static generateAccountIdForCacheKey(\r\n homeAccountId: string,\r\n environment: string\r\n ): string {\r\n const accountId: Array<string> = [homeAccountId, environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generates Credential Id for keys\r\n * @param credentialType\r\n * @param realm\r\n * @param clientId\r\n * @param familyId\r\n */\r\n private static generateCredentialIdForCacheKey(\r\n credentialType: CredentialType,\r\n clientId: string,\r\n realm?: string,\r\n familyId?: string\r\n ): string {\r\n const clientOrFamilyId =\r\n credentialType === CredentialType.REFRESH_TOKEN\r\n ? familyId || clientId\r\n : clientId;\r\n const credentialId: Array<string> = [\r\n credentialType,\r\n clientOrFamilyId,\r\n realm || Constants.EMPTY_STRING,\r\n ];\r\n\r\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate target key component as per schema: <target>\r\n */\r\n private static generateTargetForCacheKey(scopes?: string): string {\r\n return (scopes || Constants.EMPTY_STRING).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate requested claims key component as per schema: <requestedClaims>\r\n */\r\n private static generateClaimsHashForCacheKey(requestedClaimsHash?: string): string {\r\n return(requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate scheme key componenet as per schema: <scheme>\r\n */\r\n private static generateSchemeForCacheKey(tokenType?: string): string {\r\n /*\r\n * PoP Tokens and SSH certs include scheme in cache key\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAAA;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;IAsBA;KAyLC;;;;IAxKG,4CAAiB,GAAjB;QACI,OAAO,gBAAgB,CAAC,4BAA4B,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;KAC9F;;;;IAKD,+CAAoB,GAApB;QACI,OAAO,gBAAgB,CAAC,+BAA+B,CACnD,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,QAAQ,CAChB,CAAC;KACL;;;;IAKD,yCAAc,GAAd;QACI,OAAO,gBAAgB,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAClE;;;;IAKD,gDAAqB,GAArB;QACI,OAAO,gBAAgB,CAAC,0BAA0B,CAC9C,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,mBAAmB,CAC3B,CAAC;KACL;;;;IAKD,uCAAY,GAAZ;QACI,QAAQ,IAAI,CAAC,cAAc;YACvB,KAAK,cAAc,CAAC,QAAQ;gBACxB,OAAO,SAAS,CAAC,QAAQ,CAAC;YAC9B,KAAK,cAAc,CAAC,YAAY,CAAC;YACjC,KAAK,cAAc,CAAC,6BAA6B;gBAC7C,OAAO,SAAS,CAAC,YAAY,CAAC;YAClC,KAAK,cAAc,CAAC,aAAa;gBAC7B,OA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ache/entities/IdTokenEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { CredentialEntity } from \"./CredentialEntity\";\nimport { CredentialType } from \"../../utils/Constants\";\n\n/**\n * ID_TOKEN Cache\n *\n * Key:Value Schema:\n *\n * Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-\n *\n * Value Schema:\n * {\n * homeAccountId: home account identifier for the auth scheme,\n * environment: entity that issued the token, represented as a full host\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\n * clientId: client ID of the application\n * secret: Actual credential as a string\n * realm: Full tenant or organizational identifier that the account belongs to\n * }\n */\nexport class IdTokenEntity extends CredentialEntity {\n realm: string;\n\n /**\n * Create IdTokenEntity\n * @param homeAccountId\n * @param authenticationResult\n * @param clientId\n * @param authority\n */\n static createIdTokenEntity(\n homeAccountId: string,\n environment: string,\n idToken: string,\n clientId: string,\n tenantId: string,\n oboAssertion?: string\n ): IdTokenEntity {\n const idTokenEntity = new IdTokenEntity();\n\n idTokenEntity.credentialType = CredentialType.ID_TOKEN;\n idTokenEntity.homeAccountId = homeAccountId;\n idTokenEntity.environment = environment;\n idTokenEntity.clientId = clientId;\n idTokenEntity.secret = idToken;\n idTokenEntity.realm = tenantId;\n idTokenEntity.oboAssertion = oboAssertion;\n\n return idTokenEntity;\n }\n\n /**\n * Validates an entity: checks for all expected params\n * @param entity\n */\n static isIdTokenEntity(entity: object): boolean {\n\n if (!entity) {\n return false;\n }\n\n return (\n entity.hasOwnProperty(\"homeAccountId\") &&\n entity.hasOwnProperty(\"environment\") &&\n entity.hasOwnProperty(\"credentialType\") &&\n entity.hasOwnProperty(\"realm\") &&\n entity.hasOwnProperty(\"clientId\") &&\n entity.hasOwnProperty(\"secret\") &&\n entity[\"credentialType\"] === CredentialType.ID_TOKEN\n );\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAQA;;;;;;;;;;;;;;;;;;IAiBmC,iCAAgB;IAAnD;;KAmDC;;;;;;;;IAzCU,iCAAmB,GAA1B,UACI,aAAqB,EACrB,WAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,YAAqB;QAErB,IAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAE1C,aAAa,CAAC,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC;QACvD,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC;QAC5C,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC;QACxC,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAClC,aAAa,CAAC,MAAM,GAAG,OAAO,CAAC;QAC/B,aAAa,CAAC,KAAK,GAAG,QAAQ,CAAC;QAC/B,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC;QAE1C,OAAO,aAAa,CAAC;KACxB;;;;;IAMM,6BAAe,GAAtB,UAAuB,MAAc;QAEjC,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,KAAK,CAAC;SAChB;QAED,QACI,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC;YACtC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;YAC9B,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC;YACjC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC/B,MAAM,CAAC,gBAAgB,CAAC,KAAK,cAAc,CAAC,QAAQ,EACtD;KACL;IACL,oBAAC;AAAD,CAnDA,CAAmC,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"IdTokenEntity.js","sources":["../../../src/cache/entities/IdTokenEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CredentialEntity } from \"./CredentialEntity\";\r\nimport { CredentialType } from \"../../utils/Constants\";\r\n\r\n/**\r\n * ID_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * }\r\n */\r\nexport class IdTokenEntity extends CredentialEntity {\r\n realm: string;\r\n\r\n /**\r\n * Create IdTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n static createIdTokenEntity(\r\n homeAccountId: string,\r\n environment: string,\r\n idToken: string,\r\n clientId: string,\r\n tenantId: string,\r\n oboAssertion?: string\r\n ): IdTokenEntity {\r\n const idTokenEntity = new IdTokenEntity();\r\n\r\n idTokenEntity.credentialType = CredentialType.ID_TOKEN;\r\n idTokenEntity.homeAccountId = homeAccountId;\r\n idTokenEntity.environment = environment;\r\n idTokenEntity.clientId = clientId;\r\n idTokenEntity.secret = idToken;\r\n idTokenEntity.realm = tenantId;\r\n idTokenEntity.oboAssertion = oboAssertion;\r\n\r\n return idTokenEntity;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isIdTokenEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.ID_TOKEN\r\n );\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAQA;;;;;;;;;;;;;;;;;;IAiBmC,iCAAgB;IAAnD;;KAmDC;;;;;;;;IAzCU,iCAAmB,GAA1B,UACI,aAAqB,EACrB,WAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,YAAqB;QAErB,IAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;QAE1C,aAAa,CAAC,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC;QACvD,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC;QAC5C,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC;QACxC,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAClC,aAAa,CAAC,MAAM,GAAG,OAAO,CAAC;QAC/B,aAAa,CAAC,KAAK,GAAG,QAAQ,CAAC;QAC/B,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC;QAE1C,OAAO,aAAa,CAAC;KACxB;;;;;IAMM,6BAAe,GAAtB,UAAuB,MAAc;QAEjC,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,KAAK,CAAC;SAChB;QAED,QACI,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC;YACtC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;YAC9B,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC;YACjC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC/B,MAAM,CAAC,gBAAgB,CAAC,KAAK,cAAc,CAAC,QAAQ,EACtD;KACL;IACL,oBAAC;AAAD,CAnDA,CAAmC,gBAAgB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshTokenEntity.js","sources":["../../../src/cache/entities/RefreshTokenEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { CredentialEntity } from \"./CredentialEntity\";\nimport { CredentialType } from \"../../utils/Constants\";\n\n/**\n * REFRESH_TOKEN Cache\n *\n * Key:Value Schema:\n *\n * Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--\n *\n * Value:\n * {\n * homeAccountId: home account identifier for the auth scheme,\n * environment: entity that issued the token, represented as a full host\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\n * clientId: client ID of the application\n * secret: Actual credential as a string\n * familyId: Family ID identifier, '1' represents Microsoft Family\n * realm: Full tenant or organizational identifier that the account belongs to\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\n * }\n */\nexport class RefreshTokenEntity extends CredentialEntity {\n familyId?: string;\n\n /**\n * Create RefreshTokenEntity\n * @param homeAccountId\n * @param authenticationResult\n * @param clientId\n * @param authority\n */\n static createRefreshTokenEntity(\n homeAccountId: string,\n environment: string,\n refreshToken: string,\n clientId: string,\n familyId?: string,\n oboAssertion?: string\n ): RefreshTokenEntity {\n const rtEntity = new RefreshTokenEntity();\n\n rtEntity.clientId = clientId;\n rtEntity.credentialType = CredentialType.REFRESH_TOKEN;\n rtEntity.environment = environment;\n rtEntity.homeAccountId = homeAccountId;\n rtEntity.secret = refreshToken;\n rtEntity.oboAssertion = oboAssertion;\n\n if (familyId)\n rtEntity.familyId = familyId;\n\n return rtEntity;\n }\n\n /**\n * Validates an entity: checks for all expected params\n * @param entity\n */\n static isRefreshTokenEntity(entity: object): boolean {\n\n if (!entity) {\n return false;\n }\n\n return (\n entity.hasOwnProperty(\"homeAccountId\") &&\n entity.hasOwnProperty(\"environment\") &&\n entity.hasOwnProperty(\"credentialType\") &&\n entity.hasOwnProperty(\"clientId\") &&\n entity.hasOwnProperty(\"secret\") &&\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN\n );\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAQA;;;;;;;;;;;;;;;;;;;;IAmBwC,sCAAgB;IAAxD;;KAoDC;;;;;;;;IA1CU,2CAAwB,GAA/B,UACI,aAAqB,EACrB,WAAmB,EACnB,YAAoB,EACpB,QAAgB,EAChB,QAAiB,EACjB,YAAqB;QAErB,IAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAE1C,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;QACvD,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;QACnC,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC;QAC/B,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;QAErC,IAAI,QAAQ;YACR,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEjC,OAAO,QAAQ,CAAC;KACnB;;;;;IAMM,uCAAoB,GAA3B,UAA4B,MAAc;QAEtC,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,KAAK,CAAC;SAChB;QAED,QACI,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC;YACtC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC;YACjC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC/B,MAAM,CAAC,gBAAgB,CAAC,KAAK,cAAc,CAAC,aAAa,EAC3D;KACL;IACL,yBAAC;AAAD,CApDA,CAAwC,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"RefreshTokenEntity.js","sources":["../../../src/cache/entities/RefreshTokenEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CredentialEntity } from \"./CredentialEntity\";\r\nimport { CredentialType } from \"../../utils/Constants\";\r\n\r\n/**\r\n * REFRESH_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--\r\n *\r\n * Value:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * }\r\n */\r\nexport class RefreshTokenEntity extends CredentialEntity {\r\n familyId?: string;\r\n\r\n /**\r\n * Create RefreshTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n static createRefreshTokenEntity(\r\n homeAccountId: string,\r\n environment: string,\r\n refreshToken: string,\r\n clientId: string,\r\n familyId?: string,\r\n oboAssertion?: string\r\n ): RefreshTokenEntity {\r\n const rtEntity = new RefreshTokenEntity();\r\n\r\n rtEntity.clientId = clientId;\r\n rtEntity.credentialType = CredentialType.REFRESH_TOKEN;\r\n rtEntity.environment = environment;\r\n rtEntity.homeAccountId = homeAccountId;\r\n rtEntity.secret = refreshToken;\r\n rtEntity.oboAssertion = oboAssertion;\r\n\r\n if (familyId)\r\n rtEntity.familyId = familyId;\r\n\r\n return rtEntity;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isRefreshTokenEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN\r\n );\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AAAA;;;;AAQA;;;;;;;;;;;;;;;;;;;;IAmBwC,sCAAgB;IAAxD;;KAoDC;;;;;;;;IA1CU,2CAAwB,GAA/B,UACI,aAAqB,EACrB,WAAmB,EACnB,YAAoB,EACpB,QAAgB,EAChB,QAAiB,EACjB,YAAqB;QAErB,IAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAE1C,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC,aAAa,CAAC;QACvD,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;QACnC,QAAQ,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC;QAC/B,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;QAErC,IAAI,QAAQ;YACR,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEjC,OAAO,QAAQ,CAAC;KACnB;;;;;IAMM,uCAAoB,GAA3B,UAA4B,MAAc;QAEtC,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,KAAK,CAAC;SAChB;QAED,QACI,MAAM,CAAC,cAAc,CAAC,eAAe,CAAC;YACtC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACvC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC;YACjC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC/B,MAAM,CAAC,gBAAgB,CAAC,KAAK,cAAc,CAAC,aAAa,EAC3D;KACL;IACL,yBAAC;AAAD,CApDA,CAAwC,gBAAgB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTelemetryEntity.js","sources":["../../../src/cache/entities/ServerTelemetryEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SERVER_TELEM_CONSTANTS } from \"../../utils/Constants\";\n\nexport class ServerTelemetryEntity {\n failedRequests: Array<string|number>;\n errors: string[];\n cacheHits: number;\n\n constructor() {\n this.failedRequests = [];\n this.errors = [];\n this.cacheHits = 0;\n }\n\n /**\n * validates if a given cache entry is \"Telemetry\", parses <key,value>\n * @param key\n * @param entity\n */\n static isServerTelemetryEntity(key: string, entity?: object): boolean {\n\n const validateKey: boolean = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\n let validateEntity: boolean = true;\n\n if (entity) {\n validateEntity =\n entity.hasOwnProperty(\"failedRequests\") &&\n entity.hasOwnProperty(\"errors\") &&\n entity.hasOwnProperty(\"cacheHits\");\n }\n\n return validateKey && validateEntity;\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;IAYI;QACI,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;KACtB;;;;;;IAOM,6CAAuB,GAA9B,UAA+B,GAAW,EAAE,MAAe;QAEvD,IAAM,WAAW,GAAY,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjF,IAAI,cAAc,GAAY,IAAI,CAAC;QAEnC,IAAI,MAAM,EAAE;YACR,cAAc;gBACV,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;oBACvC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;oBAC/B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,WAAW,IAAI,cAAc,CAAC;KACxC;IACL,4BAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ServerTelemetryEntity.js","sources":["../../../src/cache/entities/ServerTelemetryEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { SERVER_TELEM_CONSTANTS } from \"../../utils/Constants\";\r\n\r\nexport class ServerTelemetryEntity {\r\n failedRequests: Array<string|number>;\r\n errors: string[];\r\n cacheHits: number;\r\n\r\n constructor() {\r\n this.failedRequests = [];\r\n this.errors = [];\r\n this.cacheHits = 0;\r\n }\r\n\r\n /**\r\n * validates if a given cache entry is \"Telemetry\", parses <key,value>\r\n * @param key\r\n * @param entity\r\n */\r\n static isServerTelemetryEntity(key: string, entity?: object): boolean {\r\n\r\n const validateKey: boolean = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\r\n let validateEntity: boolean = true;\r\n\r\n if (entity) {\r\n validateEntity =\r\n entity.hasOwnProperty(\"failedRequests\") &&\r\n entity.hasOwnProperty(\"errors\") &&\r\n entity.hasOwnProperty(\"cacheHits\");\r\n }\r\n\r\n return validateKey && validateEntity;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAAA;;;;;IAYI;QACI,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;KACtB;;;;;;IAOM,6CAAuB,GAA9B,UAA+B,GAAW,EAAE,MAAe;QAEvD,IAAM,WAAW,GAAY,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjF,IAAI,cAAc,GAAY,IAAI,CAAC;QAEnC,IAAI,MAAM,EAAE;YACR,cAAc;gBACV,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;oBACvC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;oBAC/B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,WAAW,IAAI,cAAc,CAAC;KACxC;IACL,4BAAC;AAAD,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThrottlingEntity.js","sources":["../../../src/cache/entities/ThrottlingEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ThrottlingConstants } from \"../../utils/Constants\";\n\nexport class ThrottlingEntity {\n // Unix-time value representing the expiration of the throttle\n throttleTime: number;\n // Information provided by the server\n error?: string;\n errorCodes?: Array<string>;\n errorMessage?: string;\n subError?: string;\n\n /**\n * validates if a given cache entry is \"Throttling\", parses <key,value>\n * @param key\n * @param entity\n */\n static isThrottlingEntity(key: string, entity?: object): boolean {\n \n let validateKey: boolean = false;\n if (key) {\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\n }\n \n let validateEntity: boolean = true;\n if (entity) {\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\n }\n\n return validateKey && validateEntity;\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;;;IAOA;KA4BC;;;;;;IAdU,mCAAkB,GAAzB,UAA0B,GAAW,EAAE,MAAe;QAElD,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,GAAG,EAAE;YACL,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,cAAc,GAAY,IAAI,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;SAC1D;QAED,OAAO,WAAW,IAAI,cAAc,CAAC;KACxC;IACL,uBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ThrottlingEntity.js","sources":["../../../src/cache/entities/ThrottlingEntity.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ThrottlingConstants } from \"../../utils/Constants\";\r\n\r\nexport class ThrottlingEntity {\r\n // Unix-time value representing the expiration of the throttle\r\n throttleTime: number;\r\n // Information provided by the server\r\n error?: string;\r\n errorCodes?: Array<string>;\r\n errorMessage?: string;\r\n subError?: string;\r\n\r\n /**\r\n * validates if a given cache entry is \"Throttling\", parses <key,value>\r\n * @param key\r\n * @param entity\r\n */\r\n static isThrottlingEntity(key: string, entity?: object): boolean {\r\n \r\n let validateKey: boolean = false;\r\n if (key) {\r\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\r\n }\r\n \r\n let validateEntity: boolean = true;\r\n if (entity) {\r\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\r\n }\r\n\r\n return validateKey && validateEntity;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAAA;;;;;IAOA;KA4BC;;;;;;IAdU,mCAAkB,GAAzB,UAA0B,GAAW,EAAE,MAAe;QAElD,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,GAAG,EAAE;YACL,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;SAC1E;QAED,IAAI,cAAc,GAAY,IAAI,CAAC;QACnC,IAAI,MAAM,EAAE;YACR,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;SAC1D;QAED,OAAO,WAAW,IAAI,cAAc,CAAC;KACxC;IACL,uBAAC;AAAD,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCacheContext.js","sources":["../../../src/cache/persistence/TokenCacheContext.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISerializableTokenCache } from \"../interface/ISerializableTokenCache\";\n\n/**\n * This class instance helps track the memory changes facilitating\n * decisions to read from and write to the persistent cache\n */export class TokenCacheContext {\n /**\n * boolean indicating cache change\n */\n hasChanged: boolean;\n /**\n * serializable token cache interface\n */\n cache: ISerializableTokenCache;\n\n constructor(tokenCache: ISerializableTokenCache, hasChanged: boolean) {\n this.cache = tokenCache;\n this.hasChanged = hasChanged;\n }\n\n /**\n * boolean which indicates the changes in cache\n */\n get cacheHasChanged(): boolean {\n return this.hasChanged;\n }\n\n /**\n * function to retrieve the token cache\n */\n get tokenCache(): ISerializableTokenCache {\n return this.cache;\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;AAOA;;;;IAaI,2BAAY,UAAmC,EAAE,UAAmB;QAChE,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;KAChC;IAKD,sBAAI,8CAAe;;;;aAAnB;YACI,OAAO,IAAI,CAAC,UAAU,CAAC;SAC1B;;;OAAA;IAKD,sBAAI,yCAAU;;;;aAAd;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;SACrB;;;OAAA;IACL,wBAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"TokenCacheContext.js","sources":["../../../src/cache/persistence/TokenCacheContext.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ISerializableTokenCache } from \"../interface/ISerializableTokenCache\";\r\n\r\n/**\r\n * This class instance helps track the memory changes facilitating\r\n * decisions to read from and write to the persistent cache\r\n */export class TokenCacheContext {\r\n /**\r\n * boolean indicating cache change\r\n */\r\n hasChanged: boolean;\r\n /**\r\n * serializable token cache interface\r\n */\r\n cache: ISerializableTokenCache;\r\n\r\n constructor(tokenCache: ISerializableTokenCache, hasChanged: boolean) {\r\n this.cache = tokenCache;\r\n this.hasChanged = hasChanged;\r\n }\r\n\r\n /**\r\n * boolean which indicates the changes in cache\r\n */\r\n get cacheHasChanged(): boolean {\r\n return this.hasChanged;\r\n }\r\n\r\n /**\r\n * function to retrieve the token cache\r\n */\r\n get tokenCache(): ISerializableTokenCache {\r\n return this.cache;\r\n }\r\n}\r\n"],"names":[],"mappings":";;AAAA;;;;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B;IAUlC;;;OAGG;YACW,sBAAsB;IAmHpC;;;OAGG;YACW,4BAA4B;IAsH1C;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA8BlC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAO5B"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/*! @azure/msal-common v6.0.0 2022-
|
|
1
|
+
/*! @azure/msal-common v6.3.0-beta.0 2022-04-27 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';
|
|
4
4
|
import { BaseClient } from './BaseClient.js';
|
|
5
5
|
import { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Separators, AADServerParamKeys, AuthenticationScheme, GrantType, PromptValue } from '../utils/Constants.js';
|
|
7
7
|
import { ResponseHandler } from '../response/ResponseHandler.js';
|
|
8
8
|
import { StringUtils } from '../utils/StringUtils.js';
|
|
9
9
|
import { ClientAuthError } from '../error/ClientAuthError.js';
|
|
10
10
|
import { UrlString } from '../url/UrlString.js';
|
|
11
11
|
import { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';
|
|
12
12
|
import { TimeUtils } from '../utils/TimeUtils.js';
|
|
13
|
-
import {
|
|
13
|
+
import { buildClientInfo, buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';
|
|
14
14
|
import { CcsCredentialType } from '../account/CcsCredential.js';
|
|
15
15
|
import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
|
|
16
16
|
import { RequestValidator } from '../request/RequestValidator.js';
|
|
@@ -44,8 +44,12 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
44
44
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
45
|
var queryString;
|
|
46
46
|
return __generator(this, function (_a) {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0: return [4 /*yield*/, this.createAuthCodeUrlQueryString(request)];
|
|
49
|
+
case 1:
|
|
50
|
+
queryString = _a.sent();
|
|
51
|
+
return [2 /*return*/, UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString)];
|
|
52
|
+
}
|
|
49
53
|
});
|
|
50
54
|
});
|
|
51
55
|
};
|
|
@@ -201,6 +205,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
201
205
|
parameterBuilder.addAuthorizationCode(request.code);
|
|
202
206
|
// Add library metadata
|
|
203
207
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
208
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
204
209
|
parameterBuilder.addThrottling();
|
|
205
210
|
if (this.serverTelemetryManager) {
|
|
206
211
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
@@ -294,95 +299,116 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
294
299
|
* @param request
|
|
295
300
|
*/
|
|
296
301
|
AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
302
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
303
|
+
var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, cnf, cnfHash;
|
|
304
|
+
return __generator(this, function (_a) {
|
|
305
|
+
switch (_a.label) {
|
|
306
|
+
case 0:
|
|
307
|
+
parameterBuilder = new RequestParameterBuilder();
|
|
308
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
309
|
+
requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);
|
|
310
|
+
parameterBuilder.addScopes(requestScopes);
|
|
311
|
+
// validate the redirectUri (to be a non null value)
|
|
312
|
+
parameterBuilder.addRedirectUri(request.redirectUri);
|
|
313
|
+
correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
314
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
315
|
+
// add response_mode. If not passed in it defaults to query.
|
|
316
|
+
parameterBuilder.addResponseMode(request.responseMode);
|
|
317
|
+
// add response_type = code
|
|
318
|
+
parameterBuilder.addResponseTypeCode();
|
|
319
|
+
// add library info parameters
|
|
320
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
321
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
322
|
+
// add client_info=1
|
|
323
|
+
parameterBuilder.addClientInfo();
|
|
324
|
+
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
325
|
+
parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);
|
|
326
|
+
}
|
|
327
|
+
if (request.prompt) {
|
|
328
|
+
parameterBuilder.addPrompt(request.prompt);
|
|
329
|
+
}
|
|
330
|
+
if (request.domainHint) {
|
|
331
|
+
parameterBuilder.addDomainHint(request.domainHint);
|
|
332
|
+
}
|
|
333
|
+
// Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
|
|
334
|
+
if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
|
|
335
|
+
// AAD will throw if prompt=select_account is passed with an account hint
|
|
336
|
+
if (request.sid && request.prompt === PromptValue.NONE) {
|
|
337
|
+
// SessionID is only used in silent calls
|
|
338
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request");
|
|
339
|
+
parameterBuilder.addSid(request.sid);
|
|
340
|
+
}
|
|
341
|
+
else if (request.account) {
|
|
342
|
+
accountSid = this.extractAccountSid(request.account);
|
|
343
|
+
// If account and loginHint are provided, we will check account first for sid before adding loginHint
|
|
344
|
+
if (accountSid && request.prompt === PromptValue.NONE) {
|
|
345
|
+
// SessionId is only used in silent calls
|
|
346
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
|
|
347
|
+
parameterBuilder.addSid(accountSid);
|
|
348
|
+
try {
|
|
349
|
+
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
350
|
+
parameterBuilder.addCcsOid(clientInfo);
|
|
351
|
+
}
|
|
352
|
+
catch (e) {
|
|
353
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else if (request.loginHint) {
|
|
357
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request");
|
|
358
|
+
parameterBuilder.addLoginHint(request.loginHint);
|
|
359
|
+
parameterBuilder.addCcsUpn(request.loginHint);
|
|
360
|
+
}
|
|
361
|
+
else if (request.account.username) {
|
|
362
|
+
// Fallback to account username if provided
|
|
363
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
364
|
+
parameterBuilder.addLoginHint(request.account.username);
|
|
365
|
+
try {
|
|
366
|
+
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
367
|
+
parameterBuilder.addCcsOid(clientInfo);
|
|
368
|
+
}
|
|
369
|
+
catch (e) {
|
|
370
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else if (request.loginHint) {
|
|
375
|
+
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
376
|
+
parameterBuilder.addLoginHint(request.loginHint);
|
|
377
|
+
parameterBuilder.addCcsUpn(request.loginHint);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
382
|
+
}
|
|
383
|
+
if (request.nonce) {
|
|
384
|
+
parameterBuilder.addNonce(request.nonce);
|
|
385
|
+
}
|
|
386
|
+
if (request.state) {
|
|
387
|
+
parameterBuilder.addState(request.state);
|
|
388
|
+
}
|
|
389
|
+
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
390
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
391
|
+
}
|
|
392
|
+
if (request.extraQueryParameters) {
|
|
393
|
+
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
394
|
+
}
|
|
395
|
+
if (!request.nativeBroker) return [3 /*break*/, 3];
|
|
396
|
+
// signal ests that this is a WAM call
|
|
397
|
+
parameterBuilder.addNativeBroker();
|
|
398
|
+
if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 3];
|
|
399
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
400
|
+
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
401
|
+
case 1:
|
|
402
|
+
cnf = _a.sent();
|
|
403
|
+
return [4 /*yield*/, popTokenGenerator.generateCnfHash(cnf)];
|
|
404
|
+
case 2:
|
|
405
|
+
cnfHash = _a.sent();
|
|
406
|
+
parameterBuilder.addPopToken(cnfHash);
|
|
407
|
+
_a.label = 3;
|
|
408
|
+
case 3: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
362
409
|
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
366
|
-
parameterBuilder.addLoginHint(request.loginHint);
|
|
367
|
-
parameterBuilder.addCcsUpn(request.loginHint);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
372
|
-
}
|
|
373
|
-
if (request.nonce) {
|
|
374
|
-
parameterBuilder.addNonce(request.nonce);
|
|
375
|
-
}
|
|
376
|
-
if (request.state) {
|
|
377
|
-
parameterBuilder.addState(request.state);
|
|
378
|
-
}
|
|
379
|
-
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
380
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
381
|
-
}
|
|
382
|
-
if (request.extraQueryParameters) {
|
|
383
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
384
|
-
}
|
|
385
|
-
return parameterBuilder.createQueryString();
|
|
410
|
+
});
|
|
411
|
+
});
|
|
386
412
|
};
|
|
387
413
|
/**
|
|
388
414
|
* This API validates the `EndSessionRequest` and creates a URL
|
|
@@ -402,6 +428,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
402
428
|
if (request.state) {
|
|
403
429
|
parameterBuilder.addState(request.state);
|
|
404
430
|
}
|
|
431
|
+
if (request.logoutHint) {
|
|
432
|
+
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
433
|
+
}
|
|
405
434
|
if (request.extraQueryParameters) {
|
|
406
435
|
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
407
436
|
}
|