@azure/msal-common 14.0.3 → 14.1.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/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +7 -6
- 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 +6 -5
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +28 -50
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +9 -7
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +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/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.d.ts +3 -1
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +7 -8
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.d.ts +25 -7
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +98 -71
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.mjs +4 -3
- package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +4 -3
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +4 -3
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +3 -6
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +13 -11
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +5 -4
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +33 -74
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +2 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +43 -19
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +5 -6
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/crypto/ICrypto.d.ts +0 -4
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +11 -22
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +5 -4
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +2 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +4 -4
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.d.ts +8 -11
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +19 -21
- 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 +54 -234
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +149 -421
- 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 +31 -125
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +81 -222
- 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 +14 -16
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +42 -41
- 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 +7 -20
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +10 -26
- 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.mjs +1 -1
- package/dist/index.cjs +942 -1210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +5 -6
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/NetworkManager.d.ts.map +1 -1
- package/dist/network/NetworkManager.mjs +4 -3
- package/dist/network/NetworkManager.mjs.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +7 -6
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +3 -0
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +2 -0
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +5 -4
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +8 -7
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.d.ts.map +1 -1
- package/dist/request/ScopeSet.mjs +10 -8
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +15 -14
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +3 -2
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +9 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +2 -2
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +13 -11
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +6 -3
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +12 -4
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -2
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +7 -6
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/package.json +1 -1
- package/src/account/AccountInfo.ts +0 -1
- package/src/account/AuthToken.ts +8 -7
- package/src/account/ClientInfo.ts +9 -6
- package/src/authority/Authority.ts +76 -94
- package/src/authority/AuthorityFactory.ts +21 -9
- package/src/authority/RegionDiscovery.ts +21 -18
- package/src/cache/CacheManager.ts +133 -95
- package/src/cache/entities/AccessTokenEntity.ts +7 -2
- package/src/cache/entities/AccountEntity.ts +7 -2
- package/src/cache/entities/CredentialEntity.ts +7 -2
- package/src/cache/utils/CacheTypes.ts +6 -6
- package/src/client/AuthorizationCodeClient.ts +35 -11
- package/src/client/BaseClient.ts +7 -4
- package/src/client/RefreshTokenClient.ts +100 -126
- package/src/client/SilentFlowClient.ts +72 -19
- package/src/config/ClientConfiguration.ts +6 -7
- package/src/crypto/ICrypto.ts +12 -34
- package/src/crypto/JoseHeader.ts +6 -3
- package/src/crypto/PopTokenGenerator.ts +10 -5
- package/src/error/AuthError.ts +24 -26
- package/src/error/AuthErrorCodes.ts +10 -0
- package/src/error/ClientAuthError.ts +227 -632
- package/src/error/ClientAuthErrorCodes.ts +51 -0
- package/src/error/ClientConfigurationError.ts +146 -332
- package/src/error/ClientConfigurationErrorCodes.ts +28 -0
- package/src/error/InteractionRequiredAuthError.ts +60 -55
- package/src/error/InteractionRequiredAuthErrorCodes.ts +13 -0
- package/src/error/JoseHeaderError.ts +11 -31
- package/src/error/JoseHeaderErrorCodes.ts +7 -0
- package/src/index.ts +13 -1
- package/src/network/INetworkModule.ts +10 -7
- package/src/network/NetworkManager.ts +5 -5
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthenticationHeaderParser.ts +11 -8
- package/src/request/CommonRefreshTokenRequest.ts +3 -0
- package/src/request/CommonSilentFlowRequest.ts +2 -0
- package/src/request/RequestParameterBuilder.ts +10 -3
- package/src/request/RequestValidator.ts +19 -6
- package/src/request/ScopeSet.ts +23 -7
- package/src/response/ResponseHandler.ts +37 -17
- package/src/telemetry/performance/PerformanceClient.ts +2 -1
- package/src/telemetry/performance/PerformanceEvent.ts +9 -0
- package/src/telemetry/server/ServerTelemetryManager.ts +1 -1
- package/src/url/UrlString.ts +26 -16
- package/src/utils/Constants.ts +11 -3
- package/src/utils/FunctionWrappers.ts +0 -1
- package/src/utils/ProtocolUtils.ts +8 -12
|
@@ -4,219 +4,307 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { AuthError } from "./AuthError";
|
|
7
|
+
import * as ClientAuthErrorCodes from "./ClientAuthErrorCodes";
|
|
8
|
+
export { ClientAuthErrorCodes }; // Allow importing as "ClientAuthErrorCodes";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
10
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
|
+
*/
|
|
11
98
|
export const ClientAuthErrorMessage = {
|
|
12
99
|
clientInfoDecodingError: {
|
|
13
|
-
code:
|
|
14
|
-
desc:
|
|
100
|
+
code: ClientAuthErrorCodes.clientInfoDecodingError,
|
|
101
|
+
desc: ClientAuthErrorMessages[
|
|
102
|
+
ClientAuthErrorCodes.clientInfoDecodingError
|
|
103
|
+
],
|
|
15
104
|
},
|
|
16
105
|
clientInfoEmptyError: {
|
|
17
|
-
code:
|
|
18
|
-
desc:
|
|
106
|
+
code: ClientAuthErrorCodes.clientInfoEmptyError,
|
|
107
|
+
desc: ClientAuthErrorMessages[
|
|
108
|
+
ClientAuthErrorCodes.clientInfoEmptyError
|
|
109
|
+
],
|
|
19
110
|
},
|
|
20
111
|
tokenParsingError: {
|
|
21
|
-
code:
|
|
22
|
-
desc:
|
|
112
|
+
code: ClientAuthErrorCodes.tokenParsingError,
|
|
113
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.tokenParsingError],
|
|
23
114
|
},
|
|
24
115
|
nullOrEmptyToken: {
|
|
25
|
-
code:
|
|
26
|
-
desc:
|
|
116
|
+
code: ClientAuthErrorCodes.nullOrEmptyToken,
|
|
117
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.nullOrEmptyToken],
|
|
27
118
|
},
|
|
28
119
|
endpointResolutionError: {
|
|
29
|
-
code:
|
|
30
|
-
desc:
|
|
120
|
+
code: ClientAuthErrorCodes.endpointResolutionError,
|
|
121
|
+
desc: ClientAuthErrorMessages[
|
|
122
|
+
ClientAuthErrorCodes.endpointResolutionError
|
|
123
|
+
],
|
|
31
124
|
},
|
|
32
125
|
networkError: {
|
|
33
|
-
code:
|
|
34
|
-
desc:
|
|
126
|
+
code: ClientAuthErrorCodes.networkError,
|
|
127
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.networkError],
|
|
35
128
|
},
|
|
36
129
|
unableToGetOpenidConfigError: {
|
|
37
|
-
code:
|
|
38
|
-
desc:
|
|
130
|
+
code: ClientAuthErrorCodes.openIdConfigError,
|
|
131
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.openIdConfigError],
|
|
39
132
|
},
|
|
40
133
|
hashNotDeserialized: {
|
|
41
|
-
code:
|
|
42
|
-
desc:
|
|
43
|
-
},
|
|
44
|
-
blankGuidGenerated: {
|
|
45
|
-
code: "blank_guid_generated",
|
|
46
|
-
desc: "The guid generated was blank. Please review the trace to determine the root cause.",
|
|
134
|
+
code: ClientAuthErrorCodes.hashNotDeserialized,
|
|
135
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.hashNotDeserialized],
|
|
47
136
|
},
|
|
48
137
|
invalidStateError: {
|
|
49
|
-
code:
|
|
50
|
-
desc:
|
|
138
|
+
code: ClientAuthErrorCodes.invalidState,
|
|
139
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidState],
|
|
51
140
|
},
|
|
52
141
|
stateMismatchError: {
|
|
53
|
-
code:
|
|
54
|
-
desc:
|
|
142
|
+
code: ClientAuthErrorCodes.stateMismatch,
|
|
143
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.stateMismatch],
|
|
55
144
|
},
|
|
56
145
|
stateNotFoundError: {
|
|
57
|
-
code:
|
|
58
|
-
desc:
|
|
146
|
+
code: ClientAuthErrorCodes.stateNotFound,
|
|
147
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.stateNotFound],
|
|
59
148
|
},
|
|
60
149
|
nonceMismatchError: {
|
|
61
|
-
code:
|
|
62
|
-
desc:
|
|
63
|
-
},
|
|
64
|
-
nonceNotFoundError: {
|
|
65
|
-
code: "nonce_not_found",
|
|
66
|
-
desc: "nonce not found",
|
|
150
|
+
code: ClientAuthErrorCodes.nonceMismatch,
|
|
151
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.nonceMismatch],
|
|
67
152
|
},
|
|
68
153
|
authTimeNotFoundError: {
|
|
69
|
-
code:
|
|
70
|
-
desc:
|
|
71
|
-
"Max Age was requested and the ID token is missing the auth_time variable." +
|
|
72
|
-
" auth_time is an optional claim and is not enabled by default - it must be enabled." +
|
|
73
|
-
" See https://aka.ms/msaljs/optional-claims for more information.",
|
|
74
|
-
},
|
|
75
|
-
maxAgeTranspiredError: {
|
|
76
|
-
code: "max_age_transpired",
|
|
77
|
-
desc: "Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",
|
|
154
|
+
code: ClientAuthErrorCodes.authTimeNotFound,
|
|
155
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.authTimeNotFound],
|
|
78
156
|
},
|
|
79
|
-
|
|
80
|
-
code:
|
|
81
|
-
desc:
|
|
157
|
+
maxAgeTranspired: {
|
|
158
|
+
code: ClientAuthErrorCodes.maxAgeTranspired,
|
|
159
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.maxAgeTranspired],
|
|
82
160
|
},
|
|
83
161
|
multipleMatchingTokens: {
|
|
84
|
-
code:
|
|
85
|
-
desc:
|
|
86
|
-
|
|
87
|
-
|
|
162
|
+
code: ClientAuthErrorCodes.multipleMatchingTokens,
|
|
163
|
+
desc: ClientAuthErrorMessages[
|
|
164
|
+
ClientAuthErrorCodes.multipleMatchingTokens
|
|
165
|
+
],
|
|
88
166
|
},
|
|
89
167
|
multipleMatchingAccounts: {
|
|
90
|
-
code:
|
|
91
|
-
desc:
|
|
168
|
+
code: ClientAuthErrorCodes.multipleMatchingAccounts,
|
|
169
|
+
desc: ClientAuthErrorMessages[
|
|
170
|
+
ClientAuthErrorCodes.multipleMatchingAccounts
|
|
171
|
+
],
|
|
92
172
|
},
|
|
93
173
|
multipleMatchingAppMetadata: {
|
|
94
|
-
code:
|
|
95
|
-
desc:
|
|
174
|
+
code: ClientAuthErrorCodes.multipleMatchingAppMetadata,
|
|
175
|
+
desc: ClientAuthErrorMessages[
|
|
176
|
+
ClientAuthErrorCodes.multipleMatchingAppMetadata
|
|
177
|
+
],
|
|
96
178
|
},
|
|
97
179
|
tokenRequestCannotBeMade: {
|
|
98
|
-
code:
|
|
99
|
-
desc:
|
|
100
|
-
},
|
|
101
|
-
appendEmptyScopeError: {
|
|
102
|
-
code: "cannot_append_empty_scope",
|
|
103
|
-
desc: "Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info.",
|
|
180
|
+
code: ClientAuthErrorCodes.requestCannotBeMade,
|
|
181
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.requestCannotBeMade],
|
|
104
182
|
},
|
|
105
183
|
removeEmptyScopeError: {
|
|
106
|
-
code:
|
|
107
|
-
desc:
|
|
184
|
+
code: ClientAuthErrorCodes.cannotRemoveEmptyScope,
|
|
185
|
+
desc: ClientAuthErrorMessages[
|
|
186
|
+
ClientAuthErrorCodes.cannotRemoveEmptyScope
|
|
187
|
+
],
|
|
108
188
|
},
|
|
109
189
|
appendScopeSetError: {
|
|
110
|
-
code:
|
|
111
|
-
desc:
|
|
190
|
+
code: ClientAuthErrorCodes.cannotAppendScopeSet,
|
|
191
|
+
desc: ClientAuthErrorMessages[
|
|
192
|
+
ClientAuthErrorCodes.cannotAppendScopeSet
|
|
193
|
+
],
|
|
112
194
|
},
|
|
113
195
|
emptyInputScopeSetError: {
|
|
114
|
-
code:
|
|
115
|
-
desc:
|
|
196
|
+
code: ClientAuthErrorCodes.emptyInputScopeSet,
|
|
197
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.emptyInputScopeSet],
|
|
116
198
|
},
|
|
117
199
|
DeviceCodePollingCancelled: {
|
|
118
|
-
code:
|
|
119
|
-
desc:
|
|
200
|
+
code: ClientAuthErrorCodes.deviceCodePollingCancelled,
|
|
201
|
+
desc: ClientAuthErrorMessages[
|
|
202
|
+
ClientAuthErrorCodes.deviceCodePollingCancelled
|
|
203
|
+
],
|
|
120
204
|
},
|
|
121
205
|
DeviceCodeExpired: {
|
|
122
|
-
code:
|
|
123
|
-
desc:
|
|
206
|
+
code: ClientAuthErrorCodes.deviceCodeExpired,
|
|
207
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.deviceCodeExpired],
|
|
124
208
|
},
|
|
125
209
|
DeviceCodeUnknownError: {
|
|
126
|
-
code:
|
|
127
|
-
desc:
|
|
210
|
+
code: ClientAuthErrorCodes.deviceCodeUnknownError,
|
|
211
|
+
desc: ClientAuthErrorMessages[
|
|
212
|
+
ClientAuthErrorCodes.deviceCodeUnknownError
|
|
213
|
+
],
|
|
128
214
|
},
|
|
129
215
|
NoAccountInSilentRequest: {
|
|
130
|
-
code:
|
|
131
|
-
desc:
|
|
216
|
+
code: ClientAuthErrorCodes.noAccountInSilentRequest,
|
|
217
|
+
desc: ClientAuthErrorMessages[
|
|
218
|
+
ClientAuthErrorCodes.noAccountInSilentRequest
|
|
219
|
+
],
|
|
132
220
|
},
|
|
133
221
|
invalidCacheRecord: {
|
|
134
|
-
code:
|
|
135
|
-
desc:
|
|
222
|
+
code: ClientAuthErrorCodes.invalidCacheRecord,
|
|
223
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidCacheRecord],
|
|
136
224
|
},
|
|
137
225
|
invalidCacheEnvironment: {
|
|
138
|
-
code:
|
|
139
|
-
desc:
|
|
226
|
+
code: ClientAuthErrorCodes.invalidCacheEnvironment,
|
|
227
|
+
desc: ClientAuthErrorMessages[
|
|
228
|
+
ClientAuthErrorCodes.invalidCacheEnvironment
|
|
229
|
+
],
|
|
140
230
|
},
|
|
141
231
|
noAccountFound: {
|
|
142
|
-
code:
|
|
143
|
-
desc:
|
|
144
|
-
},
|
|
145
|
-
CachePluginError: {
|
|
146
|
-
code: "no cache plugin set on CacheManager",
|
|
147
|
-
desc: "ICachePlugin needs to be set before using readFromStorage or writeFromStorage",
|
|
232
|
+
code: ClientAuthErrorCodes.noAccountFound,
|
|
233
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.noAccountFound],
|
|
148
234
|
},
|
|
149
235
|
noCryptoObj: {
|
|
150
|
-
code:
|
|
151
|
-
desc:
|
|
152
|
-
},
|
|
153
|
-
invalidCacheType: {
|
|
154
|
-
code: "invalid_cache_type",
|
|
155
|
-
desc: "Invalid cache type",
|
|
156
|
-
},
|
|
157
|
-
unexpectedAccountType: {
|
|
158
|
-
code: "unexpected_account_type",
|
|
159
|
-
desc: "Unexpected account type.",
|
|
236
|
+
code: ClientAuthErrorCodes.noCryptoObject,
|
|
237
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.noCryptoObject],
|
|
160
238
|
},
|
|
161
239
|
unexpectedCredentialType: {
|
|
162
|
-
code:
|
|
163
|
-
desc:
|
|
240
|
+
code: ClientAuthErrorCodes.unexpectedCredentialType,
|
|
241
|
+
desc: ClientAuthErrorMessages[
|
|
242
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
243
|
+
],
|
|
164
244
|
},
|
|
165
245
|
invalidAssertion: {
|
|
166
|
-
code:
|
|
167
|
-
desc:
|
|
246
|
+
code: ClientAuthErrorCodes.invalidAssertion,
|
|
247
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.invalidAssertion],
|
|
168
248
|
},
|
|
169
249
|
invalidClientCredential: {
|
|
170
|
-
code:
|
|
171
|
-
desc:
|
|
250
|
+
code: ClientAuthErrorCodes.invalidClientCredential,
|
|
251
|
+
desc: ClientAuthErrorMessages[
|
|
252
|
+
ClientAuthErrorCodes.invalidClientCredential
|
|
253
|
+
],
|
|
172
254
|
},
|
|
173
255
|
tokenRefreshRequired: {
|
|
174
|
-
code:
|
|
175
|
-
desc:
|
|
256
|
+
code: ClientAuthErrorCodes.tokenRefreshRequired,
|
|
257
|
+
desc: ClientAuthErrorMessages[
|
|
258
|
+
ClientAuthErrorCodes.tokenRefreshRequired
|
|
259
|
+
],
|
|
176
260
|
},
|
|
177
261
|
userTimeoutReached: {
|
|
178
|
-
code:
|
|
179
|
-
desc:
|
|
262
|
+
code: ClientAuthErrorCodes.userTimeoutReached,
|
|
263
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.userTimeoutReached],
|
|
180
264
|
},
|
|
181
265
|
tokenClaimsRequired: {
|
|
182
|
-
code:
|
|
183
|
-
desc:
|
|
266
|
+
code: ClientAuthErrorCodes.tokenClaimsCnfRequiredForSignedJwt,
|
|
267
|
+
desc: ClientAuthErrorMessages[
|
|
268
|
+
ClientAuthErrorCodes.tokenClaimsCnfRequiredForSignedJwt
|
|
269
|
+
],
|
|
184
270
|
},
|
|
185
271
|
noAuthorizationCodeFromServer: {
|
|
186
|
-
code:
|
|
187
|
-
desc:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
code: "no_azure_region_detected",
|
|
191
|
-
desc: "No azure region was detected and no fallback was made available",
|
|
192
|
-
},
|
|
193
|
-
accessTokenEntityNullError: {
|
|
194
|
-
code: "access_token_entity_null",
|
|
195
|
-
desc: "Access token entity is null, please check logs and cache to ensure a valid access token is present.",
|
|
272
|
+
code: ClientAuthErrorCodes.authorizationCodeMissingFromServerResponse,
|
|
273
|
+
desc: ClientAuthErrorMessages[
|
|
274
|
+
ClientAuthErrorCodes.authorizationCodeMissingFromServerResponse
|
|
275
|
+
],
|
|
196
276
|
},
|
|
197
277
|
bindingKeyNotRemovedError: {
|
|
198
|
-
code:
|
|
199
|
-
desc:
|
|
278
|
+
code: ClientAuthErrorCodes.bindingKeyNotRemoved,
|
|
279
|
+
desc: ClientAuthErrorMessages[
|
|
280
|
+
ClientAuthErrorCodes.bindingKeyNotRemoved
|
|
281
|
+
],
|
|
200
282
|
},
|
|
201
283
|
logoutNotSupported: {
|
|
202
|
-
code:
|
|
203
|
-
desc:
|
|
284
|
+
code: ClientAuthErrorCodes.endSessionEndpointNotSupported,
|
|
285
|
+
desc: ClientAuthErrorMessages[
|
|
286
|
+
ClientAuthErrorCodes.endSessionEndpointNotSupported
|
|
287
|
+
],
|
|
204
288
|
},
|
|
205
289
|
keyIdMissing: {
|
|
206
|
-
code:
|
|
207
|
-
desc:
|
|
290
|
+
code: ClientAuthErrorCodes.keyIdMissing,
|
|
291
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.keyIdMissing],
|
|
208
292
|
},
|
|
209
293
|
noNetworkConnectivity: {
|
|
210
|
-
code:
|
|
211
|
-
desc:
|
|
294
|
+
code: ClientAuthErrorCodes.noNetworkConnectivity,
|
|
295
|
+
desc: ClientAuthErrorMessages[
|
|
296
|
+
ClientAuthErrorCodes.noNetworkConnectivity
|
|
297
|
+
],
|
|
212
298
|
},
|
|
213
299
|
userCanceledError: {
|
|
214
|
-
code:
|
|
215
|
-
desc:
|
|
300
|
+
code: ClientAuthErrorCodes.userCanceled,
|
|
301
|
+
desc: ClientAuthErrorMessages[ClientAuthErrorCodes.userCanceled],
|
|
216
302
|
},
|
|
217
303
|
missingTenantIdError: {
|
|
218
|
-
code:
|
|
219
|
-
desc:
|
|
304
|
+
code: ClientAuthErrorCodes.missingTenantIdError,
|
|
305
|
+
desc: ClientAuthErrorMessages[
|
|
306
|
+
ClientAuthErrorCodes.missingTenantIdError
|
|
307
|
+
],
|
|
220
308
|
},
|
|
221
309
|
};
|
|
222
310
|
|
|
@@ -224,515 +312,22 @@ export const ClientAuthErrorMessage = {
|
|
|
224
312
|
* Error thrown when there is an error in the client code running on the browser.
|
|
225
313
|
*/
|
|
226
314
|
export class ClientAuthError extends AuthError {
|
|
227
|
-
constructor(errorCode: string,
|
|
228
|
-
super(
|
|
315
|
+
constructor(errorCode: string, additionalMessage?: string) {
|
|
316
|
+
super(
|
|
317
|
+
errorCode,
|
|
318
|
+
additionalMessage
|
|
319
|
+
? `${ClientAuthErrorMessages[errorCode]}: ${additionalMessage}`
|
|
320
|
+
: ClientAuthErrorMessages[errorCode]
|
|
321
|
+
);
|
|
229
322
|
this.name = "ClientAuthError";
|
|
230
323
|
|
|
231
324
|
Object.setPrototypeOf(this, ClientAuthError.prototype);
|
|
232
325
|
}
|
|
326
|
+
}
|
|
233
327
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return new ClientAuthError(
|
|
240
|
-
ClientAuthErrorMessage.clientInfoDecodingError.code,
|
|
241
|
-
`${ClientAuthErrorMessage.clientInfoDecodingError.desc} Failed with error: ${caughtError}`
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Creates an error thrown if the client info is empty.
|
|
247
|
-
* @param rawClientInfo
|
|
248
|
-
*/
|
|
249
|
-
static createClientInfoEmptyError(): ClientAuthError {
|
|
250
|
-
return new ClientAuthError(
|
|
251
|
-
ClientAuthErrorMessage.clientInfoEmptyError.code,
|
|
252
|
-
`${ClientAuthErrorMessage.clientInfoEmptyError.desc}`
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Creates an error thrown when the id token extraction errors out.
|
|
258
|
-
* @param err
|
|
259
|
-
*/
|
|
260
|
-
static createTokenParsingError(
|
|
261
|
-
caughtExtractionError: string
|
|
262
|
-
): ClientAuthError {
|
|
263
|
-
return new ClientAuthError(
|
|
264
|
-
ClientAuthErrorMessage.tokenParsingError.code,
|
|
265
|
-
`${ClientAuthErrorMessage.tokenParsingError.desc} Failed with error: ${caughtExtractionError}`
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Creates an error thrown when the id token string is null or empty.
|
|
271
|
-
* @param invalidRawTokenString
|
|
272
|
-
*/
|
|
273
|
-
static createTokenNullOrEmptyError(
|
|
274
|
-
invalidRawTokenString: string
|
|
275
|
-
): ClientAuthError {
|
|
276
|
-
return new ClientAuthError(
|
|
277
|
-
ClientAuthErrorMessage.nullOrEmptyToken.code,
|
|
278
|
-
`${ClientAuthErrorMessage.nullOrEmptyToken.desc} Raw Token Value: ${invalidRawTokenString}`
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Creates an error thrown when the endpoint discovery doesn't complete correctly.
|
|
284
|
-
*/
|
|
285
|
-
static createEndpointDiscoveryIncompleteError(
|
|
286
|
-
errDetail: string
|
|
287
|
-
): ClientAuthError {
|
|
288
|
-
return new ClientAuthError(
|
|
289
|
-
ClientAuthErrorMessage.endpointResolutionError.code,
|
|
290
|
-
`${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${errDetail}`
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Creates an error thrown when the fetch client throws
|
|
296
|
-
*/
|
|
297
|
-
static createNetworkError(
|
|
298
|
-
endpoint: string,
|
|
299
|
-
errDetail: string
|
|
300
|
-
): ClientAuthError {
|
|
301
|
-
return new ClientAuthError(
|
|
302
|
-
ClientAuthErrorMessage.networkError.code,
|
|
303
|
-
`${
|
|
304
|
-
ClientAuthErrorMessage.networkError.desc
|
|
305
|
-
} | Fetch client threw: ${errDetail} | Attempted to reach: ${
|
|
306
|
-
endpoint.split("?")[0]
|
|
307
|
-
}`
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Creates an error thrown when the openid-configuration endpoint cannot be reached or does not contain the required data
|
|
313
|
-
*/
|
|
314
|
-
static createUnableToGetOpenidConfigError(
|
|
315
|
-
errDetail: string
|
|
316
|
-
): ClientAuthError {
|
|
317
|
-
return new ClientAuthError(
|
|
318
|
-
ClientAuthErrorMessage.unableToGetOpenidConfigError.code,
|
|
319
|
-
`${ClientAuthErrorMessage.unableToGetOpenidConfigError.desc} Attempted to retrieve endpoints from: ${errDetail}`
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Creates an error thrown when the hash cannot be deserialized.
|
|
325
|
-
* @param hashParamObj
|
|
326
|
-
*/
|
|
327
|
-
static createHashNotDeserializedError(
|
|
328
|
-
hashParamObj: string
|
|
329
|
-
): ClientAuthError {
|
|
330
|
-
return new ClientAuthError(
|
|
331
|
-
ClientAuthErrorMessage.hashNotDeserialized.code,
|
|
332
|
-
`${ClientAuthErrorMessage.hashNotDeserialized.desc} Given Object: ${hashParamObj}`
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Creates an error thrown when the state cannot be parsed.
|
|
338
|
-
* @param invalidState
|
|
339
|
-
*/
|
|
340
|
-
static createInvalidStateError(
|
|
341
|
-
invalidState: string,
|
|
342
|
-
errorString?: string
|
|
343
|
-
): ClientAuthError {
|
|
344
|
-
return new ClientAuthError(
|
|
345
|
-
ClientAuthErrorMessage.invalidStateError.code,
|
|
346
|
-
`${ClientAuthErrorMessage.invalidStateError.desc} Invalid State: ${invalidState}, Root Err: ${errorString}`
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Creates an error thrown when two states do not match.
|
|
352
|
-
*/
|
|
353
|
-
static createStateMismatchError(): ClientAuthError {
|
|
354
|
-
return new ClientAuthError(
|
|
355
|
-
ClientAuthErrorMessage.stateMismatchError.code,
|
|
356
|
-
ClientAuthErrorMessage.stateMismatchError.desc
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Creates an error thrown when the state is not present
|
|
362
|
-
* @param missingState
|
|
363
|
-
*/
|
|
364
|
-
static createStateNotFoundError(missingState: string): ClientAuthError {
|
|
365
|
-
return new ClientAuthError(
|
|
366
|
-
ClientAuthErrorMessage.stateNotFoundError.code,
|
|
367
|
-
`${ClientAuthErrorMessage.stateNotFoundError.desc}: ${missingState}`
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Creates an error thrown when the nonce does not match.
|
|
373
|
-
*/
|
|
374
|
-
static createNonceMismatchError(): ClientAuthError {
|
|
375
|
-
return new ClientAuthError(
|
|
376
|
-
ClientAuthErrorMessage.nonceMismatchError.code,
|
|
377
|
-
ClientAuthErrorMessage.nonceMismatchError.desc
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Creates an error thrown when max_age was provided in the request, but auth_time is not in the token claims
|
|
383
|
-
* @param missingNonce
|
|
384
|
-
*/
|
|
385
|
-
static createAuthTimeNotFoundError(): ClientAuthError {
|
|
386
|
-
return new ClientAuthError(
|
|
387
|
-
ClientAuthErrorMessage.authTimeNotFoundError.code,
|
|
388
|
-
ClientAuthErrorMessage.authTimeNotFoundError.desc
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Creates an error thrown when too much time has elapsed since the last end-user authentication
|
|
394
|
-
*/
|
|
395
|
-
static createMaxAgeTranspiredError(): ClientAuthError {
|
|
396
|
-
return new ClientAuthError(
|
|
397
|
-
ClientAuthErrorMessage.maxAgeTranspiredError.code,
|
|
398
|
-
ClientAuthErrorMessage.maxAgeTranspiredError.desc
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Creates an error thrown when the mnonce is not present
|
|
404
|
-
* @param missingNonce
|
|
405
|
-
*/
|
|
406
|
-
static createNonceNotFoundError(missingNonce: string): ClientAuthError {
|
|
407
|
-
return new ClientAuthError(
|
|
408
|
-
ClientAuthErrorMessage.nonceNotFoundError.code,
|
|
409
|
-
`${ClientAuthErrorMessage.nonceNotFoundError.desc}: ${missingNonce}`
|
|
410
|
-
);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Throws error when multiple tokens are in cache.
|
|
415
|
-
*/
|
|
416
|
-
static createMultipleMatchingTokensInCacheError(): ClientAuthError {
|
|
417
|
-
return new ClientAuthError(
|
|
418
|
-
ClientAuthErrorMessage.multipleMatchingTokens.code,
|
|
419
|
-
`${ClientAuthErrorMessage.multipleMatchingTokens.desc}.`
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Throws error when multiple accounts are in cache for the given params
|
|
425
|
-
*/
|
|
426
|
-
static createMultipleMatchingAccountsInCacheError(): ClientAuthError {
|
|
427
|
-
return new ClientAuthError(
|
|
428
|
-
ClientAuthErrorMessage.multipleMatchingAccounts.code,
|
|
429
|
-
ClientAuthErrorMessage.multipleMatchingAccounts.desc
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Throws error when multiple appMetada are in cache for the given clientId.
|
|
435
|
-
*/
|
|
436
|
-
static createMultipleMatchingAppMetadataInCacheError(): ClientAuthError {
|
|
437
|
-
return new ClientAuthError(
|
|
438
|
-
ClientAuthErrorMessage.multipleMatchingAppMetadata.code,
|
|
439
|
-
ClientAuthErrorMessage.multipleMatchingAppMetadata.desc
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Throws error when no auth code or refresh token is given to ServerTokenRequestParameters.
|
|
445
|
-
*/
|
|
446
|
-
static createTokenRequestCannotBeMadeError(): ClientAuthError {
|
|
447
|
-
return new ClientAuthError(
|
|
448
|
-
ClientAuthErrorMessage.tokenRequestCannotBeMade.code,
|
|
449
|
-
ClientAuthErrorMessage.tokenRequestCannotBeMade.desc
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Throws error when attempting to append a null, undefined or empty scope to a set
|
|
455
|
-
* @param givenScope
|
|
456
|
-
*/
|
|
457
|
-
static createAppendEmptyScopeToSetError(
|
|
458
|
-
givenScope: string
|
|
459
|
-
): ClientAuthError {
|
|
460
|
-
return new ClientAuthError(
|
|
461
|
-
ClientAuthErrorMessage.appendEmptyScopeError.code,
|
|
462
|
-
`${ClientAuthErrorMessage.appendEmptyScopeError.desc} Given Scope: ${givenScope}`
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Throws error when attempting to append a null, undefined or empty scope to a set
|
|
468
|
-
* @param givenScope
|
|
469
|
-
*/
|
|
470
|
-
static createRemoveEmptyScopeFromSetError(
|
|
471
|
-
givenScope: string
|
|
472
|
-
): ClientAuthError {
|
|
473
|
-
return new ClientAuthError(
|
|
474
|
-
ClientAuthErrorMessage.removeEmptyScopeError.code,
|
|
475
|
-
`${ClientAuthErrorMessage.removeEmptyScopeError.desc} Given Scope: ${givenScope}`
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Throws error when attempting to append null or empty ScopeSet.
|
|
481
|
-
* @param appendError
|
|
482
|
-
*/
|
|
483
|
-
static createAppendScopeSetError(appendError: string): ClientAuthError {
|
|
484
|
-
return new ClientAuthError(
|
|
485
|
-
ClientAuthErrorMessage.appendScopeSetError.code,
|
|
486
|
-
`${ClientAuthErrorMessage.appendScopeSetError.desc} Detail Error: ${appendError}`
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Throws error if ScopeSet is null or undefined.
|
|
492
|
-
* @param givenScopeSet
|
|
493
|
-
*/
|
|
494
|
-
static createEmptyInputScopeSetError(): ClientAuthError {
|
|
495
|
-
return new ClientAuthError(
|
|
496
|
-
ClientAuthErrorMessage.emptyInputScopeSetError.code,
|
|
497
|
-
`${ClientAuthErrorMessage.emptyInputScopeSetError.desc}`
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Throws error if user sets CancellationToken.cancel = true during polling of token endpoint during device code flow
|
|
503
|
-
*/
|
|
504
|
-
static createDeviceCodeCancelledError(): ClientAuthError {
|
|
505
|
-
return new ClientAuthError(
|
|
506
|
-
ClientAuthErrorMessage.DeviceCodePollingCancelled.code,
|
|
507
|
-
`${ClientAuthErrorMessage.DeviceCodePollingCancelled.desc}`
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Throws error if device code is expired
|
|
513
|
-
*/
|
|
514
|
-
static createDeviceCodeExpiredError(): ClientAuthError {
|
|
515
|
-
return new ClientAuthError(
|
|
516
|
-
ClientAuthErrorMessage.DeviceCodeExpired.code,
|
|
517
|
-
`${ClientAuthErrorMessage.DeviceCodeExpired.desc}`
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Throws error if device code is expired
|
|
523
|
-
*/
|
|
524
|
-
static createDeviceCodeUnknownError(): ClientAuthError {
|
|
525
|
-
return new ClientAuthError(
|
|
526
|
-
ClientAuthErrorMessage.DeviceCodeUnknownError.code,
|
|
527
|
-
`${ClientAuthErrorMessage.DeviceCodeUnknownError.desc}`
|
|
528
|
-
);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Throws error when silent requests are made without an account object
|
|
533
|
-
*/
|
|
534
|
-
static createNoAccountInSilentRequestError(): ClientAuthError {
|
|
535
|
-
return new ClientAuthError(
|
|
536
|
-
ClientAuthErrorMessage.NoAccountInSilentRequest.code,
|
|
537
|
-
`${ClientAuthErrorMessage.NoAccountInSilentRequest.desc}`
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Throws error when cache record is null or undefined.
|
|
543
|
-
*/
|
|
544
|
-
static createNullOrUndefinedCacheRecord(): ClientAuthError {
|
|
545
|
-
return new ClientAuthError(
|
|
546
|
-
ClientAuthErrorMessage.invalidCacheRecord.code,
|
|
547
|
-
ClientAuthErrorMessage.invalidCacheRecord.desc
|
|
548
|
-
);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Throws error when provided environment is not part of the CloudDiscoveryMetadata object
|
|
553
|
-
*/
|
|
554
|
-
static createInvalidCacheEnvironmentError(): ClientAuthError {
|
|
555
|
-
return new ClientAuthError(
|
|
556
|
-
ClientAuthErrorMessage.invalidCacheEnvironment.code,
|
|
557
|
-
ClientAuthErrorMessage.invalidCacheEnvironment.desc
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* Throws error when account is not found in cache.
|
|
563
|
-
*/
|
|
564
|
-
static createNoAccountFoundError(): ClientAuthError {
|
|
565
|
-
return new ClientAuthError(
|
|
566
|
-
ClientAuthErrorMessage.noAccountFound.code,
|
|
567
|
-
ClientAuthErrorMessage.noAccountFound.desc
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Throws error if ICachePlugin not set on CacheManager.
|
|
573
|
-
*/
|
|
574
|
-
static createCachePluginError(): ClientAuthError {
|
|
575
|
-
return new ClientAuthError(
|
|
576
|
-
ClientAuthErrorMessage.CachePluginError.code,
|
|
577
|
-
`${ClientAuthErrorMessage.CachePluginError.desc}`
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* Throws error if crypto object not found.
|
|
583
|
-
* @param operationName
|
|
584
|
-
*/
|
|
585
|
-
static createNoCryptoObjectError(operationName: string): ClientAuthError {
|
|
586
|
-
return new ClientAuthError(
|
|
587
|
-
ClientAuthErrorMessage.noCryptoObj.code,
|
|
588
|
-
`${ClientAuthErrorMessage.noCryptoObj.desc}${operationName}`
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Throws error if cache type is invalid.
|
|
594
|
-
*/
|
|
595
|
-
static createInvalidCacheTypeError(): ClientAuthError {
|
|
596
|
-
return new ClientAuthError(
|
|
597
|
-
ClientAuthErrorMessage.invalidCacheType.code,
|
|
598
|
-
`${ClientAuthErrorMessage.invalidCacheType.desc}`
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Throws error if unexpected account type.
|
|
604
|
-
*/
|
|
605
|
-
static createUnexpectedAccountTypeError(): ClientAuthError {
|
|
606
|
-
return new ClientAuthError(
|
|
607
|
-
ClientAuthErrorMessage.unexpectedAccountType.code,
|
|
608
|
-
`${ClientAuthErrorMessage.unexpectedAccountType.desc}`
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Throws error if unexpected credential type.
|
|
614
|
-
*/
|
|
615
|
-
static createUnexpectedCredentialTypeError(): ClientAuthError {
|
|
616
|
-
return new ClientAuthError(
|
|
617
|
-
ClientAuthErrorMessage.unexpectedCredentialType.code,
|
|
618
|
-
`${ClientAuthErrorMessage.unexpectedCredentialType.desc}`
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Throws error if client assertion is not valid.
|
|
624
|
-
*/
|
|
625
|
-
static createInvalidAssertionError(): ClientAuthError {
|
|
626
|
-
return new ClientAuthError(
|
|
627
|
-
ClientAuthErrorMessage.invalidAssertion.code,
|
|
628
|
-
`${ClientAuthErrorMessage.invalidAssertion.desc}`
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Throws error if client assertion is not valid.
|
|
634
|
-
*/
|
|
635
|
-
static createInvalidCredentialError(): ClientAuthError {
|
|
636
|
-
return new ClientAuthError(
|
|
637
|
-
ClientAuthErrorMessage.invalidClientCredential.code,
|
|
638
|
-
`${ClientAuthErrorMessage.invalidClientCredential.desc}`
|
|
639
|
-
);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* Throws error if token cannot be retrieved from cache due to refresh being required.
|
|
644
|
-
*/
|
|
645
|
-
static createRefreshRequiredError(): ClientAuthError {
|
|
646
|
-
return new ClientAuthError(
|
|
647
|
-
ClientAuthErrorMessage.tokenRefreshRequired.code,
|
|
648
|
-
ClientAuthErrorMessage.tokenRefreshRequired.desc
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Throws error if the user defined timeout is reached.
|
|
654
|
-
*/
|
|
655
|
-
static createUserTimeoutReachedError(): ClientAuthError {
|
|
656
|
-
return new ClientAuthError(
|
|
657
|
-
ClientAuthErrorMessage.userTimeoutReached.code,
|
|
658
|
-
ClientAuthErrorMessage.userTimeoutReached.desc
|
|
659
|
-
);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
/*
|
|
663
|
-
* Throws error if token claims are not populated for a signed jwt generation
|
|
664
|
-
*/
|
|
665
|
-
static createTokenClaimsRequiredError(): ClientAuthError {
|
|
666
|
-
return new ClientAuthError(
|
|
667
|
-
ClientAuthErrorMessage.tokenClaimsRequired.code,
|
|
668
|
-
ClientAuthErrorMessage.tokenClaimsRequired.desc
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Throws error when the authorization code is missing from the server response
|
|
674
|
-
*/
|
|
675
|
-
static createNoAuthCodeInServerResponseError(): ClientAuthError {
|
|
676
|
-
return new ClientAuthError(
|
|
677
|
-
ClientAuthErrorMessage.noAuthorizationCodeFromServer.code,
|
|
678
|
-
ClientAuthErrorMessage.noAuthorizationCodeFromServer.desc
|
|
679
|
-
);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
static createBindingKeyNotRemovedError(): ClientAuthError {
|
|
683
|
-
return new ClientAuthError(
|
|
684
|
-
ClientAuthErrorMessage.bindingKeyNotRemovedError.code,
|
|
685
|
-
ClientAuthErrorMessage.bindingKeyNotRemovedError.desc
|
|
686
|
-
);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Thrown when logout is attempted for an authority that doesnt have an end_session_endpoint
|
|
691
|
-
*/
|
|
692
|
-
static createLogoutNotSupportedError(): ClientAuthError {
|
|
693
|
-
return new ClientAuthError(
|
|
694
|
-
ClientAuthErrorMessage.logoutNotSupported.code,
|
|
695
|
-
ClientAuthErrorMessage.logoutNotSupported.desc
|
|
696
|
-
);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Create an error when kid attribute is missing from a PoP token's cache record
|
|
701
|
-
*/
|
|
702
|
-
static createKeyIdMissingError(): ClientAuthError {
|
|
703
|
-
return new ClientAuthError(
|
|
704
|
-
ClientAuthErrorMessage.keyIdMissing.code,
|
|
705
|
-
ClientAuthErrorMessage.keyIdMissing.desc
|
|
706
|
-
);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Create an error when the client does not have network connectivity
|
|
711
|
-
*/
|
|
712
|
-
static createNoNetworkConnectivityError(): ClientAuthError {
|
|
713
|
-
return new ClientAuthError(
|
|
714
|
-
ClientAuthErrorMessage.noNetworkConnectivity.code,
|
|
715
|
-
ClientAuthErrorMessage.noNetworkConnectivity.desc
|
|
716
|
-
);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* Create an error when the user cancels the flow
|
|
721
|
-
*/
|
|
722
|
-
static createUserCanceledError(): ClientAuthError {
|
|
723
|
-
return new ClientAuthError(
|
|
724
|
-
ClientAuthErrorMessage.userCanceledError.code,
|
|
725
|
-
ClientAuthErrorMessage.userCanceledError.desc
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
/**
|
|
730
|
-
* Creates an error for during acquireTokenByClientCredential when TenantId is set to "common" or "organizations"
|
|
731
|
-
*/
|
|
732
|
-
static createMissingTenantIdError(): ClientAuthError {
|
|
733
|
-
return new AuthError(
|
|
734
|
-
ClientAuthErrorMessage.missingTenantIdError.code,
|
|
735
|
-
ClientAuthErrorMessage.missingTenantIdError.desc
|
|
736
|
-
);
|
|
737
|
-
}
|
|
328
|
+
export function createClientAuthError(
|
|
329
|
+
errorCode: string,
|
|
330
|
+
additionalMessage?: string
|
|
331
|
+
): ClientAuthError {
|
|
332
|
+
return new ClientAuthError(errorCode, additionalMessage);
|
|
738
333
|
}
|