@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
|
@@ -227,7 +227,8 @@ export abstract class PerformanceClient implements IPerformanceClient {
|
|
|
227
227
|
|
|
228
228
|
const queueMeasurement: QueueMeasurement = {
|
|
229
229
|
eventName,
|
|
230
|
-
|
|
230
|
+
// Always default queue time to 0 for manually completed (improperly instrumented)
|
|
231
|
+
queueTime: manuallyCompleted ? 0 : queueTime,
|
|
231
232
|
manuallyCompleted,
|
|
232
233
|
};
|
|
233
234
|
|
|
@@ -28,7 +28,7 @@ export class ServerTelemetryManager {
|
|
|
28
28
|
private regionUsed: string | undefined;
|
|
29
29
|
private regionSource: RegionDiscoverySources | undefined;
|
|
30
30
|
private regionOutcome: RegionDiscoveryOutcomes | undefined;
|
|
31
|
-
private cacheOutcome: CacheOutcome = CacheOutcome.
|
|
31
|
+
private cacheOutcome: CacheOutcome = CacheOutcome.NOT_APPLICABLE;
|
|
32
32
|
|
|
33
33
|
constructor(
|
|
34
34
|
telemetryRequest: ServerTelemetryRequest,
|
package/src/url/UrlString.ts
CHANGED
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ServerAuthorizationCodeResponse } from "../response/ServerAuthorizationCodeResponse";
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
createClientConfigurationError,
|
|
9
|
+
ClientConfigurationErrorCodes,
|
|
10
|
+
} from "../error/ClientConfigurationError";
|
|
11
|
+
import {
|
|
12
|
+
ClientAuthErrorCodes,
|
|
13
|
+
createClientAuthError,
|
|
14
|
+
} from "../error/ClientAuthError";
|
|
9
15
|
import { StringUtils } from "../utils/StringUtils";
|
|
10
16
|
import { IUri } from "./IUri";
|
|
11
17
|
import {
|
|
@@ -28,7 +34,9 @@ export class UrlString {
|
|
|
28
34
|
this._urlString = url;
|
|
29
35
|
if (!this._urlString) {
|
|
30
36
|
// Throws error if url is empty
|
|
31
|
-
throw
|
|
37
|
+
throw createClientConfigurationError(
|
|
38
|
+
ClientConfigurationErrorCodes.urlEmptyError
|
|
39
|
+
);
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
if (!this.getHash()) {
|
|
@@ -69,13 +77,15 @@ export class UrlString {
|
|
|
69
77
|
try {
|
|
70
78
|
components = this.getUrlComponents();
|
|
71
79
|
} catch (e) {
|
|
72
|
-
throw
|
|
80
|
+
throw createClientConfigurationError(
|
|
81
|
+
ClientConfigurationErrorCodes.urlParseError
|
|
82
|
+
);
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
// Throw error if URI or path segments are not parseable.
|
|
76
86
|
if (!components.HostNameAndPort || !components.PathSegments) {
|
|
77
|
-
throw
|
|
78
|
-
|
|
87
|
+
throw createClientConfigurationError(
|
|
88
|
+
ClientConfigurationErrorCodes.urlParseError
|
|
79
89
|
);
|
|
80
90
|
}
|
|
81
91
|
|
|
@@ -84,8 +94,8 @@ export class UrlString {
|
|
|
84
94
|
!components.Protocol ||
|
|
85
95
|
components.Protocol.toLowerCase() !== "https:"
|
|
86
96
|
) {
|
|
87
|
-
throw
|
|
88
|
-
|
|
97
|
+
throw createClientConfigurationError(
|
|
98
|
+
ClientConfigurationErrorCodes.authorityUriInsecure
|
|
89
99
|
);
|
|
90
100
|
}
|
|
91
101
|
}
|
|
@@ -152,8 +162,8 @@ export class UrlString {
|
|
|
152
162
|
// If url string does not match regEx, we throw an error
|
|
153
163
|
const match = this.urlString.match(regEx);
|
|
154
164
|
if (!match) {
|
|
155
|
-
throw
|
|
156
|
-
|
|
165
|
+
throw createClientConfigurationError(
|
|
166
|
+
ClientConfigurationErrorCodes.urlParseError
|
|
157
167
|
);
|
|
158
168
|
}
|
|
159
169
|
|
|
@@ -187,8 +197,8 @@ export class UrlString {
|
|
|
187
197
|
const match = url.match(regEx);
|
|
188
198
|
|
|
189
199
|
if (!match) {
|
|
190
|
-
throw
|
|
191
|
-
|
|
200
|
+
throw createClientConfigurationError(
|
|
201
|
+
ClientConfigurationErrorCodes.urlParseError
|
|
192
202
|
);
|
|
193
203
|
}
|
|
194
204
|
|
|
@@ -290,8 +300,8 @@ export class UrlString {
|
|
|
290
300
|
);
|
|
291
301
|
// Check if deserialization didn't work
|
|
292
302
|
if (!deserializedHash) {
|
|
293
|
-
throw
|
|
294
|
-
|
|
303
|
+
throw createClientAuthError(
|
|
304
|
+
ClientAuthErrorCodes.hashNotDeserialized
|
|
295
305
|
);
|
|
296
306
|
}
|
|
297
307
|
return deserializedHash;
|
|
@@ -316,8 +326,8 @@ export class UrlString {
|
|
|
316
326
|
);
|
|
317
327
|
// Check if deserialization didn't work
|
|
318
328
|
if (!deserializedQueryString) {
|
|
319
|
-
throw
|
|
320
|
-
|
|
329
|
+
throw createClientAuthError(
|
|
330
|
+
ClientAuthErrorCodes.hashNotDeserialized
|
|
321
331
|
);
|
|
322
332
|
}
|
|
323
333
|
return deserializedQueryString;
|
package/src/utils/Constants.ts
CHANGED
|
@@ -417,12 +417,20 @@ export const RegionDiscoveryOutcomes = {
|
|
|
417
417
|
export type RegionDiscoveryOutcomes =
|
|
418
418
|
(typeof RegionDiscoveryOutcomes)[keyof typeof RegionDiscoveryOutcomes];
|
|
419
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Specifies the reason for fetching the access token from the identity provider
|
|
422
|
+
*/
|
|
420
423
|
export const CacheOutcome = {
|
|
421
|
-
|
|
422
|
-
|
|
424
|
+
// When a token is found in the cache or the cache is not supposed to be hit when making the request
|
|
425
|
+
NOT_APPLICABLE: "0",
|
|
426
|
+
// When the token request goes to the identity provider because force_refresh was set to true. Also occurs if claims were requested
|
|
427
|
+
FORCE_REFRESH_OR_CLAIMS: "1",
|
|
428
|
+
// When the token request goes to the identity provider because no cached access token exists
|
|
423
429
|
NO_CACHED_ACCESS_TOKEN: "2",
|
|
430
|
+
// When the token request goes to the identity provider because cached access token expired
|
|
424
431
|
CACHED_ACCESS_TOKEN_EXPIRED: "3",
|
|
425
|
-
|
|
432
|
+
// When the token request goes to the identity provider because refresh_in was used and the existing token needs to be refreshed
|
|
433
|
+
PROACTIVELY_REFRESHED: "4",
|
|
426
434
|
} as const;
|
|
427
435
|
export type CacheOutcome = (typeof CacheOutcome)[keyof typeof CacheOutcome];
|
|
428
436
|
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import { Constants } from "./Constants";
|
|
7
7
|
import { ICrypto } from "../crypto/ICrypto";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ClientAuthErrorCodes,
|
|
10
|
+
createClientAuthError,
|
|
11
|
+
} from "../error/ClientAuthError";
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Type which defines the object that is stringified, encoded and sent in the state value.
|
|
@@ -60,9 +63,7 @@ export class ProtocolUtils {
|
|
|
60
63
|
meta?: Record<string, string>
|
|
61
64
|
): string {
|
|
62
65
|
if (!cryptoObj) {
|
|
63
|
-
throw
|
|
64
|
-
"generateLibraryState"
|
|
65
|
-
);
|
|
66
|
+
throw createClientAuthError(ClientAuthErrorCodes.noCryptoObject);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
// Create a state object containing a unique id and the timestamp of the request creation
|
|
@@ -89,16 +90,11 @@ export class ProtocolUtils {
|
|
|
89
90
|
state: string
|
|
90
91
|
): RequestStateObject {
|
|
91
92
|
if (!cryptoObj) {
|
|
92
|
-
throw
|
|
93
|
-
"parseRequestState"
|
|
94
|
-
);
|
|
93
|
+
throw createClientAuthError(ClientAuthErrorCodes.noCryptoObject);
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
if (!state) {
|
|
98
|
-
throw
|
|
99
|
-
state,
|
|
100
|
-
"Null, undefined or empty state"
|
|
101
|
-
);
|
|
97
|
+
throw createClientAuthError(ClientAuthErrorCodes.invalidState);
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
try {
|
|
@@ -118,7 +114,7 @@ export class ProtocolUtils {
|
|
|
118
114
|
libraryState: libraryStateObj,
|
|
119
115
|
};
|
|
120
116
|
} catch (e) {
|
|
121
|
-
throw
|
|
117
|
+
throw createClientAuthError(ClientAuthErrorCodes.invalidState);
|
|
122
118
|
}
|
|
123
119
|
}
|
|
124
120
|
}
|