@azure/msal-common 14.0.2 → 14.1.0-alpha.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 +32 -32
- package/dist/account/AuthToken.d.ts +17 -20
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +61 -51
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.d.ts +9 -9
- package/dist/account/CcsCredential.mjs +8 -8
- package/dist/account/CcsCredential.mjs.map +1 -1
- package/dist/account/ClientCredentials.d.ts +14 -14
- package/dist/account/ClientInfo.d.ts +19 -19
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +39 -39
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/account/TokenClaims.d.ts +65 -65
- package/dist/authority/Authority.d.ts +235 -235
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +743 -765
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +31 -31
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +52 -51
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +623 -623
- package/dist/authority/AuthorityMetadata.mjs +884 -884
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +21 -21
- package/dist/authority/AuthorityOptions.mjs +18 -18
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- package/dist/authority/AuthorityType.d.ts +10 -10
- package/dist/authority/AuthorityType.mjs +13 -13
- package/dist/authority/AuthorityType.mjs.map +1 -1
- package/dist/authority/AzureRegion.d.ts +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts +5 -5
- package/dist/authority/CloudDiscoveryMetadata.d.ts +5 -5
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +13 -13
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +8 -8
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +9 -9
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +8 -8
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
- package/dist/authority/ImdsOptions.d.ts +5 -5
- package/dist/authority/OIDCOptions.d.ts +8 -8
- package/dist/authority/OpenIdConfigResponse.d.ts +11 -11
- package/dist/authority/OpenIdConfigResponse.mjs +10 -10
- package/dist/authority/OpenIdConfigResponse.mjs.map +1 -1
- package/dist/authority/ProtocolMode.d.ts +8 -8
- package/dist/authority/ProtocolMode.mjs +11 -11
- package/dist/authority/ProtocolMode.mjs.map +1 -1
- package/dist/authority/RegionDiscovery.d.ts +32 -30
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +107 -108
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts +6 -6
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +15 -15
- package/dist/cache/CacheManager.d.ts +446 -446
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +1001 -1025
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +56 -56
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.mjs +112 -114
- package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +101 -101
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +222 -223
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.d.ts +39 -39
- package/dist/cache/entities/AppMetadataEntity.mjs +66 -66
- package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.d.ts +48 -48
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +78 -78
- package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/CacheRecord.d.ts +14 -14
- package/dist/cache/entities/CacheRecord.mjs +14 -14
- package/dist/cache/entities/CacheRecord.mjs.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts +88 -88
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +138 -137
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts +34 -34
- package/dist/cache/entities/IdTokenEntity.mjs +56 -56
- package/dist/cache/entities/IdTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.d.ts +36 -36
- package/dist/cache/entities/RefreshTokenEntity.mjs +59 -59
- package/dist/cache/entities/RefreshTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +12 -12
- package/dist/cache/entities/ServerTelemetryEntity.mjs +27 -27
- package/dist/cache/entities/ServerTelemetryEntity.mjs.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.d.ts +13 -13
- package/dist/cache/entities/ThrottlingEntity.mjs +23 -23
- package/dist/cache/entities/ThrottlingEntity.mjs.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +166 -166
- package/dist/cache/interface/ICachePlugin.d.ts +5 -5
- package/dist/cache/interface/ISerializableTokenCache.d.ts +4 -4
- package/dist/cache/persistence/TokenCacheContext.d.ts +23 -23
- package/dist/cache/persistence/TokenCacheContext.mjs +25 -25
- package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +69 -69
- package/dist/client/AuthorizationCodeClient.d.ts +73 -73
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +412 -440
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +51 -51
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +101 -94
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts +35 -35
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +185 -243
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +26 -25
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +128 -104
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/AppTokenProvider.d.ts +38 -38
- package/dist/config/ClientConfiguration.d.ts +150 -150
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +99 -100
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/crypto/ICrypto.d.ts +62 -62
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +35 -43
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/IGuidGenerator.d.ts +4 -4
- package/dist/crypto/JoseHeader.d.ts +22 -22
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +39 -38
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +60 -59
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +83 -83
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +11 -11
- package/dist/error/AuthError.d.ts +44 -47
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +50 -52
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.d.ts +6 -0
- package/dist/error/AuthErrorCodes.d.ts.map +1 -0
- package/dist/error/AuthErrorCodes.mjs +14 -0
- package/dist/error/AuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientAuthError.d.ts +232 -412
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +248 -520
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +44 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientAuthErrorCodes.mjs +52 -0
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientConfigurationError.d.ts +128 -222
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +140 -281
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +23 -0
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs +31 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -0
- package/dist/error/InteractionRequiredAuthError.d.ts +57 -59
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +80 -79
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts +6 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +16 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs.map +1 -0
- package/dist/error/JoseHeaderError.d.ts +15 -28
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +24 -40
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.d.ts +3 -0
- package/dist/error/JoseHeaderErrorCodes.d.ts.map +1 -0
- package/dist/error/JoseHeaderErrorCodes.mjs +11 -0
- package/dist/error/JoseHeaderErrorCodes.mjs.map +1 -0
- package/dist/error/ServerError.d.ts +7 -7
- package/dist/error/ServerError.mjs +14 -14
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/index.cjs +8727 -8978
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +96 -96
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +17 -7
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts +95 -95
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +188 -198
- package/dist/logger/Logger.mjs.map +1 -1
- package/dist/network/INetworkModule.d.ts +29 -29
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +14 -15
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/NetworkManager.d.ts +33 -33
- package/dist/network/NetworkManager.d.ts.map +1 -1
- package/dist/network/NetworkManager.mjs +36 -35
- package/dist/network/NetworkManager.mjs.map +1 -1
- package/dist/network/RequestThumbprint.d.ts +16 -16
- package/dist/network/ThrottlingUtils.d.ts +42 -42
- package/dist/network/ThrottlingUtils.mjs +95 -95
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +4 -4
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.d.ts +19 -19
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +58 -57
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +40 -40
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +27 -27
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +50 -50
- package/dist/request/CommonClientCredentialRequest.d.ts +17 -17
- package/dist/request/CommonDeviceCodeRequest.d.ts +21 -21
- package/dist/request/CommonEndSessionRequest.d.ts +21 -21
- package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -13
- package/dist/request/CommonRefreshTokenRequest.d.ts +19 -19
- package/dist/request/CommonSilentFlowRequest.d.ts +18 -18
- package/dist/request/CommonUsernamePasswordRequest.d.ts +17 -17
- package/dist/request/NativeRequest.d.ts +19 -19
- package/dist/request/NativeSignOutRequest.d.ts +5 -5
- package/dist/request/RequestParameterBuilder.d.ts +217 -217
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +383 -383
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts +33 -33
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +83 -84
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.d.ts +88 -88
- package/dist/request/ScopeSet.d.ts.map +1 -1
- package/dist/request/ScopeSet.mjs +201 -199
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/request/StoreInCache.d.ts +8 -8
- package/dist/response/AuthenticationResult.d.ts +41 -39
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/AuthorizationCodePayload.d.ts +13 -13
- package/dist/response/DeviceCodeResponse.d.ts +25 -25
- package/dist/response/ExternalTokenResponse.d.ts +15 -15
- package/dist/response/IMDSBadResponse.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +67 -66
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +316 -297
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +25 -25
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +46 -44
- package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +51 -51
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceMeasurement.d.ts +5 -5
- package/dist/telemetry/performance/PerformanceClient.d.ts +191 -191
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +409 -408
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +433 -426
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +234 -226
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +24 -24
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +77 -57
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +66 -66
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +197 -198
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryRequest.d.ts +8 -8
- package/dist/url/IUri.d.ts +12 -12
- package/dist/url/UrlString.d.ts +83 -83
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +283 -283
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +366 -353
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +377 -360
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts +28 -0
- package/dist/utils/FunctionWrappers.d.ts.map +1 -0
- package/dist/utils/FunctionWrappers.mjs +90 -0
- package/dist/utils/FunctionWrappers.mjs.map +1 -0
- package/dist/utils/MsalTypes.d.ts +6 -6
- package/dist/utils/ProtocolUtils.d.ts +42 -42
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +71 -73
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.d.ts +40 -53
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.mjs +95 -126
- package/dist/utils/StringUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.d.ts +27 -27
- package/dist/utils/TimeUtils.mjs +45 -45
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/package.json +6 -4
- package/src/account/AccountInfo.ts +44 -0
- package/src/account/AuthToken.ts +71 -0
- package/src/account/CcsCredential.ts +16 -0
- package/src/account/ClientCredentials.ts +20 -0
- package/src/account/ClientInfo.ts +67 -0
- package/src/account/TokenClaims.ts +70 -0
- package/src/authority/Authority.ts +1207 -0
- package/src/authority/AuthorityFactory.ts +118 -0
- package/src/authority/AuthorityMetadata.ts +953 -0
- package/src/authority/AuthorityOptions.ts +40 -0
- package/src/authority/AuthorityType.ts +15 -0
- package/src/authority/AzureRegion.ts +7 -0
- package/src/authority/AzureRegionConfiguration.ts +16 -0
- package/src/authority/CloudDiscoveryMetadata.ts +10 -0
- package/src/authority/CloudInstanceDiscoveryErrorResponse.ts +26 -0
- package/src/authority/CloudInstanceDiscoveryResponse.ts +21 -0
- package/src/authority/ImdsOptions.ts +10 -0
- package/src/authority/OIDCOptions.ts +14 -0
- package/src/authority/OpenIdConfigResponse.ts +24 -0
- package/src/authority/ProtocolMode.ts +13 -0
- package/src/authority/RegionDiscovery.ts +196 -0
- package/src/authority/RegionDiscoveryMetadata.ts +15 -0
- package/src/broker/nativeBroker/INativeBrokerPlugin.ts +29 -0
- package/src/cache/CacheManager.ts +1579 -0
- package/src/cache/entities/AccessTokenEntity.ts +167 -0
- package/src/cache/entities/AccountEntity.ts +314 -0
- package/src/cache/entities/AppMetadataEntity.ts +91 -0
- package/src/cache/entities/AuthorityMetadataEntity.ts +112 -0
- package/src/cache/entities/CacheRecord.ts +33 -0
- package/src/cache/entities/CredentialEntity.ts +220 -0
- package/src/cache/entities/IdTokenEntity.ts +74 -0
- package/src/cache/entities/RefreshTokenEntity.ts +78 -0
- package/src/cache/entities/ServerTelemetryEntity.ts +38 -0
- package/src/cache/entities/ThrottlingEntity.ts +36 -0
- package/src/cache/interface/ICacheManager.ts +218 -0
- package/src/cache/interface/ICachePlugin.ts +11 -0
- package/src/cache/interface/ISerializableTokenCache.ts +9 -0
- package/src/cache/persistence/TokenCacheContext.ts +39 -0
- package/src/cache/utils/CacheTypes.ts +93 -0
- package/src/client/AuthorizationCodeClient.ts +736 -0
- package/src/client/BaseClient.ts +208 -0
- package/src/client/RefreshTokenClient.ts +399 -0
- package/src/client/SilentFlowClient.ts +239 -0
- package/src/config/AppTokenProvider.ts +47 -0
- package/src/config/ClientConfiguration.ts +286 -0
- package/src/crypto/ICrypto.ts +112 -0
- package/src/crypto/IGuidGenerator.ts +9 -0
- package/src/crypto/JoseHeader.ts +58 -0
- package/src/crypto/PopTokenGenerator.ts +160 -0
- package/src/crypto/SignedHttpRequest.ts +16 -0
- package/src/error/AuthError.ts +83 -0
- package/src/error/AuthErrorCodes.ts +10 -0
- package/src/error/ClientAuthError.ts +333 -0
- package/src/error/ClientAuthErrorCodes.ts +51 -0
- package/src/error/ClientConfigurationError.ts +210 -0
- package/src/error/ClientConfigurationErrorCodes.ts +28 -0
- package/src/error/InteractionRequiredAuthError.ts +139 -0
- package/src/error/InteractionRequiredAuthErrorCodes.ts +13 -0
- package/src/error/JoseHeaderError.ts +32 -0
- package/src/error/JoseHeaderErrorCodes.ts +7 -0
- package/src/error/ServerError.ts +18 -0
- package/src/index.ts +226 -0
- package/src/logger/Logger.ts +272 -0
- package/src/network/INetworkModule.ts +60 -0
- package/src/network/NetworkManager.ts +76 -0
- package/src/network/RequestThumbprint.ts +22 -0
- package/src/network/ThrottlingUtils.ts +156 -0
- package/src/packageMetadata.ts +3 -0
- package/src/request/AuthenticationHeaderParser.ts +92 -0
- package/src/request/BaseAuthRequest.ts +46 -0
- package/src/request/CommonAuthorizationCodeRequest.ts +33 -0
- package/src/request/CommonAuthorizationUrlRequest.ts +56 -0
- package/src/request/CommonClientCredentialRequest.ts +23 -0
- package/src/request/CommonDeviceCodeRequest.ts +31 -0
- package/src/request/CommonEndSessionRequest.ts +27 -0
- package/src/request/CommonOnBehalfOfRequest.ts +19 -0
- package/src/request/CommonRefreshTokenRequest.ts +25 -0
- package/src/request/CommonSilentFlowRequest.ts +24 -0
- package/src/request/CommonUsernamePasswordRequest.ts +23 -0
- package/src/request/NativeRequest.ts +25 -0
- package/src/request/NativeSignOutRequest.ts +10 -0
- package/src/request/RequestParameterBuilder.ts +613 -0
- package/src/request/RequestValidator.ts +116 -0
- package/src/request/ScopeSet.ts +246 -0
- package/src/request/StoreInCache.ts +16 -0
- package/src/response/AuthenticationResult.ts +47 -0
- package/src/response/AuthorizationCodePayload.ts +18 -0
- package/src/response/DeviceCodeResponse.ts +31 -0
- package/src/response/ExternalTokenResponse.ts +24 -0
- package/src/response/IMDSBadResponse.ts +9 -0
- package/src/response/ResponseHandler.ts +634 -0
- package/src/response/ServerAuthorizationCodeResponse.ts +33 -0
- package/src/response/ServerAuthorizationTokenResponse.ts +54 -0
- package/src/telemetry/performance/IPerformanceClient.ts +71 -0
- package/src/telemetry/performance/IPerformanceMeasurement.ts +10 -0
- package/src/telemetry/performance/PerformanceClient.ts +636 -0
- package/src/telemetry/performance/PerformanceEvent.ts +542 -0
- package/src/telemetry/performance/StubPerformanceClient.ts +101 -0
- package/src/telemetry/server/ServerTelemetryManager.ts +274 -0
- package/src/telemetry/server/ServerTelemetryRequest.ts +13 -0
- package/src/url/IUri.ts +17 -0
- package/src/url/UrlString.ts +373 -0
- package/src/utils/Constants.ts +444 -0
- package/src/utils/FunctionWrappers.ts +105 -0
- package/src/utils/MsalTypes.ts +9 -0
- package/src/utils/ProtocolUtils.ts +120 -0
- package/src/utils/StringUtils.ts +106 -0
- package/src/utils/TimeUtils.ts +51 -0
- package/dist/account/DecodedAuthToken.d.ts +0 -9
- package/dist/account/DecodedAuthToken.d.ts.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
JoseHeaderErrorCodes,
|
|
8
|
+
createJoseHeaderError,
|
|
9
|
+
} from "../error/JoseHeaderError";
|
|
10
|
+
import { JsonTypes } from "../utils/Constants";
|
|
11
|
+
|
|
12
|
+
export type JoseHeaderOptions = {
|
|
13
|
+
typ?: JsonTypes;
|
|
14
|
+
alg?: string;
|
|
15
|
+
kid?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export class JoseHeader {
|
|
20
|
+
public typ?: JsonTypes;
|
|
21
|
+
public alg?: string;
|
|
22
|
+
public kid?: string;
|
|
23
|
+
|
|
24
|
+
constructor(options: JoseHeaderOptions) {
|
|
25
|
+
this.typ = options.typ;
|
|
26
|
+
this.alg = options.alg;
|
|
27
|
+
this.kid = options.kid;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
32
|
+
* JOSE Header options provided or previously set on the object and returns
|
|
33
|
+
* the stringified header object.
|
|
34
|
+
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
35
|
+
* @param shrHeaderOptions
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
static getShrHeaderString(shrHeaderOptions: JoseHeaderOptions): string {
|
|
39
|
+
// KeyID is required on the SHR header
|
|
40
|
+
if (!shrHeaderOptions.kid) {
|
|
41
|
+
throw createJoseHeaderError(JoseHeaderErrorCodes.missingKidError);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Alg is required on the SHR header
|
|
45
|
+
if (!shrHeaderOptions.alg) {
|
|
46
|
+
throw createJoseHeaderError(JoseHeaderErrorCodes.missingAlgError);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const shrHeader = new JoseHeader({
|
|
50
|
+
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
51
|
+
typ: shrHeaderOptions.typ || JsonTypes.Pop,
|
|
52
|
+
kid: shrHeaderOptions.kid,
|
|
53
|
+
alg: shrHeaderOptions.alg,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return JSON.stringify(shrHeader);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ICrypto, SignedHttpRequestParameters } from "./ICrypto";
|
|
7
|
+
import { TimeUtils } from "../utils/TimeUtils";
|
|
8
|
+
import { UrlString } from "../url/UrlString";
|
|
9
|
+
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient";
|
|
10
|
+
import { PerformanceEvents } from "../telemetry/performance/PerformanceEvent";
|
|
11
|
+
import { invokeAsync } from "../utils/FunctionWrappers";
|
|
12
|
+
import { Logger } from "../logger/Logger";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* See eSTS docs for more info.
|
|
16
|
+
* - A kid element, with the value containing an RFC 7638-compliant JWK thumbprint that is base64 encoded.
|
|
17
|
+
* - xms_ksl element, representing the storage location of the key's secret component on the client device. One of two values:
|
|
18
|
+
* - sw: software storage
|
|
19
|
+
* - uhw: hardware storage
|
|
20
|
+
*/
|
|
21
|
+
type ReqCnf = {
|
|
22
|
+
kid: string;
|
|
23
|
+
xms_ksl: KeyLocation;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ReqCnfData = {
|
|
27
|
+
kid: string;
|
|
28
|
+
reqCnfString: string;
|
|
29
|
+
reqCnfHash: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const KeyLocation = {
|
|
33
|
+
SW: "sw",
|
|
34
|
+
UHW: "uhw",
|
|
35
|
+
} as const;
|
|
36
|
+
export type KeyLocation = (typeof KeyLocation)[keyof typeof KeyLocation];
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export class PopTokenGenerator {
|
|
40
|
+
private cryptoUtils: ICrypto;
|
|
41
|
+
private performanceClient?: IPerformanceClient;
|
|
42
|
+
|
|
43
|
+
constructor(cryptoUtils: ICrypto, performanceClient?: IPerformanceClient) {
|
|
44
|
+
this.cryptoUtils = cryptoUtils;
|
|
45
|
+
this.performanceClient = performanceClient;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generates the req_cnf validated at the RP in the POP protocol for SHR parameters
|
|
50
|
+
* and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash
|
|
51
|
+
* @param request
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
async generateCnf(
|
|
55
|
+
request: SignedHttpRequestParameters,
|
|
56
|
+
logger: Logger
|
|
57
|
+
): Promise<ReqCnfData> {
|
|
58
|
+
this.performanceClient?.addQueueMeasurement(
|
|
59
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
60
|
+
request.correlationId
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const reqCnf = await invokeAsync(
|
|
64
|
+
this.generateKid.bind(this),
|
|
65
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
66
|
+
logger,
|
|
67
|
+
this.performanceClient,
|
|
68
|
+
request.correlationId
|
|
69
|
+
)(request);
|
|
70
|
+
const reqCnfString: string = this.cryptoUtils.base64Encode(
|
|
71
|
+
JSON.stringify(reqCnf)
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
kid: reqCnf.kid,
|
|
76
|
+
reqCnfString,
|
|
77
|
+
reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Generates key_id for a SHR token request
|
|
83
|
+
* @param request
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
async generateKid(request: SignedHttpRequestParameters): Promise<ReqCnf> {
|
|
87
|
+
this.performanceClient?.addQueueMeasurement(
|
|
88
|
+
PerformanceEvents.PopTokenGenerateKid,
|
|
89
|
+
request.correlationId
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(
|
|
93
|
+
request
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
kid: kidThumbprint,
|
|
98
|
+
xms_ksl: KeyLocation.SW,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Signs the POP access_token with the local generated key-pair
|
|
104
|
+
* @param accessToken
|
|
105
|
+
* @param request
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
async signPopToken(
|
|
109
|
+
accessToken: string,
|
|
110
|
+
keyId: string,
|
|
111
|
+
request: SignedHttpRequestParameters
|
|
112
|
+
): Promise<string> {
|
|
113
|
+
return this.signPayload(accessToken, keyId, request);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Utility function to generate the signed JWT for an access_token
|
|
118
|
+
* @param payload
|
|
119
|
+
* @param kid
|
|
120
|
+
* @param request
|
|
121
|
+
* @param claims
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
async signPayload(
|
|
125
|
+
payload: string,
|
|
126
|
+
keyId: string,
|
|
127
|
+
request: SignedHttpRequestParameters,
|
|
128
|
+
claims?: object
|
|
129
|
+
): Promise<string> {
|
|
130
|
+
// Deconstruct request to extract SHR parameters
|
|
131
|
+
const {
|
|
132
|
+
resourceRequestMethod,
|
|
133
|
+
resourceRequestUri,
|
|
134
|
+
shrClaims,
|
|
135
|
+
shrNonce,
|
|
136
|
+
} = request;
|
|
137
|
+
|
|
138
|
+
const resourceUrlString = resourceRequestUri
|
|
139
|
+
? new UrlString(resourceRequestUri)
|
|
140
|
+
: undefined;
|
|
141
|
+
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
|
|
142
|
+
return await this.cryptoUtils.signJwt(
|
|
143
|
+
{
|
|
144
|
+
at: payload,
|
|
145
|
+
ts: TimeUtils.nowSeconds(),
|
|
146
|
+
m: resourceRequestMethod?.toUpperCase(),
|
|
147
|
+
u: resourceUrlComponents?.HostNameAndPort,
|
|
148
|
+
nonce: shrNonce || this.cryptoUtils.createNewGuid(),
|
|
149
|
+
p: resourceUrlComponents?.AbsolutePath,
|
|
150
|
+
q: resourceUrlComponents?.QueryString
|
|
151
|
+
? [[], resourceUrlComponents.QueryString]
|
|
152
|
+
: undefined,
|
|
153
|
+
client_claims: shrClaims || undefined,
|
|
154
|
+
...claims,
|
|
155
|
+
},
|
|
156
|
+
keyId,
|
|
157
|
+
request.correlationId
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type SignedHttpRequest = {
|
|
7
|
+
at?: string;
|
|
8
|
+
cnf?: object;
|
|
9
|
+
m?: string;
|
|
10
|
+
u?: string;
|
|
11
|
+
p?: string;
|
|
12
|
+
q?: [Array<string>, string];
|
|
13
|
+
ts?: number;
|
|
14
|
+
nonce?: string;
|
|
15
|
+
client_claims?: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Constants } from "../utils/Constants";
|
|
7
|
+
import * as AuthErrorCodes from "./AuthErrorCodes";
|
|
8
|
+
export { AuthErrorCodes };
|
|
9
|
+
|
|
10
|
+
export const AuthErrorMessages = {
|
|
11
|
+
[AuthErrorCodes.unexpectedError]: "Unexpected error in authentication.",
|
|
12
|
+
[AuthErrorCodes.postRequestFailed]:
|
|
13
|
+
"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details.",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
18
|
+
* @deprecated Use AuthErrorCodes instead
|
|
19
|
+
*/
|
|
20
|
+
export const AuthErrorMessage = {
|
|
21
|
+
unexpectedError: {
|
|
22
|
+
code: AuthErrorCodes.unexpectedError,
|
|
23
|
+
desc: AuthErrorMessages[AuthErrorCodes.unexpectedError],
|
|
24
|
+
},
|
|
25
|
+
postRequestFailed: {
|
|
26
|
+
code: AuthErrorCodes.postRequestFailed,
|
|
27
|
+
desc: AuthErrorMessages[AuthErrorCodes.postRequestFailed],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* General error class thrown by the MSAL.js library.
|
|
33
|
+
*/
|
|
34
|
+
export class AuthError extends Error {
|
|
35
|
+
/**
|
|
36
|
+
* Short string denoting error
|
|
37
|
+
*/
|
|
38
|
+
errorCode: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Detailed description of error
|
|
42
|
+
*/
|
|
43
|
+
errorMessage: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Describes the subclass of an error
|
|
47
|
+
*/
|
|
48
|
+
subError: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* CorrelationId associated with the error
|
|
52
|
+
*/
|
|
53
|
+
correlationId: string;
|
|
54
|
+
|
|
55
|
+
constructor(errorCode?: string, errorMessage?: string, suberror?: string) {
|
|
56
|
+
const errorString = errorMessage
|
|
57
|
+
? `${errorCode}: ${errorMessage}`
|
|
58
|
+
: errorCode;
|
|
59
|
+
super(errorString);
|
|
60
|
+
Object.setPrototypeOf(this, AuthError.prototype);
|
|
61
|
+
|
|
62
|
+
this.errorCode = errorCode || Constants.EMPTY_STRING;
|
|
63
|
+
this.errorMessage = errorMessage || Constants.EMPTY_STRING;
|
|
64
|
+
this.subError = suberror || Constants.EMPTY_STRING;
|
|
65
|
+
this.name = "AuthError";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setCorrelationId(correlationId: string): void {
|
|
69
|
+
this.correlationId = correlationId;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function createAuthError(
|
|
74
|
+
code: string,
|
|
75
|
+
additionalMessage?: string
|
|
76
|
+
): AuthError {
|
|
77
|
+
return new AuthError(
|
|
78
|
+
code,
|
|
79
|
+
additionalMessage
|
|
80
|
+
? `${AuthErrorMessages[code]} ${additionalMessage}`
|
|
81
|
+
: AuthErrorMessages[code]
|
|
82
|
+
);
|
|
83
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
8
|
+
*/
|
|
9
|
+
export const unexpectedError = "unexpected_error";
|
|
10
|
+
export const postRequestFailed = "post_request_failed";
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthError } from "./AuthError";
|
|
7
|
+
import * as ClientAuthErrorCodes from "./ClientAuthErrorCodes";
|
|
8
|
+
export { ClientAuthErrorCodes }; // Allow importing as "ClientAuthErrorCodes";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const ClientAuthErrorMessages = {
|
|
15
|
+
[ClientAuthErrorCodes.clientInfoDecodingError]:
|
|
16
|
+
"The client info could not be parsed/decoded correctly",
|
|
17
|
+
[ClientAuthErrorCodes.clientInfoEmptyError]: "The client info was empty",
|
|
18
|
+
[ClientAuthErrorCodes.tokenParsingError]: "Token cannot be parsed",
|
|
19
|
+
[ClientAuthErrorCodes.nullOrEmptyToken]: "The token is null or empty",
|
|
20
|
+
[ClientAuthErrorCodes.endpointResolutionError]:
|
|
21
|
+
"Endpoints cannot be resolved",
|
|
22
|
+
[ClientAuthErrorCodes.networkError]: "Network request failed",
|
|
23
|
+
[ClientAuthErrorCodes.openIdConfigError]:
|
|
24
|
+
"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",
|
|
25
|
+
[ClientAuthErrorCodes.hashNotDeserialized]:
|
|
26
|
+
"The hash parameters could not be deserialized",
|
|
27
|
+
[ClientAuthErrorCodes.invalidState]: "State was not the expected format",
|
|
28
|
+
[ClientAuthErrorCodes.stateMismatch]: "State mismatch error",
|
|
29
|
+
[ClientAuthErrorCodes.stateNotFound]: "State not found",
|
|
30
|
+
[ClientAuthErrorCodes.nonceMismatch]: "Nonce mismatch error",
|
|
31
|
+
[ClientAuthErrorCodes.authTimeNotFound]:
|
|
32
|
+
"Max Age was requested and the ID token is missing the auth_time variable." +
|
|
33
|
+
" auth_time is an optional claim and is not enabled by default - it must be enabled." +
|
|
34
|
+
" See https://aka.ms/msaljs/optional-claims for more information.",
|
|
35
|
+
[ClientAuthErrorCodes.maxAgeTranspired]:
|
|
36
|
+
"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",
|
|
37
|
+
[ClientAuthErrorCodes.multipleMatchingTokens]:
|
|
38
|
+
"The cache contains multiple tokens satisfying the requirements. " +
|
|
39
|
+
"Call AcquireToken again providing more requirements such as authority or account.",
|
|
40
|
+
[ClientAuthErrorCodes.multipleMatchingAccounts]:
|
|
41
|
+
"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",
|
|
42
|
+
[ClientAuthErrorCodes.multipleMatchingAppMetadata]:
|
|
43
|
+
"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",
|
|
44
|
+
[ClientAuthErrorCodes.requestCannotBeMade]:
|
|
45
|
+
"Token request cannot be made without authorization code or refresh token.",
|
|
46
|
+
[ClientAuthErrorCodes.cannotRemoveEmptyScope]:
|
|
47
|
+
"Cannot remove null or empty scope from ScopeSet",
|
|
48
|
+
[ClientAuthErrorCodes.cannotAppendScopeSet]: "Cannot append ScopeSet",
|
|
49
|
+
[ClientAuthErrorCodes.emptyInputScopeSet]:
|
|
50
|
+
"Empty input ScopeSet cannot be processed",
|
|
51
|
+
[ClientAuthErrorCodes.deviceCodePollingCancelled]:
|
|
52
|
+
"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",
|
|
53
|
+
[ClientAuthErrorCodes.deviceCodeExpired]: "Device code is expired.",
|
|
54
|
+
[ClientAuthErrorCodes.deviceCodeUnknownError]:
|
|
55
|
+
"Device code stopped polling for unknown reasons.",
|
|
56
|
+
[ClientAuthErrorCodes.noAccountInSilentRequest]:
|
|
57
|
+
"Please pass an account object, silent flow is not supported without account information",
|
|
58
|
+
[ClientAuthErrorCodes.invalidCacheRecord]:
|
|
59
|
+
"Cache record object was null or undefined.",
|
|
60
|
+
[ClientAuthErrorCodes.invalidCacheEnvironment]:
|
|
61
|
+
"Invalid environment when attempting to create cache entry",
|
|
62
|
+
[ClientAuthErrorCodes.noAccountFound]:
|
|
63
|
+
"No account found in cache for given key.",
|
|
64
|
+
[ClientAuthErrorCodes.noCryptoObject]: "No crypto object detected.",
|
|
65
|
+
[ClientAuthErrorCodes.unexpectedCredentialType]:
|
|
66
|
+
"Unexpected credential type.",
|
|
67
|
+
[ClientAuthErrorCodes.invalidAssertion]:
|
|
68
|
+
"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",
|
|
69
|
+
[ClientAuthErrorCodes.invalidClientCredential]:
|
|
70
|
+
"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",
|
|
71
|
+
[ClientAuthErrorCodes.tokenRefreshRequired]:
|
|
72
|
+
"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",
|
|
73
|
+
[ClientAuthErrorCodes.userTimeoutReached]:
|
|
74
|
+
"User defined timeout for device code polling reached",
|
|
75
|
+
[ClientAuthErrorCodes.tokenClaimsCnfRequiredForSignedJwt]:
|
|
76
|
+
"Cannot generate a POP jwt if the token_claims are not populated",
|
|
77
|
+
[ClientAuthErrorCodes.authorizationCodeMissingFromServerResponse]:
|
|
78
|
+
"Server response does not contain an authorization code to proceed",
|
|
79
|
+
[ClientAuthErrorCodes.bindingKeyNotRemoved]:
|
|
80
|
+
"Could not remove the credential's binding key from storage.",
|
|
81
|
+
[ClientAuthErrorCodes.endSessionEndpointNotSupported]:
|
|
82
|
+
"The provided authority does not support logout",
|
|
83
|
+
[ClientAuthErrorCodes.keyIdMissing]:
|
|
84
|
+
"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",
|
|
85
|
+
[ClientAuthErrorCodes.noNetworkConnectivity]:
|
|
86
|
+
"No network connectivity. Check your internet connection.",
|
|
87
|
+
[ClientAuthErrorCodes.userCanceled]: "User cancelled the flow.",
|
|
88
|
+
[ClientAuthErrorCodes.missingTenantIdError]:
|
|
89
|
+
"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",
|
|
90
|
+
[ClientAuthErrorCodes.methodNotImplemented]:
|
|
91
|
+
"This method has not been implemented",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* String constants used by error codes and messages.
|
|
96
|
+
* @deprecated Use ClientAuthErrorCodes instead
|
|
97
|
+
*/
|
|
98
|
+
export const ClientAuthErrorMessage = {
|
|
99
|
+
clientInfoDecodingError: {
|
|
100
|
+
code: ClientAuthErrorCodes.clientInfoDecodingError,
|
|
101
|
+
desc: ClientAuthErrorMessages[
|
|
102
|
+
ClientAuthErrorCodes.clientInfoDecodingError
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
clientInfoEmptyError: {
|
|
106
|
+
code: ClientAuthErrorCodes.clientInfoEmptyError,
|
|
107
|
+
desc: ClientAuthErrorMessages[
|
|
108
|
+
ClientAuthErrorCodes.clientInfoEmptyError
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
tokenParsingError: {
|
|
112
|
+
code: ClientAuthErrorCodes.tokenParsingError,
|
|
113
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.tokenParsingError],
|
|
114
|
+
},
|
|
115
|
+
nullOrEmptyToken: {
|
|
116
|
+
code: ClientAuthErrorCodes.nullOrEmptyToken,
|
|
117
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.nullOrEmptyToken],
|
|
118
|
+
},
|
|
119
|
+
endpointResolutionError: {
|
|
120
|
+
code: ClientAuthErrorCodes.endpointResolutionError,
|
|
121
|
+
desc: ClientAuthErrorMessages[
|
|
122
|
+
ClientAuthErrorCodes.endpointResolutionError
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
networkError: {
|
|
126
|
+
code: ClientAuthErrorCodes.networkError,
|
|
127
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.networkError],
|
|
128
|
+
},
|
|
129
|
+
unableToGetOpenidConfigError: {
|
|
130
|
+
code: ClientAuthErrorCodes.openIdConfigError,
|
|
131
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.openIdConfigError],
|
|
132
|
+
},
|
|
133
|
+
hashNotDeserialized: {
|
|
134
|
+
code: ClientAuthErrorCodes.hashNotDeserialized,
|
|
135
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.hashNotDeserialized],
|
|
136
|
+
},
|
|
137
|
+
invalidStateError: {
|
|
138
|
+
code: ClientAuthErrorCodes.invalidState,
|
|
139
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidState],
|
|
140
|
+
},
|
|
141
|
+
stateMismatchError: {
|
|
142
|
+
code: ClientAuthErrorCodes.stateMismatch,
|
|
143
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.stateMismatch],
|
|
144
|
+
},
|
|
145
|
+
stateNotFoundError: {
|
|
146
|
+
code: ClientAuthErrorCodes.stateNotFound,
|
|
147
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.stateNotFound],
|
|
148
|
+
},
|
|
149
|
+
nonceMismatchError: {
|
|
150
|
+
code: ClientAuthErrorCodes.nonceMismatch,
|
|
151
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.nonceMismatch],
|
|
152
|
+
},
|
|
153
|
+
authTimeNotFoundError: {
|
|
154
|
+
code: ClientAuthErrorCodes.authTimeNotFound,
|
|
155
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.authTimeNotFound],
|
|
156
|
+
},
|
|
157
|
+
maxAgeTranspired: {
|
|
158
|
+
code: ClientAuthErrorCodes.maxAgeTranspired,
|
|
159
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.maxAgeTranspired],
|
|
160
|
+
},
|
|
161
|
+
multipleMatchingTokens: {
|
|
162
|
+
code: ClientAuthErrorCodes.multipleMatchingTokens,
|
|
163
|
+
desc: ClientAuthErrorMessages[
|
|
164
|
+
ClientAuthErrorCodes.multipleMatchingTokens
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
multipleMatchingAccounts: {
|
|
168
|
+
code: ClientAuthErrorCodes.multipleMatchingAccounts,
|
|
169
|
+
desc: ClientAuthErrorMessages[
|
|
170
|
+
ClientAuthErrorCodes.multipleMatchingAccounts
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
multipleMatchingAppMetadata: {
|
|
174
|
+
code: ClientAuthErrorCodes.multipleMatchingAppMetadata,
|
|
175
|
+
desc: ClientAuthErrorMessages[
|
|
176
|
+
ClientAuthErrorCodes.multipleMatchingAppMetadata
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
tokenRequestCannotBeMade: {
|
|
180
|
+
code: ClientAuthErrorCodes.requestCannotBeMade,
|
|
181
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.requestCannotBeMade],
|
|
182
|
+
},
|
|
183
|
+
removeEmptyScopeError: {
|
|
184
|
+
code: ClientAuthErrorCodes.cannotRemoveEmptyScope,
|
|
185
|
+
desc: ClientAuthErrorMessages[
|
|
186
|
+
ClientAuthErrorCodes.cannotRemoveEmptyScope
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
appendScopeSetError: {
|
|
190
|
+
code: ClientAuthErrorCodes.cannotAppendScopeSet,
|
|
191
|
+
desc: ClientAuthErrorMessages[
|
|
192
|
+
ClientAuthErrorCodes.cannotAppendScopeSet
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
emptyInputScopeSetError: {
|
|
196
|
+
code: ClientAuthErrorCodes.emptyInputScopeSet,
|
|
197
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.emptyInputScopeSet],
|
|
198
|
+
},
|
|
199
|
+
DeviceCodePollingCancelled: {
|
|
200
|
+
code: ClientAuthErrorCodes.deviceCodePollingCancelled,
|
|
201
|
+
desc: ClientAuthErrorMessages[
|
|
202
|
+
ClientAuthErrorCodes.deviceCodePollingCancelled
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
DeviceCodeExpired: {
|
|
206
|
+
code: ClientAuthErrorCodes.deviceCodeExpired,
|
|
207
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.deviceCodeExpired],
|
|
208
|
+
},
|
|
209
|
+
DeviceCodeUnknownError: {
|
|
210
|
+
code: ClientAuthErrorCodes.deviceCodeUnknownError,
|
|
211
|
+
desc: ClientAuthErrorMessages[
|
|
212
|
+
ClientAuthErrorCodes.deviceCodeUnknownError
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
NoAccountInSilentRequest: {
|
|
216
|
+
code: ClientAuthErrorCodes.noAccountInSilentRequest,
|
|
217
|
+
desc: ClientAuthErrorMessages[
|
|
218
|
+
ClientAuthErrorCodes.noAccountInSilentRequest
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
invalidCacheRecord: {
|
|
222
|
+
code: ClientAuthErrorCodes.invalidCacheRecord,
|
|
223
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidCacheRecord],
|
|
224
|
+
},
|
|
225
|
+
invalidCacheEnvironment: {
|
|
226
|
+
code: ClientAuthErrorCodes.invalidCacheEnvironment,
|
|
227
|
+
desc: ClientAuthErrorMessages[
|
|
228
|
+
ClientAuthErrorCodes.invalidCacheEnvironment
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
noAccountFound: {
|
|
232
|
+
code: ClientAuthErrorCodes.noAccountFound,
|
|
233
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.noAccountFound],
|
|
234
|
+
},
|
|
235
|
+
noCryptoObj: {
|
|
236
|
+
code: ClientAuthErrorCodes.noCryptoObject,
|
|
237
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.noCryptoObject],
|
|
238
|
+
},
|
|
239
|
+
unexpectedCredentialType: {
|
|
240
|
+
code: ClientAuthErrorCodes.unexpectedCredentialType,
|
|
241
|
+
desc: ClientAuthErrorMessages[
|
|
242
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
invalidAssertion: {
|
|
246
|
+
code: ClientAuthErrorCodes.invalidAssertion,
|
|
247
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidAssertion],
|
|
248
|
+
},
|
|
249
|
+
invalidClientCredential: {
|
|
250
|
+
code: ClientAuthErrorCodes.invalidClientCredential,
|
|
251
|
+
desc: ClientAuthErrorMessages[
|
|
252
|
+
ClientAuthErrorCodes.invalidClientCredential
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
tokenRefreshRequired: {
|
|
256
|
+
code: ClientAuthErrorCodes.tokenRefreshRequired,
|
|
257
|
+
desc: ClientAuthErrorMessages[
|
|
258
|
+
ClientAuthErrorCodes.tokenRefreshRequired
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
userTimeoutReached: {
|
|
262
|
+
code: ClientAuthErrorCodes.userTimeoutReached,
|
|
263
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.userTimeoutReached],
|
|
264
|
+
},
|
|
265
|
+
tokenClaimsRequired: {
|
|
266
|
+
code: ClientAuthErrorCodes.tokenClaimsCnfRequiredForSignedJwt,
|
|
267
|
+
desc: ClientAuthErrorMessages[
|
|
268
|
+
ClientAuthErrorCodes.tokenClaimsCnfRequiredForSignedJwt
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
noAuthorizationCodeFromServer: {
|
|
272
|
+
code: ClientAuthErrorCodes.authorizationCodeMissingFromServerResponse,
|
|
273
|
+
desc: ClientAuthErrorMessages[
|
|
274
|
+
ClientAuthErrorCodes.authorizationCodeMissingFromServerResponse
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
bindingKeyNotRemovedError: {
|
|
278
|
+
code: ClientAuthErrorCodes.bindingKeyNotRemoved,
|
|
279
|
+
desc: ClientAuthErrorMessages[
|
|
280
|
+
ClientAuthErrorCodes.bindingKeyNotRemoved
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
logoutNotSupported: {
|
|
284
|
+
code: ClientAuthErrorCodes.endSessionEndpointNotSupported,
|
|
285
|
+
desc: ClientAuthErrorMessages[
|
|
286
|
+
ClientAuthErrorCodes.endSessionEndpointNotSupported
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
keyIdMissing: {
|
|
290
|
+
code: ClientAuthErrorCodes.keyIdMissing,
|
|
291
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.keyIdMissing],
|
|
292
|
+
},
|
|
293
|
+
noNetworkConnectivity: {
|
|
294
|
+
code: ClientAuthErrorCodes.noNetworkConnectivity,
|
|
295
|
+
desc: ClientAuthErrorMessages[
|
|
296
|
+
ClientAuthErrorCodes.noNetworkConnectivity
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
userCanceledError: {
|
|
300
|
+
code: ClientAuthErrorCodes.userCanceled,
|
|
301
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.userCanceled],
|
|
302
|
+
},
|
|
303
|
+
missingTenantIdError: {
|
|
304
|
+
code: ClientAuthErrorCodes.missingTenantIdError,
|
|
305
|
+
desc: ClientAuthErrorMessages[
|
|
306
|
+
ClientAuthErrorCodes.missingTenantIdError
|
|
307
|
+
],
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
313
|
+
*/
|
|
314
|
+
export class ClientAuthError extends AuthError {
|
|
315
|
+
constructor(errorCode: string, additionalMessage?: string) {
|
|
316
|
+
super(
|
|
317
|
+
errorCode,
|
|
318
|
+
additionalMessage
|
|
319
|
+
? `${ClientAuthErrorMessages[errorCode]}: ${additionalMessage}`
|
|
320
|
+
: ClientAuthErrorMessages[errorCode]
|
|
321
|
+
);
|
|
322
|
+
this.name = "ClientAuthError";
|
|
323
|
+
|
|
324
|
+
Object.setPrototypeOf(this, ClientAuthError.prototype);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export function createClientAuthError(
|
|
329
|
+
errorCode: string,
|
|
330
|
+
additionalMessage?: string
|
|
331
|
+
): ClientAuthError {
|
|
332
|
+
return new ClientAuthError(errorCode, additionalMessage);
|
|
333
|
+
}
|