@azure/msal-common 14.0.3 → 14.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/AccountInfo.d.ts +32 -32
- package/dist/account/AuthToken.d.ts +17 -17
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +60 -59
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.d.ts +9 -9
- package/dist/account/CcsCredential.mjs +8 -8
- package/dist/account/ClientCredentials.d.ts +14 -14
- package/dist/account/ClientInfo.d.ts +19 -19
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +39 -38
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/account/TokenClaims.d.ts +65 -65
- package/dist/authority/Authority.d.ts +235 -235
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +743 -765
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +31 -31
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +52 -50
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +623 -623
- package/dist/authority/AuthorityMetadata.mjs +884 -884
- package/dist/authority/AuthorityOptions.d.ts +21 -21
- package/dist/authority/AuthorityOptions.mjs +18 -18
- package/dist/authority/AuthorityType.d.ts +10 -10
- package/dist/authority/AuthorityType.mjs +13 -13
- package/dist/authority/AzureRegion.d.ts +1 -1
- package/dist/authority/AzureRegionConfiguration.d.ts +5 -5
- package/dist/authority/CloudDiscoveryMetadata.d.ts +5 -5
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +13 -13
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +8 -8
- package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +9 -9
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +8 -8
- package/dist/authority/ImdsOptions.d.ts +5 -5
- package/dist/authority/OIDCOptions.d.ts +8 -8
- package/dist/authority/OpenIdConfigResponse.d.ts +11 -11
- package/dist/authority/OpenIdConfigResponse.mjs +10 -10
- package/dist/authority/ProtocolMode.d.ts +8 -8
- package/dist/authority/ProtocolMode.mjs +11 -11
- package/dist/authority/RegionDiscovery.d.ts +32 -30
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +107 -108
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/authority/RegionDiscoveryMetadata.d.ts +6 -6
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +15 -15
- package/dist/cache/CacheManager.d.ts +446 -446
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +1000 -1024
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +56 -56
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.mjs +111 -110
- package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +101 -101
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +222 -221
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.d.ts +39 -39
- package/dist/cache/entities/AppMetadataEntity.mjs +66 -66
- package/dist/cache/entities/AuthorityMetadataEntity.d.ts +48 -48
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +78 -78
- package/dist/cache/entities/CacheRecord.d.ts +14 -14
- package/dist/cache/entities/CacheRecord.mjs +14 -14
- package/dist/cache/entities/CredentialEntity.d.ts +88 -88
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +138 -137
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts +34 -34
- package/dist/cache/entities/IdTokenEntity.mjs +56 -56
- package/dist/cache/entities/RefreshTokenEntity.d.ts +36 -36
- package/dist/cache/entities/RefreshTokenEntity.mjs +59 -59
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +12 -12
- package/dist/cache/entities/ServerTelemetryEntity.mjs +27 -27
- package/dist/cache/entities/ThrottlingEntity.d.ts +13 -13
- package/dist/cache/entities/ThrottlingEntity.mjs +23 -23
- package/dist/cache/interface/ICacheManager.d.ts +166 -166
- package/dist/cache/interface/ICachePlugin.d.ts +5 -5
- package/dist/cache/interface/ISerializableTokenCache.d.ts +4 -4
- package/dist/cache/persistence/TokenCacheContext.d.ts +23 -23
- package/dist/cache/persistence/TokenCacheContext.mjs +25 -25
- package/dist/cache/utils/CacheTypes.d.ts +69 -69
- package/dist/client/AuthorizationCodeClient.d.ts +73 -73
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +411 -410
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +51 -51
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +100 -99
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts +35 -35
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +185 -234
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +26 -25
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +127 -103
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/AppTokenProvider.d.ts +38 -38
- package/dist/config/ClientConfiguration.d.ts +150 -150
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +99 -100
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/crypto/ICrypto.d.ts +62 -62
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +35 -43
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/IGuidGenerator.d.ts +4 -4
- package/dist/crypto/JoseHeader.d.ts +22 -22
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +39 -38
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +60 -59
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +83 -83
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +11 -11
- package/dist/error/AuthError.d.ts +44 -47
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +50 -52
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.d.ts +6 -0
- package/dist/error/AuthErrorCodes.d.ts.map +1 -0
- package/dist/error/AuthErrorCodes.mjs +14 -0
- package/dist/error/AuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientAuthError.d.ts +232 -412
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +248 -520
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +44 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientAuthErrorCodes.mjs +52 -0
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientConfigurationError.d.ts +128 -222
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +140 -281
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +23 -0
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs +31 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -0
- package/dist/error/InteractionRequiredAuthError.d.ts +57 -59
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +80 -79
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts +6 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +16 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs.map +1 -0
- package/dist/error/JoseHeaderError.d.ts +15 -28
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +24 -40
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.d.ts +3 -0
- package/dist/error/JoseHeaderErrorCodes.d.ts.map +1 -0
- package/dist/error/JoseHeaderErrorCodes.mjs +11 -0
- package/dist/error/JoseHeaderErrorCodes.mjs.map +1 -0
- package/dist/error/ServerError.d.ts +7 -7
- package/dist/error/ServerError.mjs +14 -14
- package/dist/index.cjs +8715 -9047
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +96 -96
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.d.ts +95 -95
- package/dist/logger/Logger.mjs +188 -188
- package/dist/network/INetworkModule.d.ts +29 -29
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +14 -15
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/NetworkManager.d.ts +33 -33
- package/dist/network/NetworkManager.d.ts.map +1 -1
- package/dist/network/NetworkManager.mjs +36 -35
- package/dist/network/NetworkManager.mjs.map +1 -1
- package/dist/network/RequestThumbprint.d.ts +16 -16
- package/dist/network/ThrottlingUtils.d.ts +42 -42
- package/dist/network/ThrottlingUtils.mjs +95 -95
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +3 -3
- package/dist/request/AuthenticationHeaderParser.d.ts +19 -19
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +58 -57
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/BaseAuthRequest.d.ts +40 -40
- package/dist/request/CommonAuthorizationCodeRequest.d.ts +27 -27
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +50 -50
- package/dist/request/CommonClientCredentialRequest.d.ts +17 -17
- package/dist/request/CommonDeviceCodeRequest.d.ts +21 -21
- package/dist/request/CommonEndSessionRequest.d.ts +21 -21
- package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -13
- package/dist/request/CommonRefreshTokenRequest.d.ts +19 -19
- package/dist/request/CommonSilentFlowRequest.d.ts +18 -18
- package/dist/request/CommonUsernamePasswordRequest.d.ts +17 -17
- package/dist/request/NativeRequest.d.ts +19 -19
- package/dist/request/NativeSignOutRequest.d.ts +5 -5
- package/dist/request/RequestParameterBuilder.d.ts +217 -217
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +383 -382
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts +33 -33
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +83 -82
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.d.ts +88 -88
- package/dist/request/ScopeSet.d.ts.map +1 -1
- package/dist/request/ScopeSet.mjs +201 -199
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/request/StoreInCache.d.ts +8 -8
- package/dist/response/AuthenticationResult.d.ts +41 -41
- package/dist/response/AuthorizationCodePayload.d.ts +13 -13
- package/dist/response/DeviceCodeResponse.d.ts +25 -25
- package/dist/response/ExternalTokenResponse.d.ts +15 -15
- package/dist/response/IMDSBadResponse.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +67 -67
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +314 -313
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +25 -25
- package/dist/response/ServerAuthorizationTokenResponse.d.ts +46 -46
- package/dist/telemetry/performance/IPerformanceClient.d.ts +51 -51
- package/dist/telemetry/performance/IPerformanceMeasurement.d.ts +5 -5
- package/dist/telemetry/performance/PerformanceClient.d.ts +191 -191
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +409 -408
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +433 -433
- package/dist/telemetry/performance/PerformanceEvent.mjs +234 -234
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +24 -24
- package/dist/telemetry/performance/StubPerformanceClient.mjs +76 -76
- package/dist/telemetry/server/ServerTelemetryManager.d.ts +66 -66
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +197 -197
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/telemetry/server/ServerTelemetryRequest.d.ts +8 -8
- package/dist/url/IUri.d.ts +12 -12
- package/dist/url/UrlString.d.ts +83 -83
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +283 -281
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +366 -363
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +376 -368
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts +27 -27
- package/dist/utils/FunctionWrappers.mjs +85 -85
- package/dist/utils/MsalTypes.d.ts +6 -6
- package/dist/utils/ProtocolUtils.d.ts +42 -42
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +71 -70
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.d.ts +40 -40
- package/dist/utils/StringUtils.mjs +95 -95
- package/dist/utils/TimeUtils.d.ts +27 -27
- package/dist/utils/TimeUtils.mjs +45 -45
- package/package.json +1 -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 +37 -77
- 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/client/AuthorizationCodeClient.ts +32 -10
- package/src/client/BaseClient.ts +7 -4
- package/src/client/RefreshTokenClient.ts +81 -124
- package/src/client/SilentFlowClient.ts +72 -19
- package/src/config/ClientConfiguration.ts +6 -7
- package/src/crypto/ICrypto.ts +13 -28
- 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 +12 -1
- package/src/network/INetworkModule.ts +10 -7
- package/src/network/NetworkManager.ts +5 -5
- package/src/request/AuthenticationHeaderParser.ts +11 -8
- 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/server/ServerTelemetryManager.ts +1 -1
- package/src/url/UrlString.ts +26 -16
- package/src/utils/Constants.ts +11 -3
- package/src/utils/ProtocolUtils.ts +8 -12
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import { Constants } from "../utils/Constants";
|
|
7
7
|
import { AuthError } from "./AuthError";
|
|
8
|
+
import * as InteractionRequiredAuthErrorCodes from "./InteractionRequiredAuthErrorCodes";
|
|
9
|
+
export { InteractionRequiredAuthErrorCodes };
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required
|
|
11
13
|
*/
|
|
12
14
|
export const InteractionRequiredServerErrorMessage = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
InteractionRequiredAuthErrorCodes.interactionRequired,
|
|
16
|
+
InteractionRequiredAuthErrorCodes.consentRequired,
|
|
17
|
+
InteractionRequiredAuthErrorCodes.loginRequired,
|
|
16
18
|
];
|
|
17
19
|
|
|
18
20
|
export const InteractionRequiredAuthSubErrorMessage = [
|
|
@@ -23,17 +25,29 @@ export const InteractionRequiredAuthSubErrorMessage = [
|
|
|
23
25
|
"consent_required",
|
|
24
26
|
];
|
|
25
27
|
|
|
28
|
+
const InteractionRequiredAuthErrorMessages = {
|
|
29
|
+
[InteractionRequiredAuthErrorCodes.noTokensFound]:
|
|
30
|
+
"No refresh token found in the cache. Please sign-in.",
|
|
31
|
+
[InteractionRequiredAuthErrorCodes.nativeAccountUnavailable]:
|
|
32
|
+
"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.",
|
|
33
|
+
};
|
|
34
|
+
|
|
26
35
|
/**
|
|
27
36
|
* Interaction required errors defined by the SDK
|
|
37
|
+
* @deprecated Use InteractionRequiredAuthErrorCodes instead
|
|
28
38
|
*/
|
|
29
39
|
export const InteractionRequiredAuthErrorMessage = {
|
|
30
40
|
noTokensFoundError: {
|
|
31
|
-
code:
|
|
32
|
-
desc:
|
|
41
|
+
code: InteractionRequiredAuthErrorCodes.noTokensFound,
|
|
42
|
+
desc: InteractionRequiredAuthErrorMessages[
|
|
43
|
+
InteractionRequiredAuthErrorCodes.noTokensFound
|
|
44
|
+
],
|
|
33
45
|
},
|
|
34
46
|
native_account_unavailable: {
|
|
35
|
-
code:
|
|
36
|
-
desc:
|
|
47
|
+
code: InteractionRequiredAuthErrorCodes.nativeAccountUnavailable,
|
|
48
|
+
desc: InteractionRequiredAuthErrorMessages[
|
|
49
|
+
InteractionRequiredAuthErrorCodes.nativeAccountUnavailable
|
|
50
|
+
],
|
|
37
51
|
},
|
|
38
52
|
};
|
|
39
53
|
|
|
@@ -80,55 +94,46 @@ export class InteractionRequiredAuthError extends AuthError {
|
|
|
80
94
|
this.claims = claims || Constants.EMPTY_STRING;
|
|
81
95
|
this.name = "InteractionRequiredAuthError";
|
|
82
96
|
}
|
|
97
|
+
}
|
|
83
98
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
isInteractionRequiredErrorCode ||
|
|
109
|
-
isInteractionRequiredErrorDesc ||
|
|
110
|
-
isInteractionRequiredSubError
|
|
111
|
-
);
|
|
112
|
-
}
|
|
99
|
+
/**
|
|
100
|
+
* Helper function used to determine if an error thrown by the server requires interaction to resolve
|
|
101
|
+
* @param errorCode
|
|
102
|
+
* @param errorString
|
|
103
|
+
* @param subError
|
|
104
|
+
*/
|
|
105
|
+
export function isInteractionRequiredError(
|
|
106
|
+
errorCode?: string,
|
|
107
|
+
errorString?: string,
|
|
108
|
+
subError?: string
|
|
109
|
+
): boolean {
|
|
110
|
+
const isInteractionRequiredErrorCode =
|
|
111
|
+
!!errorCode &&
|
|
112
|
+
InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;
|
|
113
|
+
const isInteractionRequiredSubError =
|
|
114
|
+
!!subError &&
|
|
115
|
+
InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;
|
|
116
|
+
const isInteractionRequiredErrorDesc =
|
|
117
|
+
!!errorString &&
|
|
118
|
+
InteractionRequiredServerErrorMessage.some((irErrorCode) => {
|
|
119
|
+
return errorString.indexOf(irErrorCode) > -1;
|
|
120
|
+
});
|
|
113
121
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
InteractionRequiredAuthErrorMessage.noTokensFoundError.desc
|
|
121
|
-
);
|
|
122
|
-
}
|
|
122
|
+
return (
|
|
123
|
+
isInteractionRequiredErrorCode ||
|
|
124
|
+
isInteractionRequiredErrorDesc ||
|
|
125
|
+
isInteractionRequiredSubError
|
|
126
|
+
);
|
|
127
|
+
}
|
|
123
128
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Creates an InteractionRequiredAuthError
|
|
131
|
+
*/
|
|
132
|
+
export function createInteractionRequiredAuthError(
|
|
133
|
+
errorCode: string
|
|
134
|
+
): InteractionRequiredAuthError {
|
|
135
|
+
return new InteractionRequiredAuthError(
|
|
136
|
+
errorCode,
|
|
137
|
+
InteractionRequiredAuthErrorMessages[errorCode]
|
|
138
|
+
);
|
|
134
139
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Codes defined by MSAL
|
|
7
|
+
export const noTokensFound = "no_tokens_found";
|
|
8
|
+
export const nativeAccountUnavailable = "native_account_unavailable";
|
|
9
|
+
|
|
10
|
+
// Codes potentially returned by server
|
|
11
|
+
export const interactionRequired = "interaction_required";
|
|
12
|
+
export const consentRequired = "consent_required";
|
|
13
|
+
export const loginRequired = "login_required";
|
|
@@ -4,19 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { AuthError } from "./AuthError";
|
|
7
|
+
import * as JoseHeaderErrorCodes from "./JoseHeaderErrorCodes";
|
|
8
|
+
export { JoseHeaderErrorCodes };
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
},
|
|
10
|
+
export const JoseHeaderErrorMessages = {
|
|
11
|
+
[JoseHeaderErrorCodes.missingKidError]:
|
|
12
|
+
"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.",
|
|
13
|
+
[JoseHeaderErrorCodes.missingAlgError]:
|
|
14
|
+
"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.",
|
|
20
15
|
};
|
|
21
16
|
|
|
22
17
|
/**
|
|
@@ -29,24 +24,9 @@ export class JoseHeaderError extends AuthError {
|
|
|
29
24
|
|
|
30
25
|
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
31
26
|
}
|
|
27
|
+
}
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
}
|
|
29
|
+
/** Returns JoseHeaderError object */
|
|
30
|
+
export function createJoseHeaderError(code: string): JoseHeaderError {
|
|
31
|
+
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
52
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -137,17 +137,28 @@ export { ILoggerCallback, LogLevel, Logger } from "./logger/Logger";
|
|
|
137
137
|
// Errors
|
|
138
138
|
export {
|
|
139
139
|
InteractionRequiredAuthError,
|
|
140
|
+
InteractionRequiredAuthErrorCodes,
|
|
140
141
|
InteractionRequiredAuthErrorMessage,
|
|
142
|
+
createInteractionRequiredAuthError,
|
|
141
143
|
} from "./error/InteractionRequiredAuthError";
|
|
142
|
-
export {
|
|
144
|
+
export {
|
|
145
|
+
AuthError,
|
|
146
|
+
AuthErrorMessage,
|
|
147
|
+
AuthErrorCodes,
|
|
148
|
+
createAuthError,
|
|
149
|
+
} from "./error/AuthError";
|
|
143
150
|
export { ServerError } from "./error/ServerError";
|
|
144
151
|
export {
|
|
145
152
|
ClientAuthError,
|
|
146
153
|
ClientAuthErrorMessage,
|
|
154
|
+
ClientAuthErrorCodes,
|
|
155
|
+
createClientAuthError,
|
|
147
156
|
} from "./error/ClientAuthError";
|
|
148
157
|
export {
|
|
149
158
|
ClientConfigurationError,
|
|
150
159
|
ClientConfigurationErrorMessage,
|
|
160
|
+
ClientConfigurationErrorCodes,
|
|
161
|
+
createClientConfigurationError,
|
|
151
162
|
} from "./error/ClientConfigurationError";
|
|
152
163
|
// Constants and Utils
|
|
153
164
|
export {
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ClientAuthErrorCodes,
|
|
8
|
+
createClientAuthError,
|
|
9
|
+
} from "../error/ClientAuthError";
|
|
7
10
|
import { NetworkResponse } from "./NetworkManager";
|
|
8
11
|
|
|
9
12
|
/**
|
|
@@ -45,13 +48,13 @@ export interface INetworkModule {
|
|
|
45
48
|
|
|
46
49
|
export const StubbedNetworkModule: INetworkModule = {
|
|
47
50
|
sendGetRequestAsync: () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
return Promise.reject(
|
|
52
|
+
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented)
|
|
53
|
+
);
|
|
51
54
|
},
|
|
52
55
|
sendPostRequestAsync: () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
return Promise.reject(
|
|
57
|
+
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented)
|
|
58
|
+
);
|
|
56
59
|
},
|
|
57
60
|
};
|
|
@@ -8,7 +8,10 @@ import { RequestThumbprint } from "./RequestThumbprint";
|
|
|
8
8
|
import { ThrottlingUtils } from "./ThrottlingUtils";
|
|
9
9
|
import { CacheManager } from "../cache/CacheManager";
|
|
10
10
|
import { AuthError } from "../error/AuthError";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ClientAuthErrorCodes,
|
|
13
|
+
createClientAuthError,
|
|
14
|
+
} from "../error/ClientAuthError";
|
|
12
15
|
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse";
|
|
13
16
|
|
|
14
17
|
export type NetworkResponse<T> = {
|
|
@@ -62,10 +65,7 @@ export class NetworkManager {
|
|
|
62
65
|
if (e instanceof AuthError) {
|
|
63
66
|
throw e;
|
|
64
67
|
} else {
|
|
65
|
-
throw
|
|
66
|
-
tokenEndpoint,
|
|
67
|
-
e as string
|
|
68
|
-
);
|
|
68
|
+
throw createClientAuthError(ClientAuthErrorCodes.networkError);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createClientConfigurationError,
|
|
8
|
+
ClientConfigurationErrorCodes,
|
|
9
|
+
} from "../error/ClientConfigurationError";
|
|
7
10
|
import { Constants, HeaderNames } from "../utils/Constants";
|
|
8
11
|
|
|
9
12
|
type WWWAuthenticateChallenges = {
|
|
@@ -40,9 +43,8 @@ export class AuthenticationHeaderParser {
|
|
|
40
43
|
if (authenticationInfoChallenges.nextnonce) {
|
|
41
44
|
return authenticationInfoChallenges.nextnonce;
|
|
42
45
|
}
|
|
43
|
-
throw
|
|
44
|
-
|
|
45
|
-
"nextnonce challenge is missing."
|
|
46
|
+
throw createClientConfigurationError(
|
|
47
|
+
ClientConfigurationErrorCodes.invalidAuthenticationHeader
|
|
46
48
|
);
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -56,14 +58,15 @@ export class AuthenticationHeaderParser {
|
|
|
56
58
|
if (wwwAuthenticateChallenges.nonce) {
|
|
57
59
|
return wwwAuthenticateChallenges.nonce;
|
|
58
60
|
}
|
|
59
|
-
throw
|
|
60
|
-
|
|
61
|
-
"nonce challenge is missing."
|
|
61
|
+
throw createClientConfigurationError(
|
|
62
|
+
ClientConfigurationErrorCodes.invalidAuthenticationHeader
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// If neither header is present, throw missing headers error
|
|
66
|
-
throw
|
|
67
|
+
throw createClientConfigurationError(
|
|
68
|
+
ClientConfigurationErrorCodes.missingNonceAuthenticationHeader
|
|
69
|
+
);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
/**
|
|
@@ -17,7 +17,10 @@ import {
|
|
|
17
17
|
HeaderNames,
|
|
18
18
|
} from "../utils/Constants";
|
|
19
19
|
import { ScopeSet } from "./ScopeSet";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
createClientConfigurationError,
|
|
22
|
+
ClientConfigurationErrorCodes,
|
|
23
|
+
} from "../error/ClientConfigurationError";
|
|
21
24
|
import { StringDict } from "../utils/MsalTypes";
|
|
22
25
|
import { RequestValidator } from "./RequestValidator";
|
|
23
26
|
import {
|
|
@@ -330,7 +333,9 @@ export class RequestParameterBuilder {
|
|
|
330
333
|
encodeURIComponent(codeChallengeMethod)
|
|
331
334
|
);
|
|
332
335
|
} else {
|
|
333
|
-
throw
|
|
336
|
+
throw createClientConfigurationError(
|
|
337
|
+
ClientConfigurationErrorCodes.pkceParamsMissing
|
|
338
|
+
);
|
|
334
339
|
}
|
|
335
340
|
}
|
|
336
341
|
|
|
@@ -480,7 +485,9 @@ export class RequestParameterBuilder {
|
|
|
480
485
|
try {
|
|
481
486
|
mergedClaims = JSON.parse(claims);
|
|
482
487
|
} catch (e) {
|
|
483
|
-
throw
|
|
488
|
+
throw createClientConfigurationError(
|
|
489
|
+
ClientConfigurationErrorCodes.invalidClaims
|
|
490
|
+
);
|
|
484
491
|
}
|
|
485
492
|
}
|
|
486
493
|
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createClientConfigurationError,
|
|
8
|
+
ClientConfigurationErrorCodes,
|
|
9
|
+
} from "../error/ClientConfigurationError";
|
|
7
10
|
import { PromptValue, CodeChallengeMethodValues } from "../utils/Constants";
|
|
8
11
|
import { StringDict } from "../utils/MsalTypes";
|
|
9
12
|
|
|
@@ -17,7 +20,9 @@ export class RequestValidator {
|
|
|
17
20
|
*/
|
|
18
21
|
static validateRedirectUri(redirectUri: string): void {
|
|
19
22
|
if (!redirectUri) {
|
|
20
|
-
throw
|
|
23
|
+
throw createClientConfigurationError(
|
|
24
|
+
ClientConfigurationErrorCodes.redirectUriEmpty
|
|
25
|
+
);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
|
|
@@ -33,7 +38,9 @@ export class RequestValidator {
|
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
if (promptValues.indexOf(prompt) < 0) {
|
|
36
|
-
throw
|
|
41
|
+
throw createClientConfigurationError(
|
|
42
|
+
ClientConfigurationErrorCodes.invalidPromptValue
|
|
43
|
+
);
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
|
|
@@ -41,7 +48,9 @@ export class RequestValidator {
|
|
|
41
48
|
try {
|
|
42
49
|
JSON.parse(claims);
|
|
43
50
|
} catch (e) {
|
|
44
|
-
throw
|
|
51
|
+
throw createClientConfigurationError(
|
|
52
|
+
ClientConfigurationErrorCodes.invalidClaims
|
|
53
|
+
);
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -55,7 +64,9 @@ export class RequestValidator {
|
|
|
55
64
|
codeChallengeMethod: string
|
|
56
65
|
): void {
|
|
57
66
|
if (!codeChallenge || !codeChallengeMethod) {
|
|
58
|
-
throw
|
|
67
|
+
throw createClientConfigurationError(
|
|
68
|
+
ClientConfigurationErrorCodes.pkceParamsMissing
|
|
69
|
+
);
|
|
59
70
|
} else {
|
|
60
71
|
this.validateCodeChallengeMethod(codeChallengeMethod);
|
|
61
72
|
}
|
|
@@ -72,7 +83,9 @@ export class RequestValidator {
|
|
|
72
83
|
CodeChallengeMethodValues.S256,
|
|
73
84
|
].indexOf(codeChallengeMethod) < 0
|
|
74
85
|
) {
|
|
75
|
-
throw
|
|
86
|
+
throw createClientConfigurationError(
|
|
87
|
+
ClientConfigurationErrorCodes.invalidCodeChallengeMethod
|
|
88
|
+
);
|
|
76
89
|
}
|
|
77
90
|
}
|
|
78
91
|
|
package/src/request/ScopeSet.ts
CHANGED
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
createClientConfigurationError,
|
|
8
|
+
ClientConfigurationErrorCodes,
|
|
9
|
+
} from "../error/ClientConfigurationError";
|
|
7
10
|
import { StringUtils } from "../utils/StringUtils";
|
|
8
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ClientAuthErrorCodes,
|
|
13
|
+
createClientAuthError,
|
|
14
|
+
} from "../error/ClientAuthError";
|
|
9
15
|
import { Constants, OIDC_SCOPES } from "../utils/Constants";
|
|
10
16
|
|
|
11
17
|
/**
|
|
@@ -69,7 +75,9 @@ export class ScopeSet {
|
|
|
69
75
|
private validateInputScopes(inputScopes: Array<string>): void {
|
|
70
76
|
// Check if scopes are required but not given or is an empty array
|
|
71
77
|
if (!inputScopes || inputScopes.length < 1) {
|
|
72
|
-
throw
|
|
78
|
+
throw createClientConfigurationError(
|
|
79
|
+
ClientConfigurationErrorCodes.emptyInputScopesError
|
|
80
|
+
);
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
83
|
|
|
@@ -133,7 +141,9 @@ export class ScopeSet {
|
|
|
133
141
|
try {
|
|
134
142
|
newScopes.forEach((newScope) => this.appendScope(newScope));
|
|
135
143
|
} catch (e) {
|
|
136
|
-
throw
|
|
144
|
+
throw createClientAuthError(
|
|
145
|
+
ClientAuthErrorCodes.cannotAppendScopeSet
|
|
146
|
+
);
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
149
|
|
|
@@ -143,7 +153,9 @@ export class ScopeSet {
|
|
|
143
153
|
*/
|
|
144
154
|
removeScope(scope: string): void {
|
|
145
155
|
if (!scope) {
|
|
146
|
-
throw
|
|
156
|
+
throw createClientAuthError(
|
|
157
|
+
ClientAuthErrorCodes.cannotRemoveEmptyScope
|
|
158
|
+
);
|
|
147
159
|
}
|
|
148
160
|
this.scopes.delete(scope.trim());
|
|
149
161
|
}
|
|
@@ -164,7 +176,9 @@ export class ScopeSet {
|
|
|
164
176
|
*/
|
|
165
177
|
unionScopeSets(otherScopes: ScopeSet): Set<string> {
|
|
166
178
|
if (!otherScopes) {
|
|
167
|
-
throw
|
|
179
|
+
throw createClientAuthError(
|
|
180
|
+
ClientAuthErrorCodes.emptyInputScopeSet
|
|
181
|
+
);
|
|
168
182
|
}
|
|
169
183
|
const unionScopes = new Set<string>(); // Iterator in constructor not supported in IE11
|
|
170
184
|
otherScopes.scopes.forEach((scope) =>
|
|
@@ -180,7 +194,9 @@ export class ScopeSet {
|
|
|
180
194
|
*/
|
|
181
195
|
intersectingScopeSets(otherScopes: ScopeSet): boolean {
|
|
182
196
|
if (!otherScopes) {
|
|
183
|
-
throw
|
|
197
|
+
throw createClientAuthError(
|
|
198
|
+
ClientAuthErrorCodes.emptyInputScopeSet
|
|
199
|
+
);
|
|
184
200
|
}
|
|
185
201
|
|
|
186
202
|
// Do not allow OIDC scopes to be the only intersecting scopes
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
import { ServerAuthorizationTokenResponse } from "./ServerAuthorizationTokenResponse";
|
|
7
7
|
import { buildClientInfo } from "../account/ClientInfo";
|
|
8
8
|
import { ICrypto } from "../crypto/ICrypto";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
ClientAuthErrorCodes,
|
|
11
|
+
createClientAuthError,
|
|
12
|
+
} from "../error/ClientAuthError";
|
|
10
13
|
import { ServerAuthorizationCodeResponse } from "./ServerAuthorizationCodeResponse";
|
|
11
14
|
import { Logger } from "../logger/Logger";
|
|
12
15
|
import { ServerError } from "../error/ServerError";
|
|
@@ -17,7 +20,10 @@ import { Authority } from "../authority/Authority";
|
|
|
17
20
|
import { IdTokenEntity } from "../cache/entities/IdTokenEntity";
|
|
18
21
|
import { AccessTokenEntity } from "../cache/entities/AccessTokenEntity";
|
|
19
22
|
import { RefreshTokenEntity } from "../cache/entities/RefreshTokenEntity";
|
|
20
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
InteractionRequiredAuthError,
|
|
25
|
+
isInteractionRequiredError,
|
|
26
|
+
} from "../error/InteractionRequiredAuthError";
|
|
21
27
|
import { CacheRecord } from "../cache/entities/CacheRecord";
|
|
22
28
|
import { CacheManager } from "../cache/CacheManager";
|
|
23
29
|
import { ProtocolUtils, RequestStateObject } from "../utils/ProtocolUtils";
|
|
@@ -84,8 +90,14 @@ export class ResponseHandler {
|
|
|
84
90
|
): void {
|
|
85
91
|
if (!serverResponseHash.state || !cachedState) {
|
|
86
92
|
throw serverResponseHash.state
|
|
87
|
-
?
|
|
88
|
-
|
|
93
|
+
? createClientAuthError(
|
|
94
|
+
ClientAuthErrorCodes.stateNotFound,
|
|
95
|
+
"Cached State"
|
|
96
|
+
)
|
|
97
|
+
: createClientAuthError(
|
|
98
|
+
ClientAuthErrorCodes.stateNotFound,
|
|
99
|
+
"Server State"
|
|
100
|
+
);
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
let decodedServerResponseHash: string;
|
|
@@ -96,23 +108,23 @@ export class ResponseHandler {
|
|
|
96
108
|
serverResponseHash.state
|
|
97
109
|
);
|
|
98
110
|
} catch (e) {
|
|
99
|
-
throw
|
|
100
|
-
|
|
101
|
-
|
|
111
|
+
throw createClientAuthError(
|
|
112
|
+
ClientAuthErrorCodes.invalidState,
|
|
113
|
+
serverResponseHash.state
|
|
102
114
|
);
|
|
103
115
|
}
|
|
104
116
|
|
|
105
117
|
try {
|
|
106
118
|
decodedCachedState = decodeURIComponent(cachedState);
|
|
107
119
|
} catch (e) {
|
|
108
|
-
throw
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
throw createClientAuthError(
|
|
121
|
+
ClientAuthErrorCodes.invalidState,
|
|
122
|
+
serverResponseHash.state
|
|
111
123
|
);
|
|
112
124
|
}
|
|
113
125
|
|
|
114
126
|
if (decodedServerResponseHash !== decodedCachedState) {
|
|
115
|
-
throw
|
|
127
|
+
throw createClientAuthError(ClientAuthErrorCodes.stateMismatch);
|
|
116
128
|
}
|
|
117
129
|
|
|
118
130
|
// Check for error
|
|
@@ -122,7 +134,7 @@ export class ResponseHandler {
|
|
|
122
134
|
serverResponseHash.suberror
|
|
123
135
|
) {
|
|
124
136
|
if (
|
|
125
|
-
|
|
137
|
+
isInteractionRequiredError(
|
|
126
138
|
serverResponseHash.error,
|
|
127
139
|
serverResponseHash.error_description,
|
|
128
140
|
serverResponseHash.suberror
|
|
@@ -202,7 +214,7 @@ export class ResponseHandler {
|
|
|
202
214
|
}
|
|
203
215
|
|
|
204
216
|
if (
|
|
205
|
-
|
|
217
|
+
isInteractionRequiredError(
|
|
206
218
|
serverResponse.error,
|
|
207
219
|
serverResponse.error_description,
|
|
208
220
|
serverResponse.suberror
|
|
@@ -255,7 +267,9 @@ export class ResponseHandler {
|
|
|
255
267
|
// token nonce check (TODO: Add a warning if no nonce is given?)
|
|
256
268
|
if (authCodePayload && authCodePayload.nonce) {
|
|
257
269
|
if (idTokenClaims.nonce !== authCodePayload.nonce) {
|
|
258
|
-
throw
|
|
270
|
+
throw createClientAuthError(
|
|
271
|
+
ClientAuthErrorCodes.nonceMismatch
|
|
272
|
+
);
|
|
259
273
|
}
|
|
260
274
|
}
|
|
261
275
|
|
|
@@ -263,7 +277,9 @@ export class ResponseHandler {
|
|
|
263
277
|
if (request.maxAge || request.maxAge === 0) {
|
|
264
278
|
const authTime = idTokenClaims.auth_time;
|
|
265
279
|
if (!authTime) {
|
|
266
|
-
throw
|
|
280
|
+
throw createClientAuthError(
|
|
281
|
+
ClientAuthErrorCodes.authTimeNotFound
|
|
282
|
+
);
|
|
267
283
|
}
|
|
268
284
|
|
|
269
285
|
checkMaxAge(authTime, request.maxAge);
|
|
@@ -389,7 +405,9 @@ export class ResponseHandler {
|
|
|
389
405
|
): CacheRecord {
|
|
390
406
|
const env = authority.getPreferredCache();
|
|
391
407
|
if (!env) {
|
|
392
|
-
throw
|
|
408
|
+
throw createClientAuthError(
|
|
409
|
+
ClientAuthErrorCodes.invalidCacheEnvironment
|
|
410
|
+
);
|
|
393
411
|
}
|
|
394
412
|
|
|
395
413
|
// IdToken: non AAD scenarios can have empty realm
|
|
@@ -537,7 +555,9 @@ export class ResponseHandler {
|
|
|
537
555
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
538
556
|
|
|
539
557
|
if (!keyId) {
|
|
540
|
-
throw
|
|
558
|
+
throw createClientAuthError(
|
|
559
|
+
ClientAuthErrorCodes.keyIdMissing
|
|
560
|
+
);
|
|
541
561
|
}
|
|
542
562
|
|
|
543
563
|
accessToken = await popTokenGenerator.signPopToken(
|