@azure/msal-common 15.13.3 → 16.0.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/dist/account/AccountInfo.d.ts +0 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +1 -1
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +2 -3
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +4 -6
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.d.ts +2 -2
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +89 -105
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +6 -2
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +8 -5
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +2 -2
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +34 -31
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +0 -1
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OIDCOptions.d.ts +2 -2
- package/dist/authority/OIDCOptions.d.ts.map +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.d.ts +3 -3
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +14 -15
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.d.ts +26 -19
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +70 -83
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +0 -4
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +4 -56
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts +0 -2
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +35 -17
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/AccountEntityUtils.d.ts +53 -0
- package/dist/cache/utils/AccountEntityUtils.d.ts.map +1 -0
- package/dist/cache/utils/AccountEntityUtils.mjs +192 -0
- package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -0
- package/dist/cache/utils/CacheHelpers.d.ts +2 -2
- package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +10 -13
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +0 -1
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts +23 -4
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +63 -35
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts +17 -4
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +51 -37
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +17 -4
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +28 -15
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.d.ts +2 -22
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +9 -15
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.d.ts +5 -3
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +2 -2
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +3 -5
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.d.ts +1 -18
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +12 -34
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.d.ts +1 -6
- package/dist/error/CacheError.d.ts.map +1 -1
- package/dist/error/CacheError.mjs +6 -13
- package/dist/error/CacheError.mjs.map +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.d.ts +0 -229
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +3 -240
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +0 -8
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +2 -10
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.d.ts +0 -128
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +3 -134
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +0 -2
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +3 -5
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.d.ts +1 -19
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +10 -35
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.d.ts +0 -4
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +3 -8
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +1 -1
- package/dist/error/PlatformBrokerError.d.ts.map +1 -1
- package/dist/error/PlatformBrokerError.mjs +3 -2
- package/dist/error/PlatformBrokerError.mjs.map +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-browser-only.d.ts +4 -3
- package/dist/exports-browser-only.d.ts.map +1 -1
- package/dist/exports-common.d.ts +11 -8
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/exports-node-only.d.ts +2 -4
- package/dist/exports-node-only.d.ts.map +1 -1
- package/dist/index-node.mjs +15 -10
- package/dist/index-node.mjs.map +1 -1
- package/dist/index.mjs +17 -11
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts +36 -13
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +105 -22
- package/dist/logger/Logger.mjs.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/RequestThumbprint.mjs +2 -2
- package/dist/network/RequestThumbprint.mjs.map +1 -1
- package/dist/network/ThrottlingUtils.d.ts.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +6 -7
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.d.ts +1 -2
- package/dist/protocol/Authorize.d.ts.map +1 -1
- package/dist/protocol/Authorize.mjs +14 -14
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/protocol/Token.d.ts +40 -0
- package/dist/protocol/Token.d.ts.map +1 -0
- package/dist/protocol/Token.mjs +129 -0
- package/dist/protocol/Token.mjs.map +1 -0
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +3 -3
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +4 -8
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +2 -1
- package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +2 -4
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +2 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +2 -1
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +6 -12
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +11 -24
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +5 -5
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/AuthenticationResult.d.ts +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts +7 -6
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +41 -43
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +0 -29
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +5 -81
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +24 -170
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +1 -280
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +2 -483
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvents.d.ts +66 -0
- package/dist/telemetry/performance/PerformanceEvents.d.ts.map +1 -0
- package/dist/telemetry/performance/PerformanceEvents.mjs +74 -0
- package/dist/telemetry/performance/PerformanceEvents.mjs.map +1 -0
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +0 -4
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +2 -26
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +2 -2
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +28 -30
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts +0 -5
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +5 -13
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.d.ts +81 -112
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +100 -127
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts +2 -2
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +19 -20
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/ProtocolUtils.d.ts +14 -35
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +57 -61
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StateTypes.d.ts +15 -0
- package/dist/utils/StateTypes.d.ts.map +1 -0
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.d.ts +1 -2
- package/dist/utils/UrlUtils.d.ts.map +1 -1
- package/dist/utils/UrlUtils.mjs +3 -10
- package/dist/utils/UrlUtils.mjs.map +1 -1
- package/lib/index-browser.cjs +26 -206
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-4Jss3kYh.js → index-node-B7mR4APO.js} +3494 -4270
- package/lib/index-node-B7mR4APO.js.map +1 -0
- package/lib/index-node.cjs +6 -34
- package/lib/index-node.cjs.map +1 -1
- package/lib/index.cjs +5 -34
- package/lib/index.cjs.map +1 -1
- package/lib/types/account/AccountInfo.d.ts +0 -1
- package/lib/types/account/AccountInfo.d.ts.map +1 -1
- package/lib/types/account/AuthToken.d.ts.map +1 -1
- package/lib/types/account/ClientInfo.d.ts.map +1 -1
- package/lib/types/authority/Authority.d.ts +2 -2
- package/lib/types/authority/Authority.d.ts.map +1 -1
- package/lib/types/authority/AuthorityFactory.d.ts +6 -2
- package/lib/types/authority/AuthorityFactory.d.ts.map +1 -1
- package/lib/types/authority/AuthorityMetadata.d.ts +2 -2
- package/lib/types/authority/AuthorityMetadata.d.ts.map +1 -1
- package/lib/types/authority/AuthorityOptions.d.ts +0 -1
- package/lib/types/authority/AuthorityOptions.d.ts.map +1 -1
- package/lib/types/authority/OIDCOptions.d.ts +2 -2
- package/lib/types/authority/OIDCOptions.d.ts.map +1 -1
- package/lib/types/authority/RegionDiscovery.d.ts +3 -3
- package/lib/types/authority/RegionDiscovery.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +26 -19
- package/lib/types/cache/CacheManager.d.ts.map +1 -1
- package/lib/types/cache/entities/AccessTokenEntity.d.ts +0 -4
- package/lib/types/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/lib/types/cache/entities/AccountEntity.d.ts +4 -56
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/lib/types/cache/entities/CredentialEntity.d.ts +0 -2
- package/lib/types/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/lib/types/cache/interface/ICacheManager.d.ts +35 -17
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/lib/types/cache/utils/AccountEntityUtils.d.ts +53 -0
- package/lib/types/cache/utils/AccountEntityUtils.d.ts.map +1 -0
- package/lib/types/cache/utils/CacheHelpers.d.ts +2 -2
- package/lib/types/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/lib/types/cache/utils/CacheTypes.d.ts +0 -1
- package/lib/types/cache/utils/CacheTypes.d.ts.map +1 -1
- package/lib/types/client/AuthorizationCodeClient.d.ts +23 -4
- package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/lib/types/client/RefreshTokenClient.d.ts +17 -4
- package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
- package/lib/types/client/SilentFlowClient.d.ts +17 -4
- package/lib/types/client/SilentFlowClient.d.ts.map +1 -1
- package/lib/types/config/ClientConfiguration.d.ts +2 -22
- package/lib/types/config/ClientConfiguration.d.ts.map +1 -1
- package/lib/types/crypto/ICrypto.d.ts +5 -3
- package/lib/types/crypto/ICrypto.d.ts.map +1 -1
- package/lib/types/crypto/PopTokenGenerator.d.ts +2 -2
- package/lib/types/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/lib/types/error/AuthError.d.ts +1 -18
- package/lib/types/error/AuthError.d.ts.map +1 -1
- package/lib/types/error/CacheError.d.ts +1 -6
- package/lib/types/error/CacheError.d.ts.map +1 -1
- package/lib/types/error/ClientAuthError.d.ts +0 -229
- package/lib/types/error/ClientAuthError.d.ts.map +1 -1
- package/lib/types/error/ClientAuthErrorCodes.d.ts +0 -8
- package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationError.d.ts +0 -128
- package/lib/types/error/ClientConfigurationError.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts +0 -2
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/lib/types/error/InteractionRequiredAuthError.d.ts +1 -19
- package/lib/types/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/lib/types/error/JoseHeaderError.d.ts +0 -4
- package/lib/types/error/JoseHeaderError.d.ts.map +1 -1
- package/lib/types/error/PlatformBrokerError.d.ts.map +1 -1
- package/lib/types/exports-browser-only.d.ts +4 -3
- package/lib/types/exports-browser-only.d.ts.map +1 -1
- package/lib/types/exports-common.d.ts +11 -8
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/exports-node-only.d.ts +2 -4
- package/lib/types/exports-node-only.d.ts.map +1 -1
- package/lib/types/logger/Logger.d.ts +36 -13
- package/lib/types/logger/Logger.d.ts.map +1 -1
- package/lib/types/network/ThrottlingUtils.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/protocol/Authorize.d.ts +1 -2
- package/lib/types/protocol/Authorize.d.ts.map +1 -1
- package/lib/types/protocol/Token.d.ts +40 -0
- package/lib/types/protocol/Token.d.ts.map +1 -0
- package/lib/types/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/lib/types/request/BaseAuthRequest.d.ts +4 -8
- package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts +2 -1
- package/lib/types/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts +2 -4
- package/lib/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/CommonRefreshTokenRequest.d.ts +2 -1
- package/lib/types/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/lib/types/request/CommonSilentFlowRequest.d.ts +2 -1
- package/lib/types/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/lib/types/request/RequestParameterBuilder.d.ts +6 -12
- package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -1
- package/lib/types/response/AuthenticationResult.d.ts +1 -1
- package/lib/types/response/AuthenticationResult.d.ts.map +1 -1
- package/lib/types/response/ResponseHandler.d.ts +7 -6
- package/lib/types/response/ResponseHandler.d.ts.map +1 -1
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts +0 -29
- package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceClient.d.ts +5 -81
- package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts +1 -280
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvents.d.ts +66 -0
- package/lib/types/telemetry/performance/PerformanceEvents.d.ts.map +1 -0
- package/lib/types/telemetry/performance/StubPerformanceClient.d.ts +0 -4
- package/lib/types/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts +2 -2
- package/lib/types/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/lib/types/url/UrlString.d.ts +0 -5
- package/lib/types/url/UrlString.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +81 -112
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/FunctionWrappers.d.ts +2 -2
- package/lib/types/utils/FunctionWrappers.d.ts.map +1 -1
- package/lib/types/utils/ProtocolUtils.d.ts +14 -35
- package/lib/types/utils/ProtocolUtils.d.ts.map +1 -1
- package/lib/types/utils/StateTypes.d.ts +15 -0
- package/lib/types/utils/StateTypes.d.ts.map +1 -0
- package/lib/types/utils/UrlUtils.d.ts +1 -2
- package/lib/types/utils/UrlUtils.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/account/AccountInfo.ts +0 -1
- package/src/account/AuthToken.ts +1 -2
- package/src/account/ClientInfo.ts +3 -6
- package/src/authority/Authority.ts +145 -146
- package/src/authority/AuthorityFactory.ts +7 -7
- package/src/authority/AuthorityMetadata.ts +54 -47
- package/src/authority/AuthorityOptions.ts +0 -1
- package/src/authority/OIDCOptions.ts +2 -2
- package/src/authority/RegionDiscovery.ts +20 -33
- package/src/cache/CacheManager.ts +177 -128
- package/src/cache/entities/AccessTokenEntity.ts +0 -4
- package/src/cache/entities/AccountEntity.ts +4 -292
- package/src/cache/entities/CredentialEntity.ts +0 -2
- package/src/cache/interface/ICacheManager.ts +55 -20
- package/src/cache/utils/AccountEntityUtils.ts +258 -0
- package/src/cache/utils/CacheHelpers.ts +23 -37
- package/src/cache/utils/CacheTypes.ts +0 -1
- package/src/client/AuthorizationCodeClient.ts +146 -58
- package/src/client/RefreshTokenClient.ts +108 -65
- package/src/client/SilentFlowClient.ts +74 -25
- package/src/config/ClientConfiguration.ts +9 -37
- package/src/crypto/ICrypto.ts +5 -3
- package/src/crypto/PopTokenGenerator.ts +3 -13
- package/src/error/AuthError.ts +11 -30
- package/src/error/CacheError.ts +4 -15
- package/src/error/ClientAuthError.ts +1 -317
- package/src/error/ClientAuthErrorCodes.ts +0 -8
- package/src/error/ClientConfigurationError.ts +1 -202
- package/src/error/ClientConfigurationErrorCodes.ts +0 -4
- package/src/error/InteractionRequiredAuthError.ts +8 -48
- package/src/error/JoseHeaderError.ts +1 -8
- package/src/error/PlatformBrokerError.ts +2 -1
- package/src/exports-browser-only.ts +2 -6
- package/src/exports-common.ts +8 -40
- package/src/exports-node-only.ts +5 -4
- package/src/logger/Logger.ts +174 -39
- package/src/network/RequestThumbprint.ts +1 -1
- package/src/network/ThrottlingUtils.ts +12 -15
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +24 -20
- package/src/protocol/Token.ts +230 -0
- package/src/request/AuthenticationHeaderParser.ts +2 -4
- package/src/request/BaseAuthRequest.ts +4 -8
- package/src/request/CommonAuthorizationCodeRequest.ts +2 -1
- package/src/request/CommonAuthorizationUrlRequest.ts +2 -4
- package/src/request/CommonRefreshTokenRequest.ts +2 -1
- package/src/request/CommonSilentFlowRequest.ts +2 -1
- package/src/request/RequestParameterBuilder.ts +35 -50
- package/src/request/ScopeSet.ts +4 -4
- package/src/response/AuthenticationResult.ts +1 -1
- package/src/response/ResponseHandler.ts +56 -60
- package/src/telemetry/performance/IPerformanceClient.ts +0 -40
- package/src/telemetry/performance/PerformanceClient.ts +26 -295
- package/src/telemetry/performance/PerformanceEvent.ts +3 -582
- package/src/telemetry/performance/PerformanceEvents.ts +98 -0
- package/src/telemetry/performance/StubPerformanceClient.ts +0 -16
- package/src/telemetry/server/ServerTelemetryManager.ts +33 -44
- package/src/url/UrlString.ts +3 -12
- package/src/utils/Constants.ts +103 -140
- package/src/utils/FunctionWrappers.ts +28 -29
- package/src/utils/ProtocolUtils.ts +67 -93
- package/src/utils/StateTypes.ts +20 -0
- package/src/utils/UrlUtils.ts +2 -15
- package/dist/cache/entities/AccountEntity.mjs +0 -232
- package/dist/cache/entities/AccountEntity.mjs.map +0 -1
- package/dist/client/BaseClient.d.ts +0 -59
- package/dist/client/BaseClient.d.ts.map +0 -1
- package/dist/client/BaseClient.mjs +0 -167
- package/dist/client/BaseClient.mjs.map +0 -1
- package/dist/index-browser.mjs +0 -72
- package/dist/index-browser.mjs.map +0 -1
- package/dist/request/CommonClientCredentialRequest.d.ts +0 -18
- package/dist/request/CommonClientCredentialRequest.d.ts.map +0 -1
- package/dist/request/CommonDeviceCodeRequest.d.ts +0 -22
- package/dist/request/CommonDeviceCodeRequest.d.ts.map +0 -1
- package/dist/request/CommonOnBehalfOfRequest.d.ts +0 -14
- package/dist/request/CommonOnBehalfOfRequest.d.ts.map +0 -1
- package/dist/request/CommonUsernamePasswordRequest.d.ts +0 -18
- package/dist/request/CommonUsernamePasswordRequest.d.ts.map +0 -1
- package/lib/index-node-4Jss3kYh.js.map +0 -1
- package/lib/types/client/BaseClient.d.ts +0 -59
- package/lib/types/client/BaseClient.d.ts.map +0 -1
- package/lib/types/request/CommonClientCredentialRequest.d.ts +0 -18
- package/lib/types/request/CommonClientCredentialRequest.d.ts.map +0 -1
- package/lib/types/request/CommonDeviceCodeRequest.d.ts +0 -22
- package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +0 -1
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts +0 -14
- package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +0 -1
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts +0 -18
- package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +0 -1
- package/src/client/BaseClient.ts +0 -320
- package/src/request/CommonClientCredentialRequest.ts +0 -23
- package/src/request/CommonDeviceCodeRequest.ts +0 -31
- package/src/request/CommonOnBehalfOfRequest.ts +0 -19
- package/src/request/CommonUsernamePasswordRequest.ts +0 -23
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as Constants from "../../utils/Constants.js";
|
|
7
|
+
import { Authority } from "../../authority/Authority.js";
|
|
8
|
+
import { ICrypto } from "../../crypto/ICrypto.js";
|
|
9
|
+
import { ClientInfo, buildClientInfo } from "../../account/ClientInfo.js";
|
|
10
|
+
import {
|
|
11
|
+
AccountInfo,
|
|
12
|
+
TenantProfile,
|
|
13
|
+
buildTenantProfile,
|
|
14
|
+
DataBoundary,
|
|
15
|
+
} from "../../account/AccountInfo.js";
|
|
16
|
+
import {
|
|
17
|
+
createClientAuthError,
|
|
18
|
+
ClientAuthErrorCodes,
|
|
19
|
+
} from "../../error/ClientAuthError.js";
|
|
20
|
+
import { AuthorityType } from "../../authority/AuthorityType.js";
|
|
21
|
+
import { Logger } from "../../logger/Logger.js";
|
|
22
|
+
import {
|
|
23
|
+
TokenClaims,
|
|
24
|
+
getTenantIdFromIdTokenClaims,
|
|
25
|
+
} from "../../account/TokenClaims.js";
|
|
26
|
+
import { ProtocolMode } from "../../authority/ProtocolMode.js";
|
|
27
|
+
import { AccountEntity } from "../entities/AccountEntity.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
31
|
+
*/
|
|
32
|
+
export function generateAccountId(accountEntity: AccountEntity): string {
|
|
33
|
+
const accountId: Array<string> = [
|
|
34
|
+
accountEntity.homeAccountId,
|
|
35
|
+
accountEntity.environment,
|
|
36
|
+
];
|
|
37
|
+
return accountId.join(Constants.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the AccountInfo interface for this account.
|
|
42
|
+
*/
|
|
43
|
+
export function getAccountInfo(accountEntity: AccountEntity): AccountInfo {
|
|
44
|
+
return {
|
|
45
|
+
homeAccountId: accountEntity.homeAccountId,
|
|
46
|
+
environment: accountEntity.environment,
|
|
47
|
+
tenantId: accountEntity.realm,
|
|
48
|
+
username: accountEntity.username,
|
|
49
|
+
localAccountId: accountEntity.localAccountId,
|
|
50
|
+
loginHint: accountEntity.loginHint,
|
|
51
|
+
name: accountEntity.name,
|
|
52
|
+
nativeAccountId: accountEntity.nativeAccountId,
|
|
53
|
+
authorityType: accountEntity.authorityType,
|
|
54
|
+
// Deserialize tenant profiles array into a Map
|
|
55
|
+
tenantProfiles: new Map(
|
|
56
|
+
(accountEntity.tenantProfiles || []).map((tenantProfile) => {
|
|
57
|
+
return [tenantProfile.tenantId, tenantProfile];
|
|
58
|
+
})
|
|
59
|
+
),
|
|
60
|
+
dataBoundary: accountEntity.dataBoundary,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns true if the account entity is in single tenant format (outdated), false otherwise
|
|
66
|
+
*/
|
|
67
|
+
export function isSingleTenant(accountEntity: AccountEntity): boolean {
|
|
68
|
+
return !accountEntity.tenantProfiles;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
|
|
73
|
+
* @param accountDetails
|
|
74
|
+
*/
|
|
75
|
+
export function createAccountEntity(
|
|
76
|
+
accountDetails: {
|
|
77
|
+
homeAccountId: string;
|
|
78
|
+
idTokenClaims?: TokenClaims;
|
|
79
|
+
clientInfo?: string;
|
|
80
|
+
cloudGraphHostName?: string;
|
|
81
|
+
msGraphHost?: string;
|
|
82
|
+
environment?: string;
|
|
83
|
+
nativeAccountId?: string;
|
|
84
|
+
tenantProfiles?: Array<TenantProfile>;
|
|
85
|
+
},
|
|
86
|
+
authority: Authority,
|
|
87
|
+
base64Decode?: (input: string) => string
|
|
88
|
+
): AccountEntity {
|
|
89
|
+
let authorityType;
|
|
90
|
+
if (authority.authorityType === AuthorityType.Adfs) {
|
|
91
|
+
authorityType = Constants.CACHE_ACCOUNT_TYPE_ADFS;
|
|
92
|
+
} else if (authority.protocolMode === ProtocolMode.OIDC) {
|
|
93
|
+
authorityType = Constants.CACHE_ACCOUNT_TYPE_GENERIC;
|
|
94
|
+
} else {
|
|
95
|
+
authorityType = Constants.CACHE_ACCOUNT_TYPE_MSSTS;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let clientInfo: ClientInfo | undefined;
|
|
99
|
+
let dataBoundary: DataBoundary | undefined;
|
|
100
|
+
|
|
101
|
+
if (accountDetails.clientInfo && base64Decode) {
|
|
102
|
+
clientInfo = buildClientInfo(accountDetails.clientInfo, base64Decode);
|
|
103
|
+
if (clientInfo.xms_tdbr) {
|
|
104
|
+
dataBoundary = clientInfo.xms_tdbr === "EU" ? "EU" : "None";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const env =
|
|
109
|
+
accountDetails.environment ||
|
|
110
|
+
(authority && authority.getPreferredCache());
|
|
111
|
+
|
|
112
|
+
if (!env) {
|
|
113
|
+
throw createClientAuthError(
|
|
114
|
+
ClientAuthErrorCodes.invalidCacheEnvironment
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
120
|
+
* In most cases it will contain a single email. This field should not be relied upon if a custom
|
|
121
|
+
* policy is configured to return more than 1 email.
|
|
122
|
+
*/
|
|
123
|
+
const preferredUsername =
|
|
124
|
+
accountDetails.idTokenClaims?.preferred_username ||
|
|
125
|
+
accountDetails.idTokenClaims?.upn;
|
|
126
|
+
const email = accountDetails.idTokenClaims?.emails
|
|
127
|
+
? accountDetails.idTokenClaims.emails[0]
|
|
128
|
+
: null;
|
|
129
|
+
|
|
130
|
+
const username = preferredUsername || email || "";
|
|
131
|
+
|
|
132
|
+
const loginHint = accountDetails.idTokenClaims?.login_hint;
|
|
133
|
+
|
|
134
|
+
const realm =
|
|
135
|
+
clientInfo?.utid ||
|
|
136
|
+
getTenantIdFromIdTokenClaims(accountDetails.idTokenClaims) ||
|
|
137
|
+
""; // non-AAD scenarios can have empty realm
|
|
138
|
+
// How do you account for MSA CID here?
|
|
139
|
+
const localAccountId =
|
|
140
|
+
clientInfo?.uid ||
|
|
141
|
+
accountDetails.idTokenClaims?.oid ||
|
|
142
|
+
accountDetails.idTokenClaims?.sub ||
|
|
143
|
+
"";
|
|
144
|
+
let tenantProfiles;
|
|
145
|
+
if (accountDetails.tenantProfiles) {
|
|
146
|
+
tenantProfiles = accountDetails.tenantProfiles;
|
|
147
|
+
} else {
|
|
148
|
+
const tenantProfile = buildTenantProfile(
|
|
149
|
+
accountDetails.homeAccountId,
|
|
150
|
+
localAccountId,
|
|
151
|
+
realm,
|
|
152
|
+
accountDetails.idTokenClaims
|
|
153
|
+
);
|
|
154
|
+
tenantProfiles = [tenantProfile];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
homeAccountId: accountDetails.homeAccountId,
|
|
159
|
+
environment: env,
|
|
160
|
+
realm: realm,
|
|
161
|
+
localAccountId: localAccountId,
|
|
162
|
+
username: username,
|
|
163
|
+
authorityType: authorityType,
|
|
164
|
+
loginHint: loginHint,
|
|
165
|
+
clientInfo: accountDetails.clientInfo,
|
|
166
|
+
name: accountDetails.idTokenClaims?.name || "",
|
|
167
|
+
lastModificationTime: undefined,
|
|
168
|
+
lastModificationApp: undefined,
|
|
169
|
+
cloudGraphHostName: accountDetails.cloudGraphHostName,
|
|
170
|
+
msGraphHost: accountDetails.msGraphHost,
|
|
171
|
+
nativeAccountId: accountDetails.nativeAccountId,
|
|
172
|
+
tenantProfiles: tenantProfiles,
|
|
173
|
+
dataBoundary,
|
|
174
|
+
} as AccountEntity;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Creates an AccountEntity object from AccountInfo
|
|
179
|
+
* @param accountInfo
|
|
180
|
+
* @param cloudGraphHostName
|
|
181
|
+
* @param msGraphHost
|
|
182
|
+
* @returns
|
|
183
|
+
*/
|
|
184
|
+
export function createAccountEntityFromAccountInfo(
|
|
185
|
+
accountInfo: AccountInfo,
|
|
186
|
+
cloudGraphHostName?: string,
|
|
187
|
+
msGraphHost?: string
|
|
188
|
+
): AccountEntity {
|
|
189
|
+
return {
|
|
190
|
+
authorityType:
|
|
191
|
+
accountInfo.authorityType || Constants.CACHE_ACCOUNT_TYPE_GENERIC,
|
|
192
|
+
homeAccountId: accountInfo.homeAccountId,
|
|
193
|
+
localAccountId: accountInfo.localAccountId,
|
|
194
|
+
nativeAccountId: accountInfo.nativeAccountId,
|
|
195
|
+
realm: accountInfo.tenantId,
|
|
196
|
+
environment: accountInfo.environment,
|
|
197
|
+
username: accountInfo.username,
|
|
198
|
+
loginHint: accountInfo.loginHint,
|
|
199
|
+
name: accountInfo.name,
|
|
200
|
+
cloudGraphHostName: cloudGraphHostName,
|
|
201
|
+
msGraphHost: msGraphHost,
|
|
202
|
+
tenantProfiles: Array.from(accountInfo.tenantProfiles?.values() || []),
|
|
203
|
+
dataBoundary: accountInfo.dataBoundary,
|
|
204
|
+
} as AccountEntity;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Generate HomeAccountId from server response
|
|
209
|
+
* @param serverClientInfo
|
|
210
|
+
* @param authType
|
|
211
|
+
*/
|
|
212
|
+
export function generateHomeAccountId(
|
|
213
|
+
serverClientInfo: string,
|
|
214
|
+
authType: AuthorityType,
|
|
215
|
+
logger: Logger,
|
|
216
|
+
cryptoObj: ICrypto,
|
|
217
|
+
correlationId: string,
|
|
218
|
+
idTokenClaims?: TokenClaims
|
|
219
|
+
): string {
|
|
220
|
+
// since ADFS/DSTS do not have tid and does not set client_info
|
|
221
|
+
if (!(authType === AuthorityType.Adfs || authType === AuthorityType.Dsts)) {
|
|
222
|
+
// for cases where there is clientInfo
|
|
223
|
+
if (serverClientInfo) {
|
|
224
|
+
try {
|
|
225
|
+
const clientInfo = buildClientInfo(
|
|
226
|
+
serverClientInfo,
|
|
227
|
+
cryptoObj.base64Decode
|
|
228
|
+
);
|
|
229
|
+
if (clientInfo.uid && clientInfo.utid) {
|
|
230
|
+
return `${clientInfo.uid}.${clientInfo.utid}`;
|
|
231
|
+
}
|
|
232
|
+
} catch (e) {}
|
|
233
|
+
}
|
|
234
|
+
logger.warning("No client info in response", correlationId);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// default to "sub" claim
|
|
238
|
+
return idTokenClaims?.sub || "";
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Validates an entity: checks for all expected params
|
|
243
|
+
* @param entity
|
|
244
|
+
*/
|
|
245
|
+
export function isAccountEntity(entity: object): entity is AccountEntity {
|
|
246
|
+
if (!entity) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
entity.hasOwnProperty("homeAccountId") &&
|
|
252
|
+
entity.hasOwnProperty("environment") &&
|
|
253
|
+
entity.hasOwnProperty("realm") &&
|
|
254
|
+
entity.hasOwnProperty("localAccountId") &&
|
|
255
|
+
entity.hasOwnProperty("username") &&
|
|
256
|
+
entity.hasOwnProperty("authorityType")
|
|
257
|
+
);
|
|
258
|
+
}
|
|
@@ -11,15 +11,7 @@ import {
|
|
|
11
11
|
ClientAuthErrorCodes,
|
|
12
12
|
createClientAuthError,
|
|
13
13
|
} from "../../error/ClientAuthError.js";
|
|
14
|
-
import
|
|
15
|
-
APP_METADATA,
|
|
16
|
-
AUTHORITY_METADATA_CONSTANTS,
|
|
17
|
-
AuthenticationScheme,
|
|
18
|
-
CredentialType,
|
|
19
|
-
SERVER_TELEM_CONSTANTS,
|
|
20
|
-
Separators,
|
|
21
|
-
ThrottlingConstants,
|
|
22
|
-
} from "../../utils/Constants.js";
|
|
14
|
+
import * as Constants from "../../utils/Constants.js";
|
|
23
15
|
import * as TimeUtils from "../../utils/TimeUtils.js";
|
|
24
16
|
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
|
|
25
17
|
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
|
|
@@ -43,7 +35,7 @@ export function createIdTokenEntity(
|
|
|
43
35
|
tenantId: string
|
|
44
36
|
): IdTokenEntity {
|
|
45
37
|
const idTokenEntity: IdTokenEntity = {
|
|
46
|
-
credentialType: CredentialType.ID_TOKEN,
|
|
38
|
+
credentialType: Constants.CredentialType.ID_TOKEN,
|
|
47
39
|
homeAccountId: homeAccountId,
|
|
48
40
|
environment: environment,
|
|
49
41
|
clientId: clientId,
|
|
@@ -77,15 +69,13 @@ export function createAccessTokenEntity(
|
|
|
77
69
|
extExpiresOn: number,
|
|
78
70
|
base64Decode: (input: string) => string,
|
|
79
71
|
refreshOn?: number,
|
|
80
|
-
tokenType?: AuthenticationScheme,
|
|
72
|
+
tokenType?: Constants.AuthenticationScheme,
|
|
81
73
|
userAssertionHash?: string,
|
|
82
|
-
keyId?: string
|
|
83
|
-
requestedClaims?: string,
|
|
84
|
-
requestedClaimsHash?: string
|
|
74
|
+
keyId?: string
|
|
85
75
|
): AccessTokenEntity {
|
|
86
76
|
const atEntity: AccessTokenEntity = {
|
|
87
77
|
homeAccountId: homeAccountId,
|
|
88
|
-
credentialType: CredentialType.ACCESS_TOKEN,
|
|
78
|
+
credentialType: Constants.CredentialType.ACCESS_TOKEN,
|
|
89
79
|
secret: accessToken,
|
|
90
80
|
cachedAt: TimeUtils.nowSeconds().toString(),
|
|
91
81
|
expiresOn: expiresOn.toString(),
|
|
@@ -94,7 +84,7 @@ export function createAccessTokenEntity(
|
|
|
94
84
|
clientId: clientId,
|
|
95
85
|
realm: tenantId,
|
|
96
86
|
target: scopes,
|
|
97
|
-
tokenType: tokenType || AuthenticationScheme.BEARER,
|
|
87
|
+
tokenType: tokenType || Constants.AuthenticationScheme.BEARER,
|
|
98
88
|
lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
|
|
99
89
|
};
|
|
100
90
|
|
|
@@ -106,22 +96,18 @@ export function createAccessTokenEntity(
|
|
|
106
96
|
atEntity.refreshOn = refreshOn.toString();
|
|
107
97
|
}
|
|
108
98
|
|
|
109
|
-
if (requestedClaims) {
|
|
110
|
-
atEntity.requestedClaims = requestedClaims;
|
|
111
|
-
atEntity.requestedClaimsHash = requestedClaimsHash;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
99
|
/*
|
|
115
100
|
* Create Access Token With Auth Scheme instead of regular access token
|
|
116
101
|
* Cast to lower to handle "bearer" from ADFS
|
|
117
102
|
*/
|
|
118
103
|
if (
|
|
119
104
|
atEntity.tokenType?.toLowerCase() !==
|
|
120
|
-
AuthenticationScheme.BEARER.toLowerCase()
|
|
105
|
+
Constants.AuthenticationScheme.BEARER.toLowerCase()
|
|
121
106
|
) {
|
|
122
|
-
atEntity.credentialType =
|
|
107
|
+
atEntity.credentialType =
|
|
108
|
+
Constants.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
123
109
|
switch (atEntity.tokenType) {
|
|
124
|
-
case AuthenticationScheme.POP:
|
|
110
|
+
case Constants.AuthenticationScheme.POP:
|
|
125
111
|
// Make sure keyId is present and add it to credential
|
|
126
112
|
const tokenClaims: TokenClaims | null = extractTokenClaims(
|
|
127
113
|
accessToken,
|
|
@@ -134,7 +120,7 @@ export function createAccessTokenEntity(
|
|
|
134
120
|
}
|
|
135
121
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
136
122
|
break;
|
|
137
|
-
case AuthenticationScheme.SSH:
|
|
123
|
+
case Constants.AuthenticationScheme.SSH:
|
|
138
124
|
atEntity.keyId = keyId;
|
|
139
125
|
}
|
|
140
126
|
}
|
|
@@ -159,7 +145,7 @@ export function createRefreshTokenEntity(
|
|
|
159
145
|
expiresOn?: number
|
|
160
146
|
): RefreshTokenEntity {
|
|
161
147
|
const rtEntity: RefreshTokenEntity = {
|
|
162
|
-
credentialType: CredentialType.REFRESH_TOKEN,
|
|
148
|
+
credentialType: Constants.CredentialType.REFRESH_TOKEN,
|
|
163
149
|
homeAccountId: homeAccountId,
|
|
164
150
|
environment: environment,
|
|
165
151
|
clientId: clientId,
|
|
@@ -207,9 +193,9 @@ export function isAccessTokenEntity(
|
|
|
207
193
|
isCredentialEntity(entity) &&
|
|
208
194
|
entity.hasOwnProperty("realm") &&
|
|
209
195
|
entity.hasOwnProperty("target") &&
|
|
210
|
-
(entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
|
|
196
|
+
(entity["credentialType"] === Constants.CredentialType.ACCESS_TOKEN ||
|
|
211
197
|
entity["credentialType"] ===
|
|
212
|
-
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME)
|
|
198
|
+
Constants.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME)
|
|
213
199
|
);
|
|
214
200
|
}
|
|
215
201
|
|
|
@@ -225,7 +211,7 @@ export function isIdTokenEntity(entity: object): entity is IdTokenEntity {
|
|
|
225
211
|
return (
|
|
226
212
|
isCredentialEntity(entity) &&
|
|
227
213
|
entity.hasOwnProperty("realm") &&
|
|
228
|
-
entity["credentialType"] === CredentialType.ID_TOKEN
|
|
214
|
+
entity["credentialType"] === Constants.CredentialType.ID_TOKEN
|
|
229
215
|
);
|
|
230
216
|
}
|
|
231
217
|
|
|
@@ -242,7 +228,7 @@ export function isRefreshTokenEntity(
|
|
|
242
228
|
|
|
243
229
|
return (
|
|
244
230
|
isCredentialEntity(entity) &&
|
|
245
|
-
entity["credentialType"] === CredentialType.REFRESH_TOKEN
|
|
231
|
+
entity["credentialType"] === Constants.CredentialType.REFRESH_TOKEN
|
|
246
232
|
);
|
|
247
233
|
}
|
|
248
234
|
|
|
@@ -253,7 +239,7 @@ export function isRefreshTokenEntity(
|
|
|
253
239
|
*/
|
|
254
240
|
export function isServerTelemetryEntity(key: string, entity?: object): boolean {
|
|
255
241
|
const validateKey: boolean =
|
|
256
|
-
key.indexOf(
|
|
242
|
+
key.indexOf(Constants.SERVER_TELEM_CACHE_KEY) === 0;
|
|
257
243
|
let validateEntity: boolean = true;
|
|
258
244
|
|
|
259
245
|
if (entity) {
|
|
@@ -274,7 +260,7 @@ export function isServerTelemetryEntity(key: string, entity?: object): boolean {
|
|
|
274
260
|
export function isThrottlingEntity(key: string, entity?: object): boolean {
|
|
275
261
|
let validateKey: boolean = false;
|
|
276
262
|
if (key) {
|
|
277
|
-
validateKey = key.indexOf(
|
|
263
|
+
validateKey = key.indexOf(Constants.THROTTLING_PREFIX) === 0;
|
|
278
264
|
}
|
|
279
265
|
|
|
280
266
|
let validateEntity: boolean = true;
|
|
@@ -293,12 +279,12 @@ export function generateAppMetadataKey({
|
|
|
293
279
|
clientId,
|
|
294
280
|
}: AppMetadataEntity): string {
|
|
295
281
|
const appMetaDataKeyArray: Array<string> = [
|
|
296
|
-
APP_METADATA,
|
|
282
|
+
Constants.APP_METADATA,
|
|
297
283
|
environment,
|
|
298
284
|
clientId,
|
|
299
285
|
];
|
|
300
286
|
return appMetaDataKeyArray
|
|
301
|
-
.join(
|
|
287
|
+
.join(Constants.CACHE_KEY_SEPARATOR)
|
|
302
288
|
.toLowerCase();
|
|
303
289
|
}
|
|
304
290
|
|
|
@@ -312,7 +298,7 @@ export function isAppMetadataEntity(key: string, entity: object): boolean {
|
|
|
312
298
|
}
|
|
313
299
|
|
|
314
300
|
return (
|
|
315
|
-
key.indexOf(APP_METADATA) === 0 &&
|
|
301
|
+
key.indexOf(Constants.APP_METADATA) === 0 &&
|
|
316
302
|
entity.hasOwnProperty("clientId") &&
|
|
317
303
|
entity.hasOwnProperty("environment")
|
|
318
304
|
);
|
|
@@ -331,7 +317,7 @@ export function isAuthorityMetadataEntity(
|
|
|
331
317
|
}
|
|
332
318
|
|
|
333
319
|
return (
|
|
334
|
-
key.indexOf(
|
|
320
|
+
key.indexOf(Constants.AUTHORITY_METADATA_CACHE_KEY) === 0 &&
|
|
335
321
|
entity.hasOwnProperty("aliases") &&
|
|
336
322
|
entity.hasOwnProperty("preferred_cache") &&
|
|
337
323
|
entity.hasOwnProperty("preferred_network") &&
|
|
@@ -352,7 +338,7 @@ export function isAuthorityMetadataEntity(
|
|
|
352
338
|
export function generateAuthorityMetadataExpiresAt(): number {
|
|
353
339
|
return (
|
|
354
340
|
TimeUtils.nowSeconds() +
|
|
355
|
-
|
|
341
|
+
Constants.AUTHORITY_METADATA_REFRESH_TIME_SECONDS
|
|
356
342
|
);
|
|
357
343
|
}
|
|
358
344
|
|