@azure/msal-common 14.0.3 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account/AccountInfo.d.ts +0 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AuthToken.d.ts.map +1 -1
- package/dist/account/AuthToken.mjs +7 -6
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +6 -5
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +28 -50
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +9 -7
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.d.ts +3 -1
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.mjs +7 -8
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.d.ts +25 -7
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +98 -71
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.mjs +4 -3
- package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +4 -3
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.mjs +4 -3
- package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
- package/dist/cache/entities/IdTokenEntity.mjs +1 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheTypes.d.ts +3 -6
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +13 -11
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +5 -4
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +33 -74
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +2 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +43 -19
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.mjs +5 -6
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/crypto/ICrypto.d.ts +0 -4
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +11 -22
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +5 -4
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +2 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +4 -4
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.d.ts +8 -11
- package/dist/error/AuthError.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +19 -21
- package/dist/error/AuthError.mjs.map +1 -1
- package/dist/error/AuthErrorCodes.d.ts +6 -0
- package/dist/error/AuthErrorCodes.d.ts.map +1 -0
- package/dist/error/AuthErrorCodes.mjs +14 -0
- package/dist/error/AuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientAuthError.d.ts +54 -234
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +149 -421
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +44 -0
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientAuthErrorCodes.mjs +52 -0
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
- package/dist/error/ClientConfigurationError.d.ts +31 -125
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +81 -222
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +23 -0
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs +31 -0
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -0
- package/dist/error/InteractionRequiredAuthError.d.ts +14 -16
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +42 -41
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts +6 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +16 -0
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs.map +1 -0
- package/dist/error/JoseHeaderError.d.ts +7 -20
- package/dist/error/JoseHeaderError.d.ts.map +1 -1
- package/dist/error/JoseHeaderError.mjs +10 -26
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.d.ts +3 -0
- package/dist/error/JoseHeaderErrorCodes.d.ts.map +1 -0
- package/dist/error/JoseHeaderErrorCodes.mjs +11 -0
- package/dist/error/JoseHeaderErrorCodes.mjs.map +1 -0
- package/dist/error/ServerError.mjs +1 -1
- package/dist/index.cjs +942 -1210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +5 -6
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/NetworkManager.d.ts.map +1 -1
- package/dist/network/NetworkManager.mjs +4 -3
- package/dist/network/NetworkManager.mjs.map +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +7 -6
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/CommonRefreshTokenRequest.d.ts +3 -0
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +2 -0
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +5 -4
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +8 -7
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.d.ts.map +1 -1
- package/dist/request/ScopeSet.mjs +10 -8
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +15 -14
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +3 -2
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +9 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +2 -2
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +13 -11
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +6 -3
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +12 -4
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -2
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/ProtocolUtils.d.ts.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +7 -6
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/package.json +1 -1
- package/src/account/AccountInfo.ts +0 -1
- package/src/account/AuthToken.ts +8 -7
- package/src/account/ClientInfo.ts +9 -6
- package/src/authority/Authority.ts +76 -94
- package/src/authority/AuthorityFactory.ts +21 -9
- package/src/authority/RegionDiscovery.ts +21 -18
- package/src/cache/CacheManager.ts +133 -95
- package/src/cache/entities/AccessTokenEntity.ts +7 -2
- package/src/cache/entities/AccountEntity.ts +7 -2
- package/src/cache/entities/CredentialEntity.ts +7 -2
- package/src/cache/utils/CacheTypes.ts +6 -6
- package/src/client/AuthorizationCodeClient.ts +35 -11
- package/src/client/BaseClient.ts +7 -4
- package/src/client/RefreshTokenClient.ts +100 -126
- package/src/client/SilentFlowClient.ts +72 -19
- package/src/config/ClientConfiguration.ts +6 -7
- package/src/crypto/ICrypto.ts +12 -34
- package/src/crypto/JoseHeader.ts +6 -3
- package/src/crypto/PopTokenGenerator.ts +10 -5
- package/src/error/AuthError.ts +24 -26
- package/src/error/AuthErrorCodes.ts +10 -0
- package/src/error/ClientAuthError.ts +227 -632
- package/src/error/ClientAuthErrorCodes.ts +51 -0
- package/src/error/ClientConfigurationError.ts +146 -332
- package/src/error/ClientConfigurationErrorCodes.ts +28 -0
- package/src/error/InteractionRequiredAuthError.ts +60 -55
- package/src/error/InteractionRequiredAuthErrorCodes.ts +13 -0
- package/src/error/JoseHeaderError.ts +11 -31
- package/src/error/JoseHeaderErrorCodes.ts +7 -0
- package/src/index.ts +13 -1
- package/src/network/INetworkModule.ts +10 -7
- package/src/network/NetworkManager.ts +5 -5
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthenticationHeaderParser.ts +11 -8
- package/src/request/CommonRefreshTokenRequest.ts +3 -0
- package/src/request/CommonSilentFlowRequest.ts +2 -0
- package/src/request/RequestParameterBuilder.ts +10 -3
- package/src/request/RequestValidator.ts +19 -6
- package/src/request/ScopeSet.ts +23 -7
- package/src/response/ResponseHandler.ts +37 -17
- package/src/telemetry/performance/PerformanceClient.ts +2 -1
- package/src/telemetry/performance/PerformanceEvent.ts +9 -0
- package/src/telemetry/server/ServerTelemetryManager.ts +1 -1
- package/src/url/UrlString.ts +26 -16
- package/src/utils/Constants.ts +11 -3
- package/src/utils/FunctionWrappers.ts +0 -1
- package/src/utils/ProtocolUtils.ts +8 -12
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { BaseClient } from './BaseClient.mjs';
|
|
4
4
|
import { TimeUtils } from '../utils/TimeUtils.mjs';
|
|
5
5
|
import { RefreshTokenClient } from './RefreshTokenClient.mjs';
|
|
6
|
-
import { ClientAuthError,
|
|
7
|
-
import {
|
|
6
|
+
import { ClientAuthError, createClientAuthError } from '../error/ClientAuthError.mjs';
|
|
7
|
+
import { createClientConfigurationError } from '../error/ClientConfigurationError.mjs';
|
|
8
8
|
import { ResponseHandler } from '../response/ResponseHandler.mjs';
|
|
9
9
|
import { CacheOutcome } from '../utils/Constants.mjs';
|
|
10
10
|
import { StringUtils } from '../utils/StringUtils.mjs';
|
|
11
11
|
import { extractTokenClaims, checkMaxAge } from '../account/AuthToken.mjs';
|
|
12
|
+
import { tokenRefreshRequired, noAccountInSilentRequest, authTimeNotFound } from '../error/ClientAuthErrorCodes.mjs';
|
|
13
|
+
import { tokenRequestEmpty } from '../error/ClientConfigurationErrorCodes.mjs';
|
|
12
14
|
|
|
13
15
|
/*
|
|
14
16
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -26,11 +28,24 @@ class SilentFlowClient extends BaseClient {
|
|
|
26
28
|
*/
|
|
27
29
|
async acquireToken(request) {
|
|
28
30
|
try {
|
|
29
|
-
|
|
31
|
+
const [authResponse, cacheOutcome] = await this.acquireCachedToken(request);
|
|
32
|
+
// if the token is not expired but must be refreshed; get a new one in the background
|
|
33
|
+
if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
34
|
+
this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
|
|
35
|
+
// refresh the access token in the background
|
|
36
|
+
const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
|
|
37
|
+
refreshTokenClient
|
|
38
|
+
.acquireTokenByRefreshToken(request)
|
|
39
|
+
.catch(() => {
|
|
40
|
+
// do nothing, this is running in the background and no action is to be taken upon success or failure
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// return the cached token
|
|
44
|
+
return authResponse;
|
|
30
45
|
}
|
|
31
46
|
catch (e) {
|
|
32
47
|
if (e instanceof ClientAuthError &&
|
|
33
|
-
e.errorCode ===
|
|
48
|
+
e.errorCode === tokenRefreshRequired) {
|
|
34
49
|
const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);
|
|
35
50
|
return refreshTokenClient.acquireTokenByRefreshToken(request);
|
|
36
51
|
}
|
|
@@ -44,52 +59,61 @@ class SilentFlowClient extends BaseClient {
|
|
|
44
59
|
* @param request
|
|
45
60
|
*/
|
|
46
61
|
async acquireCachedToken(request) {
|
|
62
|
+
let lastCacheOutcome = CacheOutcome.NOT_APPLICABLE;
|
|
47
63
|
// Cannot renew token if no request object is given.
|
|
48
64
|
if (!request) {
|
|
49
|
-
throw
|
|
65
|
+
throw createClientConfigurationError(tokenRequestEmpty);
|
|
50
66
|
}
|
|
51
67
|
if (request.forceRefresh) {
|
|
52
68
|
// Must refresh due to present force_refresh flag.
|
|
53
|
-
|
|
69
|
+
lastCacheOutcome = CacheOutcome.FORCE_REFRESH_OR_CLAIMS;
|
|
70
|
+
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH_OR_CLAIMS);
|
|
54
71
|
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
|
|
55
|
-
throw
|
|
72
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
56
73
|
}
|
|
57
74
|
else if (!this.config.cacheOptions.claimsBasedCachingEnabled &&
|
|
58
75
|
!StringUtils.isEmptyObj(request.claims)) {
|
|
76
|
+
lastCacheOutcome = CacheOutcome.FORCE_REFRESH_OR_CLAIMS;
|
|
59
77
|
// Must refresh due to request parameters.
|
|
60
78
|
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested.");
|
|
61
|
-
throw
|
|
79
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
62
80
|
}
|
|
63
81
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
64
82
|
if (!request.account) {
|
|
65
|
-
throw
|
|
83
|
+
throw createClientAuthError(noAccountInSilentRequest);
|
|
66
84
|
}
|
|
67
85
|
const environment = request.authority || this.authority.getPreferredCache();
|
|
68
86
|
const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
|
|
69
87
|
if (!cacheRecord.accessToken) {
|
|
70
|
-
//
|
|
88
|
+
// must refresh due to non-existent access_token
|
|
89
|
+
lastCacheOutcome = CacheOutcome.NO_CACHED_ACCESS_TOKEN;
|
|
71
90
|
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
72
91
|
this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.");
|
|
73
|
-
throw
|
|
92
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
74
93
|
}
|
|
75
94
|
else if (TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||
|
|
76
95
|
TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
77
|
-
//
|
|
96
|
+
// must refresh due to the expires_in value
|
|
97
|
+
lastCacheOutcome = CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED;
|
|
78
98
|
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
|
|
79
99
|
this.logger.info(`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);
|
|
80
|
-
throw
|
|
100
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
81
101
|
}
|
|
82
102
|
else if (cacheRecord.accessToken.refreshOn &&
|
|
83
103
|
TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {
|
|
84
|
-
//
|
|
85
|
-
|
|
104
|
+
// must refresh (in the background) due to the refresh_in value
|
|
105
|
+
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
|
|
106
|
+
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.PROACTIVELY_REFRESHED);
|
|
86
107
|
this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.");
|
|
87
|
-
throw ClientAuthError.createRefreshRequiredError()
|
|
108
|
+
// don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
|
|
88
109
|
}
|
|
89
110
|
if (this.config.serverTelemetryManager) {
|
|
90
111
|
this.config.serverTelemetryManager.incrementCacheHits();
|
|
91
112
|
}
|
|
92
|
-
return
|
|
113
|
+
return [
|
|
114
|
+
await this.generateResultFromCacheRecord(cacheRecord, request),
|
|
115
|
+
lastCacheOutcome,
|
|
116
|
+
];
|
|
93
117
|
}
|
|
94
118
|
/**
|
|
95
119
|
* Helper function to build response object from the CacheRecord
|
|
@@ -104,7 +128,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
104
128
|
if (request.maxAge || request.maxAge === 0) {
|
|
105
129
|
const authTime = idTokenClaims?.auth_time;
|
|
106
130
|
if (!authTime) {
|
|
107
|
-
throw
|
|
131
|
+
throw createClientAuthError(authTimeNotFound);
|
|
108
132
|
}
|
|
109
133
|
checkMaxAge(authTime, request.maxAge);
|
|
110
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SilentFlowClient.mjs","sources":["../../src/client/SilentFlowClient.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SilentFlowClient.mjs","sources":["../../src/client/SilentFlowClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;AAKA;AACA;AACA;AACA;AAiCO;AACe,MAAA,gBACL,SAAA,UAAA,CAAuB;AA4CpC,IAAA,WAAA,CAAA,aAAA,EAAA,iBAAA,EAAA;;;AAGG;AACG;AA8GN;;;AAGG,IAAA,MAAA,YAAA,CAAA,OAAA,EAAA;YACW;AAiCjB,YAAA,MAAA,CAAA,YAAA,EAAA,YAAA,CAAA,GAAA,MAAA,IAAA,CAAA,kBAAA,CAAA,OAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientConfiguration.d.ts","sourceRoot":"","sources":["../../src/config/ClientConfiguration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAiC,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientConfiguration.d.ts","sourceRoot":"","sources":["../../src/config/ClientConfiguration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAiC,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,sBAAs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BAAoB,CAAC;CACrC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,aAAa,CAG1D,CAAC;AAgDF;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,EACrC,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,gBAAgB,EAC/B,YAAY,EAAE,gBAAgB,EAC9B,gBAAgB,EAAE,qBAAqB,EACvC,gBAAgB,EAAE,qBAAqB,EACvC,eAAe,EAAE,oBAAoB,EACrC,iBAAiB,EAAE,iBAAiB,EACpC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,GACvC,EAAE,mBAAmB,GAAG,yBAAyB,CA4BjD;AAeD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAIvE"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.mjs';
|
|
4
|
-
import { AuthError } from '../error/AuthError.mjs';
|
|
5
4
|
import { Logger, LogLevel } from '../logger/Logger.mjs';
|
|
6
5
|
import { Constants } from '../utils/Constants.mjs';
|
|
7
6
|
import { version } from '../packageMetadata.mjs';
|
|
8
7
|
import { AzureCloudInstance } from '../authority/AuthorityOptions.mjs';
|
|
9
8
|
import { DefaultStorageClass } from '../cache/CacheManager.mjs';
|
|
10
9
|
import { ProtocolMode } from '../authority/ProtocolMode.mjs';
|
|
10
|
+
import { createClientAuthError } from '../error/ClientAuthError.mjs';
|
|
11
|
+
import { methodNotImplemented } from '../error/ClientAuthErrorCodes.mjs';
|
|
11
12
|
|
|
12
13
|
/*
|
|
13
14
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -32,12 +33,10 @@ const DEFAULT_CACHE_OPTIONS = {
|
|
|
32
33
|
};
|
|
33
34
|
const DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
34
35
|
async sendGetRequestAsync() {
|
|
35
|
-
|
|
36
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
36
|
+
throw createClientAuthError(methodNotImplemented);
|
|
37
37
|
},
|
|
38
38
|
async sendPostRequestAsync() {
|
|
39
|
-
|
|
40
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
39
|
+
throw createClientAuthError(methodNotImplemented);
|
|
41
40
|
},
|
|
42
41
|
};
|
|
43
42
|
const DEFAULT_LIBRARY_INFO = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientConfiguration.mjs","sources":["../../src/config/ClientConfiguration.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientConfiguration.mjs","sources":["../../src/config/ClientConfiguration.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.methodNotImplemented"],"mappings":";;;;;;;;;;;;AAKA;AACA;AACA;AAGA;;;;;;;;;;;;;AA8BG,IAAA,aAAA,EAAA,SAAA,CAAA,YAAA;AACH,CAAM,CAAA;MACS,wBAAc;IACzB,yBAAgB,EAAA,KAAc;;MAElB,8BAAgB,GAAA;IAC5B,MAAgB,mBAAG,GAAA;QACH,MAAA,qBAAG,CAAAA,oBAAe,CAAA,CAAA;KACnB;IACf,MAAiB,oBAAG,GAAA;QACT,MAAA,qBAAe,CAAAA,oBAAA,CAAA,CAAA;KACjB;AACT,CAAA,CAAA;AACA,MAAA,oBAAgC,GAAA;AAChC,IAAA,GAAA,EAAA,SAAA,CAAA,G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AqB,CAAA,MAAA,EAAA;IACvB,QAAyB,MAAA,CAAA,WAAC,CAAE,SAAQ,CAAA,OAAA,CAAA,YAAA,KAAA,YAAA,CAAA,IAAA,EAAA;;;;;"}
|
package/dist/crypto/ICrypto.d.ts
CHANGED
|
@@ -30,10 +30,6 @@ export interface ICrypto {
|
|
|
30
30
|
* @param input
|
|
31
31
|
*/
|
|
32
32
|
base64Decode(input: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Generate PKCE codes for OAuth. See RFC here: https://tools.ietf.org/html/rfc7636
|
|
35
|
-
*/
|
|
36
|
-
generatePkceCodes(): Promise<PkceCodes>;
|
|
37
33
|
/**
|
|
38
34
|
* Generates an JWK RSA S256 Thumbprint
|
|
39
35
|
* @param request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/ICrypto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ICrypto.d.ts","sourceRoot":"","sources":["../../src/crypto/ICrypto.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC1C,eAAe,EACf,uBAAuB,GAAG,oBAAoB,GAAG,WAAW,GAAG,UAAU,CAC5E,GAAG;IACA,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC;;;OAGG;IACH,sBAAsB,CAClB,OAAO,EAAE,2BAA2B,GACrC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB;;;OAGG;IACH,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC;;;OAGG;IACH,OAAO,CACH,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,6BAA6B,EAAE,OAyB3C,CAAC"}
|
package/dist/crypto/ICrypto.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import {
|
|
3
|
+
import { createClientAuthError } from '../error/ClientAuthError.mjs';
|
|
4
|
+
import { methodNotImplemented } from '../error/ClientAuthErrorCodes.mjs';
|
|
4
5
|
|
|
5
6
|
/*
|
|
6
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8,40 +9,28 @@ import { AuthError } from '../error/AuthError.mjs';
|
|
|
8
9
|
*/
|
|
9
10
|
const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
10
11
|
createNewGuid: () => {
|
|
11
|
-
|
|
12
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
12
|
+
throw createClientAuthError(methodNotImplemented);
|
|
13
13
|
},
|
|
14
14
|
base64Decode: () => {
|
|
15
|
-
|
|
16
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
15
|
+
throw createClientAuthError(methodNotImplemented);
|
|
17
16
|
},
|
|
18
17
|
base64Encode: () => {
|
|
19
|
-
|
|
20
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
21
|
-
},
|
|
22
|
-
async generatePkceCodes() {
|
|
23
|
-
const notImplErr = "Crypto interface - generatePkceCodes() has not been implemented";
|
|
24
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
18
|
+
throw createClientAuthError(methodNotImplemented);
|
|
25
19
|
},
|
|
26
20
|
async getPublicKeyThumbprint() {
|
|
27
|
-
|
|
28
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
21
|
+
throw createClientAuthError(methodNotImplemented);
|
|
29
22
|
},
|
|
30
23
|
async removeTokenBindingKey() {
|
|
31
|
-
|
|
32
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
24
|
+
throw createClientAuthError(methodNotImplemented);
|
|
33
25
|
},
|
|
34
26
|
async clearKeystore() {
|
|
35
|
-
|
|
36
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
27
|
+
throw createClientAuthError(methodNotImplemented);
|
|
37
28
|
},
|
|
38
29
|
async signJwt() {
|
|
39
|
-
|
|
40
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
30
|
+
throw createClientAuthError(methodNotImplemented);
|
|
41
31
|
},
|
|
42
32
|
async hashString() {
|
|
43
|
-
|
|
44
|
-
throw AuthError.createUnexpectedError(notImplErr);
|
|
33
|
+
throw createClientAuthError(methodNotImplemented);
|
|
45
34
|
},
|
|
46
35
|
};
|
|
47
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ICrypto.mjs","sources":["../../src/crypto/ICrypto.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ICrypto.mjs","sources":["../../src/crypto/ICrypto.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.methodNotImplemented"],"mappings":";;;;;AASA;AACA;AAEA;;;AAIG,IAAA,aAAA,EAAA,MAAA;AACH,QAAM,2BAAkB,CAAAA,oBAAA,CAAA,CAAA;KACZ;IACR,oBAAkB;QACpB,MAAA,qBAAA,CAAAA,oBAAA,CAAA,CAAA;AAEF,KAAA;IAII,YAAa,EAAC,MAAE;QAClB,MAAA,qBAAA,CAAAA,oBAAA,CAAA,CAAA;AAEF,KAAA;;AAEG,QAAA,MAAA,qBAAA,CAAAA,oBAAA,CAAA,CAAA;AACH,KAAA;AACI,IAAA,MAAA,qBAAA,GAAA;;AAEG,KAAA;IACH,MAAa;AACb,QAAA,MAAA,qBAAA,CAAAA,oBAAA,CAAA,CAAA;;;AAGG,QAAA,MAAA,qBAAA,CAAAA,oBAAA,CAAA,CAAA;AACH,KAAA;AACA,IAAA,MAAA,UAAA,GAAA;;;AAGG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JoseHeader.d.ts","sourceRoot":"","sources":["../../src/crypto/JoseHeader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JoseHeader.d.ts","sourceRoot":"","sources":["../../src/crypto/JoseHeader.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gBAAgB;AAChB,qBAAa,UAAU;IACZ,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;gBAER,OAAO,EAAE,iBAAiB;IAMtC;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,MAAM;CAoBzE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import {
|
|
3
|
+
import { createJoseHeaderError } from '../error/JoseHeaderError.mjs';
|
|
4
4
|
import { JsonTypes } from '../utils/Constants.mjs';
|
|
5
|
+
import { missingKidError, missingAlgError } from '../error/JoseHeaderErrorCodes.mjs';
|
|
5
6
|
|
|
6
7
|
/*
|
|
7
8
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -25,11 +26,11 @@ class JoseHeader {
|
|
|
25
26
|
static getShrHeaderString(shrHeaderOptions) {
|
|
26
27
|
// KeyID is required on the SHR header
|
|
27
28
|
if (!shrHeaderOptions.kid) {
|
|
28
|
-
throw
|
|
29
|
+
throw createJoseHeaderError(missingKidError);
|
|
29
30
|
}
|
|
30
31
|
// Alg is required on the SHR header
|
|
31
32
|
if (!shrHeaderOptions.alg) {
|
|
32
|
-
throw
|
|
33
|
+
throw createJoseHeaderError(missingAlgError);
|
|
33
34
|
}
|
|
34
35
|
const shrHeader = new JoseHeader({
|
|
35
36
|
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JoseHeader.mjs","sources":["../../src/crypto/JoseHeader.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JoseHeader.mjs","sources":["../../src/crypto/JoseHeader.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AASA;AAEA;;;AAMA;AACA,MAAA,UAAuB,CAAA;IACZ,WAAM,CAAA,OAAU,EAAA;QACZ,IAAE,CAAA,GAAM,GAAC,OAAA,CAAA,GAAA,CAAA;QACT,IAAE,CAAA,GAAM,GAAC,OAAA,CAAA,GAAA,CAAA;AAER,QAAA,IAAA,CAAA,GAAA,GAAA,OAA0B,CAAA,GAAA,CAAA;AAMtC,KAAA;;;;;;;AAOG;AACH;AAoBH,IAAA,OAAA,kBAAA,CAAA,gBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ICrypto, SignedHttpRequestParameters } from "./ICrypto";
|
|
2
2
|
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient";
|
|
3
|
+
import { Logger } from "../logger/Logger";
|
|
3
4
|
/**
|
|
4
5
|
* See eSTS docs for more info.
|
|
5
6
|
* - A kid element, with the value containing an RFC 7638-compliant JWK thumbprint that is base64 encoded.
|
|
@@ -32,7 +33,7 @@ export declare class PopTokenGenerator {
|
|
|
32
33
|
* @param request
|
|
33
34
|
* @returns
|
|
34
35
|
*/
|
|
35
|
-
generateCnf(request: SignedHttpRequestParameters): Promise<ReqCnfData>;
|
|
36
|
+
generateCnf(request: SignedHttpRequestParameters, logger: Logger): Promise<ReqCnfData>;
|
|
36
37
|
/**
|
|
37
38
|
* Generates key_id for a SHR token request
|
|
38
39
|
* @param request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopTokenGenerator.d.ts","sourceRoot":"","sources":["../../src/crypto/PopTokenGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAGjF;;;;;;GAMG;AACH,KAAK,MAAM,GAAG;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,WAAW;;;CAGP,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE,gBAAgB;AAChB,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,WAAW,CAAU;IAC7B,OA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OAAO,EAAE,2BAA2B,GACrC,OAAO,CAAC,MAAM,CAAC;IAIlB;;;;;;;OAOG;IACG,WAAW,CACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,2BAA2B,EACpC,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CA+BrB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { TimeUtils } from '../utils/TimeUtils.mjs';
|
|
4
4
|
import { UrlString } from '../url/UrlString.mjs';
|
|
5
5
|
import { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.mjs';
|
|
6
|
+
import { invokeAsync } from '../utils/FunctionWrappers.mjs';
|
|
6
7
|
|
|
7
8
|
/*
|
|
8
9
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -24,10 +25,9 @@ class PopTokenGenerator {
|
|
|
24
25
|
* @param request
|
|
25
26
|
* @returns
|
|
26
27
|
*/
|
|
27
|
-
async generateCnf(request) {
|
|
28
|
+
async generateCnf(request, logger) {
|
|
28
29
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
29
|
-
this.
|
|
30
|
-
const reqCnf = await this.generateKid(request);
|
|
30
|
+
const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
|
|
31
31
|
const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
32
32
|
return {
|
|
33
33
|
kid: reqCnf.kid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopTokenGenerator.mjs","sources":["../../src/crypto/PopTokenGenerator.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopTokenGenerator.mjs","s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
export { AuthErrorCodes };
|
|
3
|
+
export declare const AuthErrorMessages: {
|
|
4
|
+
unexpected_error: string;
|
|
5
|
+
post_request_failed: string;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
8
|
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
9
|
+
* @deprecated Use AuthErrorCodes instead
|
|
3
10
|
*/
|
|
4
11
|
export declare const AuthErrorMessage: {
|
|
5
12
|
unexpectedError: {
|
|
@@ -33,16 +40,6 @@ export declare class AuthError extends Error {
|
|
|
33
40
|
correlationId: string;
|
|
34
41
|
constructor(errorCode?: string, errorMessage?: string, suberror?: string);
|
|
35
42
|
setCorrelationId(correlationId: string): void;
|
|
36
|
-
/**
|
|
37
|
-
* Creates an error that is thrown when something unexpected happens in the library.
|
|
38
|
-
* @param errDesc
|
|
39
|
-
*/
|
|
40
|
-
static createUnexpectedError(errDesc: string): AuthError;
|
|
41
|
-
/**
|
|
42
|
-
* Creates an error for post request failures.
|
|
43
|
-
* @param errDesc
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
static createPostRequestFailed(errDesc: string): AuthError;
|
|
47
43
|
}
|
|
44
|
+
export declare function createAuthError(code: string, additionalMessage?: string): AuthError;
|
|
48
45
|
//# sourceMappingURL=AuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthError.d.ts","sourceRoot":"","sources":["../../src/error/AuthError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthError.d.ts","sourceRoot":"","sources":["../../src/error/AuthError.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,eAAO,MAAM,iBAAiB;;;CAI7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;CAS5B,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;gBAEV,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAaxE,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;CAGhD;AAED,wBAAgB,eAAe,CAC3B,IAAI,EAAE,MAAM,EACZ,iBAAiB,CAAC,EAAE,MAAM,GAC3B,SAAS,CAOX"}
|
package/dist/error/AuthError.mjs
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.0
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { Constants } from '../utils/Constants.mjs';
|
|
4
|
+
import { unexpectedError, postRequestFailed } from './AuthErrorCodes.mjs';
|
|
5
|
+
import * as AuthErrorCodes from './AuthErrorCodes.mjs';
|
|
6
|
+
export { AuthErrorCodes };
|
|
4
7
|
|
|
5
8
|
/*
|
|
6
9
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
10
|
* Licensed under the MIT License.
|
|
8
11
|
*/
|
|
12
|
+
const AuthErrorMessages = {
|
|
13
|
+
[unexpectedError]: "Unexpected error in authentication.",
|
|
14
|
+
[postRequestFailed]: "Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details.",
|
|
15
|
+
};
|
|
9
16
|
/**
|
|
10
17
|
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
18
|
+
* @deprecated Use AuthErrorCodes instead
|
|
11
19
|
*/
|
|
12
20
|
const AuthErrorMessage = {
|
|
13
21
|
unexpectedError: {
|
|
14
|
-
code:
|
|
15
|
-
desc:
|
|
22
|
+
code: unexpectedError,
|
|
23
|
+
desc: AuthErrorMessages[unexpectedError],
|
|
16
24
|
},
|
|
17
25
|
postRequestFailed: {
|
|
18
|
-
code:
|
|
19
|
-
desc:
|
|
26
|
+
code: postRequestFailed,
|
|
27
|
+
desc: AuthErrorMessages[postRequestFailed],
|
|
20
28
|
},
|
|
21
29
|
};
|
|
22
30
|
/**
|
|
@@ -37,22 +45,12 @@ class AuthError extends Error {
|
|
|
37
45
|
setCorrelationId(correlationId) {
|
|
38
46
|
this.correlationId = correlationId;
|
|
39
47
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return new AuthError(AuthErrorMessage.unexpectedError.code, `${AuthErrorMessage.unexpectedError.desc}: ${errDesc}`);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Creates an error for post request failures.
|
|
49
|
-
* @param errDesc
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
static createPostRequestFailed(errDesc) {
|
|
53
|
-
return new AuthError(AuthErrorMessage.postRequestFailed.code, `${AuthErrorMessage.postRequestFailed.desc}: ${errDesc}`);
|
|
54
|
-
}
|
|
48
|
+
}
|
|
49
|
+
function createAuthError(code, additionalMessage) {
|
|
50
|
+
return new AuthError(code, additionalMessage
|
|
51
|
+
? `${AuthErrorMessages[code]} ${additionalMessage}`
|
|
52
|
+
: AuthErrorMessages[code]);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
export { AuthError, AuthErrorMessage };
|
|
55
|
+
export { AuthError, AuthErrorMessage, AuthErrorMessages, createAuthError };
|
|
58
56
|
//# sourceMappingURL=AuthError.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthError.mjs","sources":["../../src/error/AuthError.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"AuthError.mjs","sources":["../../src/error/AuthError.ts"],"sourcesContent":[null],"names":["AuthErrorCodes.postRequestFailed"],"mappings":";;;;;;;AAMA;AACA;AAEA;;;;AASG,IAAA,CAAAA,iBAAA,GAAA,sIAAA;AACH,EAAA;;;;;;;;;KASE;AAEF,IAAA,iBAAA,EAAA;;AAEG,QAAA,IAAA,EAAA,iBAAA,CAAAA,iBAAA,CAAA;AACH,KAAa;AACT,EAAA;;AAEG;;AAGH,MAAA,SAAA,SAAA,KAAA,CAAA;;AAEG,QAAA,MAAA,WAAA,GAAA,YAAA;cACS,CAAA,EAAA,SAAS,CAAA,EAAA,EAAA,YAAA,CAAA,CAAA;AAErB,cAAA,SAAA,CAAA;;AAEG,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,SAAA,CAAA,SAAA,CAAA,CAAA;QACK,IAAA,CAAA,SAAS,GAAA,SAAA,IAAA,SAAA,CAAA,YAAA,CAAA;AAEjB,QAAA,IAAA,CAAA,YAAA,GAAA,YAAA,IAAA,SAAA,CAAA,YAAA,CAAA;;AAEG,QAAA,IAAA,CAAA,IAAA,GAAA,WAAA,CAAA;KACU;AAED,IAAA,gBAAA,CAAA,aAAkB,EAAE;AAahC,QAAA,IAAA,CAAA,aAAiB,GAAA,aAAqB;AAGzC,KAAA;AAED,CAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
3
|
+
*/
|
|
4
|
+
export declare const unexpectedError = "unexpected_error";
|
|
5
|
+
export declare const postRequestFailed = "post_request_failed";
|
|
6
|
+
//# sourceMappingURL=AuthErrorCodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthErrorCodes.d.ts","sourceRoot":"","sources":["../../src/error/AuthErrorCodes.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,iBAAiB,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! @azure/msal-common v14.1.0 2023-10-05 */
|
|
2
|
+
'use strict';
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* AuthErrorMessage class containing string constants used by error codes and messages.
|
|
9
|
+
*/
|
|
10
|
+
const unexpectedError = "unexpected_error";
|
|
11
|
+
const postRequestFailed = "post_request_failed";
|
|
12
|
+
|
|
13
|
+
export { postRequestFailed, unexpectedError };
|
|
14
|
+
//# sourceMappingURL=AuthErrorCodes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthErrorCodes.mjs","sources":["../../src/error/AuthErrorCodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;;AAEG;AACH;AACA;;;;;;;;"}
|