@azure/msal-common 14.0.2 → 14.0.3
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/AuthToken.d.ts +14 -17
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +48 -39
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/CcsCredential.mjs.map +1 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +3 -4
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +2 -3
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/AuthorityType.mjs.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs.map +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +5 -5
- 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 -7
- 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 +2 -4
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +1 -1
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +10 -39
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +8 -2
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +2 -11
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +7 -7
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/index.cjs +1641 -1560
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.mjs +2 -12
- package/dist/logger/Logger.mjs.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/NetworkManager.mjs.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +6 -7
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +4 -6
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +4 -4
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/AuthenticationResult.d.ts +3 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts +4 -3
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +57 -39
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +2 -0
- package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +4 -4
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +2 -2
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
- 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.d.ts +3 -3
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +23 -3
- package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +3 -4
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +10 -12
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +10 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +11 -2
- 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/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +4 -7
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.d.ts +0 -13
- package/dist/utils/StringUtils.d.ts.map +1 -1
- package/dist/utils/StringUtils.mjs +3 -34
- package/dist/utils/StringUtils.mjs.map +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- 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 +70 -0
- package/src/account/CcsCredential.ts +16 -0
- package/src/account/ClientCredentials.ts +20 -0
- package/src/account/ClientInfo.ts +64 -0
- package/src/account/TokenClaims.ts +70 -0
- package/src/authority/Authority.ts +1225 -0
- package/src/authority/AuthorityFactory.ts +106 -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 +193 -0
- package/src/authority/RegionDiscoveryMetadata.ts +15 -0
- package/src/broker/nativeBroker/INativeBrokerPlugin.ts +29 -0
- package/src/cache/CacheManager.ts +1619 -0
- package/src/cache/entities/AccessTokenEntity.ts +162 -0
- package/src/cache/entities/AccountEntity.ts +309 -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 +215 -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 +714 -0
- package/src/client/BaseClient.ts +205 -0
- package/src/client/RefreshTokenClient.ts +442 -0
- package/src/client/SilentFlowClient.ts +186 -0
- package/src/config/AppTokenProvider.ts +47 -0
- package/src/config/ClientConfiguration.ts +287 -0
- package/src/crypto/ICrypto.ts +127 -0
- package/src/crypto/IGuidGenerator.ts +9 -0
- package/src/crypto/JoseHeader.ts +55 -0
- package/src/crypto/PopTokenGenerator.ts +155 -0
- package/src/crypto/SignedHttpRequest.ts +16 -0
- package/src/error/AuthError.ts +85 -0
- package/src/error/ClientAuthError.ts +738 -0
- package/src/error/ClientConfigurationError.ts +396 -0
- package/src/error/InteractionRequiredAuthError.ts +134 -0
- package/src/error/JoseHeaderError.ts +52 -0
- package/src/error/ServerError.ts +18 -0
- package/src/index.ts +215 -0
- package/src/logger/Logger.ts +272 -0
- package/src/network/INetworkModule.ts +57 -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 +89 -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 +606 -0
- package/src/request/RequestValidator.ts +103 -0
- package/src/request/ScopeSet.ts +230 -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 +614 -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 +635 -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 +363 -0
- package/src/utils/Constants.ts +436 -0
- package/src/utils/FunctionWrappers.ts +105 -0
- package/src/utils/MsalTypes.ts +9 -0
- package/src/utils/ProtocolUtils.ts +124 -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,396 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ClientAuthError } from "./ClientAuthError";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ClientConfigurationErrorMessage class containing string constants used by error codes and messages.
|
|
10
|
+
*/
|
|
11
|
+
export const ClientConfigurationErrorMessage = {
|
|
12
|
+
redirectUriNotSet: {
|
|
13
|
+
code: "redirect_uri_empty",
|
|
14
|
+
desc: "A redirect URI is required for all calls, and none has been set.",
|
|
15
|
+
},
|
|
16
|
+
postLogoutUriNotSet: {
|
|
17
|
+
code: "post_logout_uri_empty",
|
|
18
|
+
desc: "A post logout redirect has not been set.",
|
|
19
|
+
},
|
|
20
|
+
claimsRequestParsingError: {
|
|
21
|
+
code: "claims_request_parsing_error",
|
|
22
|
+
desc: "Could not parse the given claims request object.",
|
|
23
|
+
},
|
|
24
|
+
authorityUriInsecure: {
|
|
25
|
+
code: "authority_uri_insecure",
|
|
26
|
+
desc: "Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",
|
|
27
|
+
},
|
|
28
|
+
urlParseError: {
|
|
29
|
+
code: "url_parse_error",
|
|
30
|
+
desc: "URL could not be parsed into appropriate segments.",
|
|
31
|
+
},
|
|
32
|
+
urlEmptyError: {
|
|
33
|
+
code: "empty_url_error",
|
|
34
|
+
desc: "URL was empty or null.",
|
|
35
|
+
},
|
|
36
|
+
emptyScopesError: {
|
|
37
|
+
code: "empty_input_scopes_error",
|
|
38
|
+
desc: "Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",
|
|
39
|
+
},
|
|
40
|
+
nonArrayScopesError: {
|
|
41
|
+
code: "nonarray_input_scopes_error",
|
|
42
|
+
desc: "Scopes cannot be passed as non-array.",
|
|
43
|
+
},
|
|
44
|
+
clientIdSingleScopeError: {
|
|
45
|
+
code: "clientid_input_scopes_error",
|
|
46
|
+
desc: "Client ID can only be provided as a single scope.",
|
|
47
|
+
},
|
|
48
|
+
invalidPrompt: {
|
|
49
|
+
code: "invalid_prompt_value",
|
|
50
|
+
desc: "Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",
|
|
51
|
+
},
|
|
52
|
+
invalidClaimsRequest: {
|
|
53
|
+
code: "invalid_claims",
|
|
54
|
+
desc: "Given claims parameter must be a stringified JSON object.",
|
|
55
|
+
},
|
|
56
|
+
tokenRequestEmptyError: {
|
|
57
|
+
code: "token_request_empty",
|
|
58
|
+
desc: "Token request was empty and not found in cache.",
|
|
59
|
+
},
|
|
60
|
+
logoutRequestEmptyError: {
|
|
61
|
+
code: "logout_request_empty",
|
|
62
|
+
desc: "The logout request was null or undefined.",
|
|
63
|
+
},
|
|
64
|
+
invalidCodeChallengeMethod: {
|
|
65
|
+
code: "invalid_code_challenge_method",
|
|
66
|
+
desc: 'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',
|
|
67
|
+
},
|
|
68
|
+
invalidCodeChallengeParams: {
|
|
69
|
+
code: "pkce_params_missing",
|
|
70
|
+
desc: "Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",
|
|
71
|
+
},
|
|
72
|
+
invalidCloudDiscoveryMetadata: {
|
|
73
|
+
code: "invalid_cloud_discovery_metadata",
|
|
74
|
+
desc: "Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",
|
|
75
|
+
},
|
|
76
|
+
invalidAuthorityMetadata: {
|
|
77
|
+
code: "invalid_authority_metadata",
|
|
78
|
+
desc: "Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",
|
|
79
|
+
},
|
|
80
|
+
untrustedAuthority: {
|
|
81
|
+
code: "untrusted_authority",
|
|
82
|
+
desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",
|
|
83
|
+
},
|
|
84
|
+
invalidAzureCloudInstance: {
|
|
85
|
+
code: "invalid_azure_cloud_instance",
|
|
86
|
+
desc: "Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values",
|
|
87
|
+
},
|
|
88
|
+
missingSshJwk: {
|
|
89
|
+
code: "missing_ssh_jwk",
|
|
90
|
+
desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",
|
|
91
|
+
},
|
|
92
|
+
missingSshKid: {
|
|
93
|
+
code: "missing_ssh_kid",
|
|
94
|
+
desc: "Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",
|
|
95
|
+
},
|
|
96
|
+
missingNonceAuthenticationHeader: {
|
|
97
|
+
code: "missing_nonce_authentication_header",
|
|
98
|
+
desc: "Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",
|
|
99
|
+
},
|
|
100
|
+
invalidAuthenticationHeader: {
|
|
101
|
+
code: "invalid_authentication_header",
|
|
102
|
+
desc: "Invalid authentication header provided",
|
|
103
|
+
},
|
|
104
|
+
cannotSetOIDCOptions: {
|
|
105
|
+
code: "cannot_set_OIDCOptions",
|
|
106
|
+
desc: "Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",
|
|
107
|
+
},
|
|
108
|
+
cannotAllowNativeBroker: {
|
|
109
|
+
code: "cannot_allow_native_broker",
|
|
110
|
+
desc: "Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",
|
|
111
|
+
},
|
|
112
|
+
authorityMismatch: {
|
|
113
|
+
code: "authority_mismatch",
|
|
114
|
+
desc: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
120
|
+
*/
|
|
121
|
+
export class ClientConfigurationError extends ClientAuthError {
|
|
122
|
+
constructor(errorCode: string, errorMessage?: string) {
|
|
123
|
+
super(errorCode, errorMessage);
|
|
124
|
+
this.name = "ClientConfigurationError";
|
|
125
|
+
Object.setPrototypeOf(this, ClientConfigurationError.prototype);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Creates an error thrown when the redirect uri is empty (not set by caller)
|
|
130
|
+
*/
|
|
131
|
+
static createRedirectUriEmptyError(): ClientConfigurationError {
|
|
132
|
+
return new ClientConfigurationError(
|
|
133
|
+
ClientConfigurationErrorMessage.redirectUriNotSet.code,
|
|
134
|
+
ClientConfigurationErrorMessage.redirectUriNotSet.desc
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Creates an error thrown when the post-logout redirect uri is empty (not set by caller)
|
|
140
|
+
*/
|
|
141
|
+
static createPostLogoutRedirectUriEmptyError(): ClientConfigurationError {
|
|
142
|
+
return new ClientConfigurationError(
|
|
143
|
+
ClientConfigurationErrorMessage.postLogoutUriNotSet.code,
|
|
144
|
+
ClientConfigurationErrorMessage.postLogoutUriNotSet.desc
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Creates an error thrown when the claims request could not be successfully parsed
|
|
150
|
+
*/
|
|
151
|
+
static createClaimsRequestParsingError(
|
|
152
|
+
claimsRequestParseError: string
|
|
153
|
+
): ClientConfigurationError {
|
|
154
|
+
return new ClientConfigurationError(
|
|
155
|
+
ClientConfigurationErrorMessage.claimsRequestParsingError.code,
|
|
156
|
+
`${ClientConfigurationErrorMessage.claimsRequestParsingError.desc} Given value: ${claimsRequestParseError}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Creates an error thrown if authority uri is given an insecure protocol.
|
|
162
|
+
* @param urlString
|
|
163
|
+
*/
|
|
164
|
+
static createInsecureAuthorityUriError(
|
|
165
|
+
urlString: string
|
|
166
|
+
): ClientConfigurationError {
|
|
167
|
+
return new ClientConfigurationError(
|
|
168
|
+
ClientConfigurationErrorMessage.authorityUriInsecure.code,
|
|
169
|
+
`${ClientConfigurationErrorMessage.authorityUriInsecure.desc} Given URI: ${urlString}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Creates an error thrown if URL string does not parse into separate segments.
|
|
175
|
+
* @param urlString
|
|
176
|
+
*/
|
|
177
|
+
static createUrlParseError(
|
|
178
|
+
urlParseError: string
|
|
179
|
+
): ClientConfigurationError {
|
|
180
|
+
return new ClientConfigurationError(
|
|
181
|
+
ClientConfigurationErrorMessage.urlParseError.code,
|
|
182
|
+
`${ClientConfigurationErrorMessage.urlParseError.desc} Given Error: ${urlParseError}`
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Creates an error thrown if URL string is empty or null.
|
|
188
|
+
* @param urlString
|
|
189
|
+
*/
|
|
190
|
+
static createUrlEmptyError(): ClientConfigurationError {
|
|
191
|
+
return new ClientConfigurationError(
|
|
192
|
+
ClientConfigurationErrorMessage.urlEmptyError.code,
|
|
193
|
+
ClientConfigurationErrorMessage.urlEmptyError.desc
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Error thrown when scopes are empty.
|
|
199
|
+
* @param scopesValue
|
|
200
|
+
*/
|
|
201
|
+
static createEmptyScopesArrayError(): ClientConfigurationError {
|
|
202
|
+
return new ClientConfigurationError(
|
|
203
|
+
ClientConfigurationErrorMessage.emptyScopesError.code,
|
|
204
|
+
`${ClientConfigurationErrorMessage.emptyScopesError.desc}`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Error thrown when client id scope is not provided as single scope.
|
|
210
|
+
* @param inputScopes
|
|
211
|
+
*/
|
|
212
|
+
static createClientIdSingleScopeError(
|
|
213
|
+
inputScopes: Array<string>
|
|
214
|
+
): ClientConfigurationError {
|
|
215
|
+
return new ClientConfigurationError(
|
|
216
|
+
ClientConfigurationErrorMessage.clientIdSingleScopeError.code,
|
|
217
|
+
`${ClientConfigurationErrorMessage.clientIdSingleScopeError.desc} Given Scopes: ${inputScopes}`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Error thrown when prompt is not an allowed type.
|
|
223
|
+
* @param promptValue
|
|
224
|
+
*/
|
|
225
|
+
static createInvalidPromptError(
|
|
226
|
+
promptValue: string
|
|
227
|
+
): ClientConfigurationError {
|
|
228
|
+
return new ClientConfigurationError(
|
|
229
|
+
ClientConfigurationErrorMessage.invalidPrompt.code,
|
|
230
|
+
`${ClientConfigurationErrorMessage.invalidPrompt.desc} Given value: ${promptValue}`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Creates error thrown when claims parameter is not a stringified JSON object
|
|
236
|
+
*/
|
|
237
|
+
static createInvalidClaimsRequestError(): ClientConfigurationError {
|
|
238
|
+
return new ClientConfigurationError(
|
|
239
|
+
ClientConfigurationErrorMessage.invalidClaimsRequest.code,
|
|
240
|
+
ClientConfigurationErrorMessage.invalidClaimsRequest.desc
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Throws error when token request is empty and nothing cached in storage.
|
|
246
|
+
*/
|
|
247
|
+
static createEmptyLogoutRequestError(): ClientConfigurationError {
|
|
248
|
+
return new ClientConfigurationError(
|
|
249
|
+
ClientConfigurationErrorMessage.logoutRequestEmptyError.code,
|
|
250
|
+
ClientConfigurationErrorMessage.logoutRequestEmptyError.desc
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Throws error when token request is empty and nothing cached in storage.
|
|
256
|
+
*/
|
|
257
|
+
static createEmptyTokenRequestError(): ClientConfigurationError {
|
|
258
|
+
return new ClientConfigurationError(
|
|
259
|
+
ClientConfigurationErrorMessage.tokenRequestEmptyError.code,
|
|
260
|
+
ClientConfigurationErrorMessage.tokenRequestEmptyError.desc
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Throws error when an invalid code_challenge_method is passed by the user
|
|
266
|
+
*/
|
|
267
|
+
static createInvalidCodeChallengeMethodError(): ClientConfigurationError {
|
|
268
|
+
return new ClientConfigurationError(
|
|
269
|
+
ClientConfigurationErrorMessage.invalidCodeChallengeMethod.code,
|
|
270
|
+
ClientConfigurationErrorMessage.invalidCodeChallengeMethod.desc
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Throws error when both params: code_challenge and code_challenge_method are not passed together
|
|
276
|
+
*/
|
|
277
|
+
static createInvalidCodeChallengeParamsError(): ClientConfigurationError {
|
|
278
|
+
return new ClientConfigurationError(
|
|
279
|
+
ClientConfigurationErrorMessage.invalidCodeChallengeParams.code,
|
|
280
|
+
ClientConfigurationErrorMessage.invalidCodeChallengeParams.desc
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Throws an error when the user passes invalid cloudDiscoveryMetadata
|
|
286
|
+
*/
|
|
287
|
+
static createInvalidCloudDiscoveryMetadataError(): ClientConfigurationError {
|
|
288
|
+
return new ClientConfigurationError(
|
|
289
|
+
ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.code,
|
|
290
|
+
ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.desc
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Throws an error when the user passes invalid cloudDiscoveryMetadata
|
|
296
|
+
*/
|
|
297
|
+
static createInvalidAuthorityMetadataError(): ClientConfigurationError {
|
|
298
|
+
return new ClientConfigurationError(
|
|
299
|
+
ClientConfigurationErrorMessage.invalidAuthorityMetadata.code,
|
|
300
|
+
ClientConfigurationErrorMessage.invalidAuthorityMetadata.desc
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Throws error when provided authority is not a member of the trusted host list
|
|
306
|
+
*/
|
|
307
|
+
static createUntrustedAuthorityError(): ClientConfigurationError {
|
|
308
|
+
return new ClientConfigurationError(
|
|
309
|
+
ClientConfigurationErrorMessage.untrustedAuthority.code,
|
|
310
|
+
ClientConfigurationErrorMessage.untrustedAuthority.desc
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Throws error when the AzureCloudInstance is set to an invalid value
|
|
316
|
+
*/
|
|
317
|
+
static createInvalidAzureCloudInstanceError(): ClientConfigurationError {
|
|
318
|
+
return new ClientConfigurationError(
|
|
319
|
+
ClientConfigurationErrorMessage.invalidAzureCloudInstance.code,
|
|
320
|
+
ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
|
|
326
|
+
*/
|
|
327
|
+
static createMissingSshJwkError(): ClientConfigurationError {
|
|
328
|
+
return new ClientConfigurationError(
|
|
329
|
+
ClientConfigurationErrorMessage.missingSshJwk.code,
|
|
330
|
+
ClientConfigurationErrorMessage.missingSshJwk.desc
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Throws an error when the authentication scheme is set to SSH but the SSH public key ID is omitted from the request
|
|
336
|
+
*/
|
|
337
|
+
static createMissingSshKidError(): ClientConfigurationError {
|
|
338
|
+
return new ClientConfigurationError(
|
|
339
|
+
ClientConfigurationErrorMessage.missingSshKid.code,
|
|
340
|
+
ClientConfigurationErrorMessage.missingSshKid.desc
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Throws error when provided headers don't contain a header that a server nonce can be extracted from
|
|
346
|
+
*/
|
|
347
|
+
static createMissingNonceAuthenticationHeadersError(): ClientConfigurationError {
|
|
348
|
+
return new ClientConfigurationError(
|
|
349
|
+
ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.code,
|
|
350
|
+
ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.desc
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Throws error when a provided header is invalid in any way
|
|
356
|
+
*/
|
|
357
|
+
static createInvalidAuthenticationHeaderError(
|
|
358
|
+
invalidHeaderName: string,
|
|
359
|
+
details: string
|
|
360
|
+
): ClientConfigurationError {
|
|
361
|
+
return new ClientConfigurationError(
|
|
362
|
+
ClientConfigurationErrorMessage.invalidAuthenticationHeader.code,
|
|
363
|
+
`${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Throws error when provided non-default OIDCOptions when not in OIDC protocol mode
|
|
369
|
+
*/
|
|
370
|
+
static createCannotSetOIDCOptionsError(): ClientConfigurationError {
|
|
371
|
+
return new ClientConfigurationError(
|
|
372
|
+
ClientConfigurationErrorMessage.cannotSetOIDCOptions.code,
|
|
373
|
+
ClientConfigurationErrorMessage.cannotSetOIDCOptions.desc
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Throws error when allowNativeBroker is set to true when not in AAD protocol mode
|
|
379
|
+
*/
|
|
380
|
+
static createCannotAllowNativeBrokerError(): ClientConfigurationError {
|
|
381
|
+
return new ClientConfigurationError(
|
|
382
|
+
ClientConfigurationErrorMessage.cannotAllowNativeBroker.code,
|
|
383
|
+
ClientConfigurationErrorMessage.cannotAllowNativeBroker.desc
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
|
|
389
|
+
*/
|
|
390
|
+
static createAuthorityMismatchError(): ClientConfigurationError {
|
|
391
|
+
return new ClientConfigurationError(
|
|
392
|
+
ClientConfigurationErrorMessage.authorityMismatch.code,
|
|
393
|
+
ClientConfigurationErrorMessage.authorityMismatch.desc
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { AuthError } from "./AuthError";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required
|
|
11
|
+
*/
|
|
12
|
+
export const InteractionRequiredServerErrorMessage = [
|
|
13
|
+
"interaction_required",
|
|
14
|
+
"consent_required",
|
|
15
|
+
"login_required",
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const InteractionRequiredAuthSubErrorMessage = [
|
|
19
|
+
"message_only",
|
|
20
|
+
"additional_action",
|
|
21
|
+
"basic_action",
|
|
22
|
+
"user_password_expired",
|
|
23
|
+
"consent_required",
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Interaction required errors defined by the SDK
|
|
28
|
+
*/
|
|
29
|
+
export const InteractionRequiredAuthErrorMessage = {
|
|
30
|
+
noTokensFoundError: {
|
|
31
|
+
code: "no_tokens_found",
|
|
32
|
+
desc: "No refresh token found in the cache. Please sign-in.",
|
|
33
|
+
},
|
|
34
|
+
native_account_unavailable: {
|
|
35
|
+
code: "native_account_unavailable",
|
|
36
|
+
desc: "The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Error thrown when user interaction is required.
|
|
42
|
+
*/
|
|
43
|
+
export class InteractionRequiredAuthError extends AuthError {
|
|
44
|
+
/**
|
|
45
|
+
* The time the error occured at
|
|
46
|
+
*/
|
|
47
|
+
timestamp: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* TraceId associated with the error
|
|
51
|
+
*/
|
|
52
|
+
traceId: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/docs/claims-challenge.md
|
|
56
|
+
*
|
|
57
|
+
* A string with extra claims needed for the token request to succeed
|
|
58
|
+
* web site: redirect the user to the authorization page and set the extra claims
|
|
59
|
+
* web api: include the claims in the WWW-Authenticate header that are sent back to the client so that it knows to request a token with the extra claims
|
|
60
|
+
* desktop application or browser context: include the claims when acquiring the token interactively
|
|
61
|
+
* app to app context (client_credentials): include the claims in the AcquireTokenByClientCredential request
|
|
62
|
+
*/
|
|
63
|
+
claims: string;
|
|
64
|
+
|
|
65
|
+
constructor(
|
|
66
|
+
errorCode?: string,
|
|
67
|
+
errorMessage?: string,
|
|
68
|
+
subError?: string,
|
|
69
|
+
timestamp?: string,
|
|
70
|
+
traceId?: string,
|
|
71
|
+
correlationId?: string,
|
|
72
|
+
claims?: string
|
|
73
|
+
) {
|
|
74
|
+
super(errorCode, errorMessage, subError);
|
|
75
|
+
Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
|
|
76
|
+
|
|
77
|
+
this.timestamp = timestamp || Constants.EMPTY_STRING;
|
|
78
|
+
this.traceId = traceId || Constants.EMPTY_STRING;
|
|
79
|
+
this.correlationId = correlationId || Constants.EMPTY_STRING;
|
|
80
|
+
this.claims = claims || Constants.EMPTY_STRING;
|
|
81
|
+
this.name = "InteractionRequiredAuthError";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Helper function used to determine if an error thrown by the server requires interaction to resolve
|
|
86
|
+
* @param errorCode
|
|
87
|
+
* @param errorString
|
|
88
|
+
* @param subError
|
|
89
|
+
*/
|
|
90
|
+
static isInteractionRequiredError(
|
|
91
|
+
errorCode?: string,
|
|
92
|
+
errorString?: string,
|
|
93
|
+
subError?: string
|
|
94
|
+
): boolean {
|
|
95
|
+
const isInteractionRequiredErrorCode =
|
|
96
|
+
!!errorCode &&
|
|
97
|
+
InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;
|
|
98
|
+
const isInteractionRequiredSubError =
|
|
99
|
+
!!subError &&
|
|
100
|
+
InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;
|
|
101
|
+
const isInteractionRequiredErrorDesc =
|
|
102
|
+
!!errorString &&
|
|
103
|
+
InteractionRequiredServerErrorMessage.some((irErrorCode) => {
|
|
104
|
+
return errorString.indexOf(irErrorCode) > -1;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
isInteractionRequiredErrorCode ||
|
|
109
|
+
isInteractionRequiredErrorDesc ||
|
|
110
|
+
isInteractionRequiredSubError
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Creates an error thrown when the authorization code required for a token request is null or empty.
|
|
116
|
+
*/
|
|
117
|
+
static createNoTokensFoundError(): InteractionRequiredAuthError {
|
|
118
|
+
return new InteractionRequiredAuthError(
|
|
119
|
+
InteractionRequiredAuthErrorMessage.noTokensFoundError.code,
|
|
120
|
+
InteractionRequiredAuthErrorMessage.noTokensFoundError.desc
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Creates an error thrown when the native broker returns ACCOUNT_UNAVAILABLE status, indicating that the account was removed and interactive sign-in is required
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
static createNativeAccountUnavailableError(): InteractionRequiredAuthError {
|
|
129
|
+
return new InteractionRequiredAuthError(
|
|
130
|
+
InteractionRequiredAuthErrorMessage.native_account_unavailable.code,
|
|
131
|
+
InteractionRequiredAuthErrorMessage.native_account_unavailable.desc
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthError } from "./AuthError";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
10
|
+
*/
|
|
11
|
+
export const JoseHeaderErrorMessage = {
|
|
12
|
+
missingKidError: {
|
|
13
|
+
code: "missing_kid_error",
|
|
14
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",
|
|
15
|
+
},
|
|
16
|
+
missingAlgError: {
|
|
17
|
+
code: "missing_alg_error",
|
|
18
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided.",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
24
|
+
*/
|
|
25
|
+
export class JoseHeaderError extends AuthError {
|
|
26
|
+
constructor(errorCode: string, errorMessage?: string) {
|
|
27
|
+
super(errorCode, errorMessage);
|
|
28
|
+
this.name = "JoseHeaderError";
|
|
29
|
+
|
|
30
|
+
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates an error thrown when keyId isn't set on JOSE header.
|
|
35
|
+
*/
|
|
36
|
+
static createMissingKidError(): JoseHeaderError {
|
|
37
|
+
return new JoseHeaderError(
|
|
38
|
+
JoseHeaderErrorMessage.missingKidError.code,
|
|
39
|
+
JoseHeaderErrorMessage.missingKidError.desc
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates an error thrown when algorithm isn't set on JOSE header.
|
|
45
|
+
*/
|
|
46
|
+
static createMissingAlgError(): JoseHeaderError {
|
|
47
|
+
return new JoseHeaderError(
|
|
48
|
+
JoseHeaderErrorMessage.missingAlgError.code,
|
|
49
|
+
JoseHeaderErrorMessage.missingAlgError.desc
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AuthError } from "./AuthError";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when there is an error with the server code, for example, unavailability.
|
|
10
|
+
*/
|
|
11
|
+
export class ServerError extends AuthError {
|
|
12
|
+
constructor(errorCode?: string, errorMessage?: string, subError?: string) {
|
|
13
|
+
super(errorCode, errorMessage, subError);
|
|
14
|
+
this.name = "ServerError";
|
|
15
|
+
|
|
16
|
+
Object.setPrototypeOf(this, ServerError.prototype);
|
|
17
|
+
}
|
|
18
|
+
}
|