@azure/msal-common 14.1.0-alpha.0 → 14.2.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 +31 -32
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AuthToken.d.ts +17 -17
- package/dist/account/AuthToken.mjs +58 -58
- 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.mjs +37 -37
- package/dist/account/TokenClaims.d.ts +65 -65
- package/dist/authority/Authority.d.ts +249 -235
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +791 -740
- 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 +48 -48
- package/dist/authority/AuthorityMetadata.d.ts +646 -623
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +941 -885
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +27 -21
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +18 -18
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- 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 -32
- package/dist/authority/RegionDiscovery.mjs +106 -106
- package/dist/authority/RegionDiscoveryMetadata.d.ts +6 -6
- package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +15 -15
- package/dist/cache/CacheManager.d.ts +480 -446
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +1086 -998
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +56 -56
- package/dist/cache/entities/AccessTokenEntity.mjs +109 -109
- 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 +218 -220
- 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.mjs +136 -136
- 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 +67 -69
- package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts +73 -73
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +408 -407
- 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 +188 -180
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts +27 -26
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +118 -125
- 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.mjs +97 -97
- package/dist/crypto/ICrypto.d.ts +58 -62
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +30 -33
- 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.mjs +37 -37
- package/dist/crypto/PopTokenGenerator.d.ts +60 -60
- package/dist/crypto/PopTokenGenerator.mjs +82 -82
- package/dist/crypto/SignedHttpRequest.d.ts +11 -11
- package/dist/error/AuthError.d.ts +44 -44
- package/dist/error/AuthError.mjs +46 -46
- package/dist/error/AuthErrorCodes.d.ts +5 -5
- package/dist/error/AuthErrorCodes.mjs +9 -9
- package/dist/error/ClientAuthError.d.ts +237 -232
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.mjs +250 -245
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.d.ts +44 -43
- package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +49 -48
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.d.ts +128 -128
- package/dist/error/ClientConfigurationError.mjs +135 -135
- package/dist/error/ClientConfigurationErrorCodes.d.ts +22 -22
- package/dist/error/ClientConfigurationErrorCodes.mjs +26 -26
- package/dist/error/InteractionRequiredAuthError.d.ts +57 -57
- package/dist/error/InteractionRequiredAuthError.mjs +76 -76
- package/dist/error/InteractionRequiredAuthErrorCodes.d.ts +5 -5
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +11 -11
- package/dist/error/JoseHeaderError.d.ts +15 -15
- package/dist/error/JoseHeaderError.mjs +22 -22
- package/dist/error/JoseHeaderErrorCodes.d.ts +2 -2
- package/dist/error/JoseHeaderErrorCodes.mjs +6 -6
- package/dist/error/ServerError.d.ts +7 -7
- package/dist/error/ServerError.mjs +14 -14
- package/dist/index.cjs +8830 -8612
- 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 +2 -2
- 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.mjs +12 -12
- package/dist/network/NetworkManager.d.ts +33 -33
- package/dist/network/NetworkManager.mjs +34 -34
- 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 +4 -4
- package/dist/request/AuthenticationHeaderParser.d.ts +19 -19
- package/dist/request/AuthenticationHeaderParser.mjs +55 -55
- 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 +22 -19
- package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/CommonSilentFlowRequest.d.ts +20 -18
- package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
- 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.mjs +381 -381
- package/dist/request/RequestValidator.d.ts +33 -33
- package/dist/request/RequestValidator.mjs +81 -81
- package/dist/request/ScopeSet.d.ts +88 -88
- package/dist/request/ScopeSet.mjs +197 -197
- 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 +315 -311
- 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.mjs +409 -409
- package/dist/telemetry/performance/PerformanceEvent.d.ts +457 -433
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +249 -234
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- 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.mjs +197 -197
- 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.mjs +279 -279
- package/dist/utils/Constants.d.ts +366 -366
- package/dist/utils/Constants.mjs +376 -376
- package/dist/utils/FunctionWrappers.d.ts +27 -27
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +84 -85
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/MsalTypes.d.ts +6 -6
- package/dist/utils/ProtocolUtils.d.ts +42 -42
- package/dist/utils/ProtocolUtils.mjs +69 -69
- 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/AccountInfo.ts +0 -1
- package/src/authority/Authority.ts +207 -127
- package/src/authority/AuthorityFactory.ts +4 -4
- package/src/authority/AuthorityMetadata.ts +87 -0
- package/src/authority/AuthorityOptions.ts +9 -0
- package/src/cache/CacheManager.ts +187 -46
- package/src/cache/entities/AccountEntity.ts +0 -3
- package/src/cache/utils/CacheTypes.ts +7 -6
- package/src/client/AuthorizationCodeClient.ts +12 -3
- package/src/client/BaseClient.ts +9 -6
- package/src/client/RefreshTokenClient.ts +36 -9
- package/src/client/SilentFlowClient.ts +49 -49
- package/src/crypto/ICrypto.ts +0 -7
- package/src/error/ClientAuthError.ts +8 -0
- package/src/error/ClientAuthErrorCodes.ts +1 -0
- package/src/index.ts +7 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/CommonRefreshTokenRequest.ts +3 -0
- package/src/request/CommonSilentFlowRequest.ts +2 -0
- package/src/response/ResponseHandler.ts +9 -3
- package/src/telemetry/performance/PerformanceEvent.ts +33 -2
- package/src/utils/FunctionWrappers.ts +0 -1
|
@@ -14,10 +14,6 @@ import {
|
|
|
14
14
|
ClientAuthErrorCodes,
|
|
15
15
|
createClientAuthError,
|
|
16
16
|
} from "../error/ClientAuthError";
|
|
17
|
-
import {
|
|
18
|
-
createClientConfigurationError,
|
|
19
|
-
ClientConfigurationErrorCodes,
|
|
20
|
-
} from "../error/ClientConfigurationError";
|
|
21
17
|
import { ResponseHandler } from "../response/ResponseHandler";
|
|
22
18
|
import { CacheRecord } from "../cache/entities/CacheRecord";
|
|
23
19
|
import { CacheOutcome } from "../utils/Constants";
|
|
@@ -25,6 +21,8 @@ import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient"
|
|
|
25
21
|
import { StringUtils } from "../utils/StringUtils";
|
|
26
22
|
import { checkMaxAge, extractTokenClaims } from "../account/AuthToken";
|
|
27
23
|
import { TokenClaims } from "../account/TokenClaims";
|
|
24
|
+
import { PerformanceEvents } from "../telemetry/performance/PerformanceEvent";
|
|
25
|
+
import { invokeAsync } from "../utils/FunctionWrappers";
|
|
28
26
|
|
|
29
27
|
/** @internal */
|
|
30
28
|
export class SilentFlowClient extends BaseClient {
|
|
@@ -92,35 +90,21 @@ export class SilentFlowClient extends BaseClient {
|
|
|
92
90
|
async acquireCachedToken(
|
|
93
91
|
request: CommonSilentFlowRequest
|
|
94
92
|
): Promise<[AuthenticationResult, CacheOutcome]> {
|
|
93
|
+
this.performanceClient?.addQueueMeasurement(
|
|
94
|
+
PerformanceEvents.SilentFlowClientAcquireCachedToken,
|
|
95
|
+
request.correlationId
|
|
96
|
+
);
|
|
95
97
|
let lastCacheOutcome: CacheOutcome = CacheOutcome.NOT_APPLICABLE;
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (request.forceRefresh) {
|
|
105
|
-
// Must refresh due to present force_refresh flag.
|
|
106
|
-
lastCacheOutcome = CacheOutcome.FORCE_REFRESH_OR_CLAIMS;
|
|
107
|
-
this.serverTelemetryManager?.setCacheOutcome(
|
|
108
|
-
CacheOutcome.FORCE_REFRESH_OR_CLAIMS
|
|
109
|
-
);
|
|
110
|
-
this.logger.info(
|
|
111
|
-
"SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true."
|
|
112
|
-
);
|
|
113
|
-
throw createClientAuthError(
|
|
114
|
-
ClientAuthErrorCodes.tokenRefreshRequired
|
|
115
|
-
);
|
|
116
|
-
} else if (
|
|
117
|
-
!this.config.cacheOptions.claimsBasedCachingEnabled &&
|
|
118
|
-
!StringUtils.isEmptyObj(request.claims)
|
|
99
|
+
if (
|
|
100
|
+
request.forceRefresh ||
|
|
101
|
+
(!this.config.cacheOptions.claimsBasedCachingEnabled &&
|
|
102
|
+
!StringUtils.isEmptyObj(request.claims))
|
|
119
103
|
) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
// Must refresh due to present force_refresh flag.
|
|
105
|
+
this.setCacheOutcome(
|
|
106
|
+
CacheOutcome.FORCE_REFRESH_OR_CLAIMS,
|
|
107
|
+
request.correlationId
|
|
124
108
|
);
|
|
125
109
|
throw createClientAuthError(
|
|
126
110
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -145,12 +129,9 @@ export class SilentFlowClient extends BaseClient {
|
|
|
145
129
|
|
|
146
130
|
if (!cacheRecord.accessToken) {
|
|
147
131
|
// must refresh due to non-existent access_token
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
);
|
|
152
|
-
this.logger.info(
|
|
153
|
-
"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties."
|
|
132
|
+
this.setCacheOutcome(
|
|
133
|
+
CacheOutcome.NO_CACHED_ACCESS_TOKEN,
|
|
134
|
+
request.correlationId
|
|
154
135
|
);
|
|
155
136
|
throw createClientAuthError(
|
|
156
137
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -163,12 +144,9 @@ export class SilentFlowClient extends BaseClient {
|
|
|
163
144
|
)
|
|
164
145
|
) {
|
|
165
146
|
// must refresh due to the expires_in value
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
170
|
-
this.logger.info(
|
|
171
|
-
`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`
|
|
147
|
+
this.setCacheOutcome(
|
|
148
|
+
CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED,
|
|
149
|
+
request.correlationId
|
|
172
150
|
);
|
|
173
151
|
throw createClientAuthError(
|
|
174
152
|
ClientAuthErrorCodes.tokenRefreshRequired
|
|
@@ -179,26 +157,44 @@ export class SilentFlowClient extends BaseClient {
|
|
|
179
157
|
) {
|
|
180
158
|
// must refresh (in the background) due to the refresh_in value
|
|
181
159
|
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
|
|
182
|
-
this.serverTelemetryManager?.setCacheOutcome(
|
|
183
|
-
CacheOutcome.PROACTIVELY_REFRESHED
|
|
184
|
-
);
|
|
185
|
-
this.logger.info(
|
|
186
|
-
"SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'."
|
|
187
|
-
);
|
|
188
160
|
|
|
189
161
|
// don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
|
|
190
162
|
}
|
|
191
163
|
|
|
164
|
+
this.setCacheOutcome(lastCacheOutcome, request.correlationId);
|
|
165
|
+
|
|
192
166
|
if (this.config.serverTelemetryManager) {
|
|
193
167
|
this.config.serverTelemetryManager.incrementCacheHits();
|
|
194
168
|
}
|
|
195
169
|
|
|
196
170
|
return [
|
|
197
|
-
await
|
|
171
|
+
await invokeAsync(
|
|
172
|
+
this.generateResultFromCacheRecord.bind(this),
|
|
173
|
+
PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord,
|
|
174
|
+
this.logger,
|
|
175
|
+
this.performanceClient,
|
|
176
|
+
request.correlationId
|
|
177
|
+
)(cacheRecord, request),
|
|
198
178
|
lastCacheOutcome,
|
|
199
179
|
];
|
|
200
180
|
}
|
|
201
181
|
|
|
182
|
+
private setCacheOutcome(
|
|
183
|
+
cacheOutcome: CacheOutcome,
|
|
184
|
+
correlationId: string
|
|
185
|
+
): void {
|
|
186
|
+
this.serverTelemetryManager?.setCacheOutcome(cacheOutcome);
|
|
187
|
+
this.performanceClient?.addFields(
|
|
188
|
+
{
|
|
189
|
+
cacheOutcome: cacheOutcome,
|
|
190
|
+
},
|
|
191
|
+
correlationId
|
|
192
|
+
);
|
|
193
|
+
this.logger.info(
|
|
194
|
+
`Token refresh is required due to cache outcome: ${cacheOutcome}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
202
198
|
/**
|
|
203
199
|
* Helper function to build response object from the CacheRecord
|
|
204
200
|
* @param cacheRecord
|
|
@@ -207,6 +203,10 @@ export class SilentFlowClient extends BaseClient {
|
|
|
207
203
|
cacheRecord: CacheRecord,
|
|
208
204
|
request: CommonSilentFlowRequest
|
|
209
205
|
): Promise<AuthenticationResult> {
|
|
206
|
+
this.performanceClient?.addQueueMeasurement(
|
|
207
|
+
PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord,
|
|
208
|
+
request.correlationId
|
|
209
|
+
);
|
|
210
210
|
let idTokenClaims: TokenClaims | undefined;
|
|
211
211
|
if (cacheRecord.idToken) {
|
|
212
212
|
idTokenClaims = extractTokenClaims(
|
package/src/crypto/ICrypto.ts
CHANGED
|
@@ -45,10 +45,6 @@ export interface ICrypto {
|
|
|
45
45
|
* @param input
|
|
46
46
|
*/
|
|
47
47
|
base64Decode(input: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* Generate PKCE codes for OAuth. See RFC here: https://tools.ietf.org/html/rfc7636
|
|
50
|
-
*/
|
|
51
|
-
generatePkceCodes(): Promise<PkceCodes>;
|
|
52
48
|
/**
|
|
53
49
|
* Generates an JWK RSA S256 Thumbprint
|
|
54
50
|
* @param request
|
|
@@ -91,9 +87,6 @@ export const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {
|
|
|
91
87
|
base64Encode: (): string => {
|
|
92
88
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
93
89
|
},
|
|
94
|
-
async generatePkceCodes(): Promise<PkceCodes> {
|
|
95
|
-
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
96
|
-
},
|
|
97
90
|
async getPublicKeyThumbprint(): Promise<string> {
|
|
98
91
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
99
92
|
},
|
|
@@ -89,6 +89,8 @@ export const ClientAuthErrorMessages = {
|
|
|
89
89
|
"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",
|
|
90
90
|
[ClientAuthErrorCodes.methodNotImplemented]:
|
|
91
91
|
"This method has not been implemented",
|
|
92
|
+
[ClientAuthErrorCodes.nestedAppAuthBridgeDisabled]:
|
|
93
|
+
"The nested app auth bridge is disabled",
|
|
92
94
|
};
|
|
93
95
|
|
|
94
96
|
/**
|
|
@@ -306,6 +308,12 @@ export const ClientAuthErrorMessage = {
|
|
|
306
308
|
ClientAuthErrorCodes.missingTenantIdError
|
|
307
309
|
],
|
|
308
310
|
},
|
|
311
|
+
nestedAppAuthBridgeDisabled: {
|
|
312
|
+
code: ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
|
|
313
|
+
desc: ClientAuthErrorMessages[
|
|
314
|
+
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled
|
|
315
|
+
],
|
|
316
|
+
},
|
|
309
317
|
};
|
|
310
318
|
|
|
311
319
|
/**
|
|
@@ -49,3 +49,4 @@ export const noNetworkConnectivity = "no_network_connectivity";
|
|
|
49
49
|
export const userCanceled = "user_canceled";
|
|
50
50
|
export const missingTenantIdError = "missing_tenant_id_error";
|
|
51
51
|
export const methodNotImplemented = "method_not_implemented";
|
|
52
|
+
export const nestedAppAuthBridgeDisabled = "nested_app_auth_bridge_disabled";
|
package/src/index.ts
CHANGED
|
@@ -39,10 +39,15 @@ export {
|
|
|
39
39
|
buildClientInfoFromHomeAccountId,
|
|
40
40
|
} from "./account/ClientInfo";
|
|
41
41
|
// Authority
|
|
42
|
-
export {
|
|
42
|
+
export {
|
|
43
|
+
Authority,
|
|
44
|
+
formatAuthorityUri,
|
|
45
|
+
buildStaticAuthorityOptions,
|
|
46
|
+
} from "./authority/Authority";
|
|
43
47
|
export {
|
|
44
48
|
AuthorityOptions,
|
|
45
49
|
AzureCloudInstance,
|
|
50
|
+
StaticAuthorityOptions,
|
|
46
51
|
} from "./authority/AuthorityOptions";
|
|
47
52
|
export { AuthorityFactory } from "./authority/AuthorityFactory";
|
|
48
53
|
export { AuthorityType } from "./authority/AuthorityType";
|
|
@@ -54,6 +59,7 @@ export { INativeBrokerPlugin } from "./broker/nativeBroker/INativeBrokerPlugin";
|
|
|
54
59
|
export { CacheManager, DefaultStorageClass } from "./cache/CacheManager";
|
|
55
60
|
export {
|
|
56
61
|
AccountCache,
|
|
62
|
+
AccountFilter,
|
|
57
63
|
AccessTokenCache,
|
|
58
64
|
IdTokenCache,
|
|
59
65
|
RefreshTokenCache,
|
package/src/packageMetadata.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
7
7
|
import { CcsCredential } from "../account/CcsCredential";
|
|
8
|
+
import { StringDict } from "../utils/MsalTypes";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* CommonRefreshTokenRequest
|
|
@@ -22,4 +23,6 @@ export type CommonRefreshTokenRequest = BaseAuthRequest & {
|
|
|
22
23
|
refreshToken: string;
|
|
23
24
|
ccsCredential?: CcsCredential;
|
|
24
25
|
forceCache?: boolean;
|
|
26
|
+
tokenBodyParameters?: StringDict;
|
|
27
|
+
redirectUri?: string;
|
|
25
28
|
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { AccountInfo } from "../account/AccountInfo";
|
|
7
|
+
import { StringDict } from "../utils/MsalTypes";
|
|
7
8
|
import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -21,4 +22,5 @@ import { BaseAuthRequest } from "./BaseAuthRequest";
|
|
|
21
22
|
export type CommonSilentFlowRequest = BaseAuthRequest & {
|
|
22
23
|
account: AccountInfo;
|
|
23
24
|
forceRefresh: boolean;
|
|
25
|
+
tokenBodyParameters?: StringDict;
|
|
24
26
|
};
|
|
@@ -44,6 +44,7 @@ import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient"
|
|
|
44
44
|
import { PerformanceEvents } from "../telemetry/performance/PerformanceEvent";
|
|
45
45
|
import { checkMaxAge, extractTokenClaims } from "../account/AuthToken";
|
|
46
46
|
import { TokenClaims } from "../account/TokenClaims";
|
|
47
|
+
import { AccountInfo } from "../account/AccountInfo";
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* Class that handles response parsing.
|
|
@@ -599,14 +600,19 @@ export class ResponseHandler {
|
|
|
599
600
|
serverTokenResponse?.spa_accountid;
|
|
600
601
|
}
|
|
601
602
|
|
|
603
|
+
const accountInfo: AccountInfo | null = cacheRecord.account
|
|
604
|
+
? {
|
|
605
|
+
...cacheRecord.account.getAccountInfo(),
|
|
606
|
+
idTokenClaims,
|
|
607
|
+
}
|
|
608
|
+
: null;
|
|
609
|
+
|
|
602
610
|
return {
|
|
603
611
|
authority: authority.canonicalAuthority,
|
|
604
612
|
uniqueId: uid,
|
|
605
613
|
tenantId: tid,
|
|
606
614
|
scopes: responseScopes,
|
|
607
|
-
account:
|
|
608
|
-
? cacheRecord.account.getAccountInfo()
|
|
609
|
-
: null,
|
|
615
|
+
account: accountInfo,
|
|
610
616
|
idToken: cacheRecord?.idToken?.secret || "",
|
|
611
617
|
idTokenClaims: idTokenClaims || {},
|
|
612
618
|
accessToken: accessToken,
|
|
@@ -101,8 +101,10 @@ export const PerformanceEvents = {
|
|
|
101
101
|
/**
|
|
102
102
|
* Time spent sending/waiting for the response of a request to the token endpoint
|
|
103
103
|
*/
|
|
104
|
-
|
|
105
|
-
"
|
|
104
|
+
RefreshTokenClientExecutePostToTokenEndpoint:
|
|
105
|
+
"refreshTokenClientExecutePostToTokenEndpoint",
|
|
106
|
+
AuthorizationCodeClientExecutePostToTokenEndpoint:
|
|
107
|
+
"authorizationCodeClientExecutePostToTokenEndpoint",
|
|
106
108
|
/**
|
|
107
109
|
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
108
110
|
*/
|
|
@@ -150,6 +152,9 @@ export const PerformanceEvents = {
|
|
|
150
152
|
* Internal API for acquiring token from cache
|
|
151
153
|
*/
|
|
152
154
|
AcquireTokenFromCache: "acquireTokenFromCache",
|
|
155
|
+
SilentFlowClientAcquireCachedToken: "silentFlowClientAcquireCachedToken",
|
|
156
|
+
SilentFlowClientGenerateResultFromCacheRecord:
|
|
157
|
+
"silentFlowClientGenerateResultFromCacheRecord",
|
|
153
158
|
|
|
154
159
|
/**
|
|
155
160
|
* acquireTokenBySilentIframe (msal-browser).
|
|
@@ -180,6 +185,7 @@ export const PerformanceEvents = {
|
|
|
180
185
|
SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
|
|
181
186
|
SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
|
|
182
187
|
SilentHandlerLoadFrame: "silentHandlerLoadFrame",
|
|
188
|
+
SilentHandlerLoadFrameSync: "silentHandlerLoadFrameSync",
|
|
183
189
|
|
|
184
190
|
/**
|
|
185
191
|
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
@@ -230,6 +236,8 @@ export const PerformanceEvents = {
|
|
|
230
236
|
AuthorityFactoryCreateDiscoveredInstance:
|
|
231
237
|
"authorityFactoryCreateDiscoveredInstance",
|
|
232
238
|
AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
|
|
239
|
+
AuthorityResolveEndpointsFromLocalSources:
|
|
240
|
+
"authorityResolveEndpointsFromLocalSources",
|
|
233
241
|
AuthorityGetCloudDiscoveryMetadataFromNetwork:
|
|
234
242
|
"authorityGetCloudDiscoveryMetadataFromNetwork",
|
|
235
243
|
AuthorityUpdateCloudDiscoveryMetadata:
|
|
@@ -264,10 +272,22 @@ export const PerformanceEvents = {
|
|
|
264
272
|
|
|
265
273
|
NativeGenerateAuthResult: "nativeGenerateAuthResult",
|
|
266
274
|
|
|
275
|
+
RemoveHiddenIframe: "removeHiddenIframe",
|
|
276
|
+
|
|
267
277
|
/**
|
|
268
278
|
* Cache operations
|
|
269
279
|
*/
|
|
270
280
|
ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
|
|
281
|
+
CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Crypto Operations
|
|
285
|
+
*/
|
|
286
|
+
GeneratePkceCodes: "generatePkceCodes",
|
|
287
|
+
GenerateCodeVerifier: "generateCodeVerifier",
|
|
288
|
+
GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
|
|
289
|
+
Sha256Digest: "sha256Digest",
|
|
290
|
+
GetRandomValues: "getRandomValues",
|
|
271
291
|
} as const;
|
|
272
292
|
export type PerformanceEvents =
|
|
273
293
|
(typeof PerformanceEvents)[keyof typeof PerformanceEvents];
|
|
@@ -434,6 +454,12 @@ export type PerformanceEvent = {
|
|
|
434
454
|
*/
|
|
435
455
|
cacheLookupPolicy?: number | undefined;
|
|
436
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Cache Outcome
|
|
459
|
+
* @type {?number}
|
|
460
|
+
*/
|
|
461
|
+
cacheOutcome?: number;
|
|
462
|
+
|
|
437
463
|
/**
|
|
438
464
|
* Amount of time spent in the JS queue in milliseconds.
|
|
439
465
|
*
|
|
@@ -527,6 +553,11 @@ export type PerformanceEvent = {
|
|
|
527
553
|
extensionInstalled?: boolean;
|
|
528
554
|
extensionHandshakeTimeoutMs?: number;
|
|
529
555
|
extensionHandshakeTimedOut?: boolean;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Nested App Auth Fields
|
|
559
|
+
*/
|
|
560
|
+
nestedAppAuthRequest?: boolean;
|
|
530
561
|
};
|
|
531
562
|
|
|
532
563
|
export const IntFields: ReadonlySet<string> = new Set([
|