@azure/msal-common 15.8.1 → 15.10.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 +2 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AccountInfo.mjs +5 -2
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs +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.mjs +1 -1
- package/dist/cache/CacheManager.d.ts +15 -20
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +32 -97
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +2 -14
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +6 -34
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts +1 -1
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/interface/ICacheManager.d.ts +2 -10
- package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.d.ts +4 -13
- package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +6 -71
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +2 -3
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +2 -2
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.d.ts +10 -0
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +12 -2
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.d.ts +2 -0
- package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +5 -3
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/exports-common.d.ts +1 -1
- package/dist/exports-common.d.ts.map +1 -1
- package/dist/index-browser.mjs +2 -2
- package/dist/index-node.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/RequestThumbprint.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +2 -2
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +5 -1
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +6 -0
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +14 -2
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +3 -3
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +2 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +11 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.d.ts +5 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +6 -4
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.d.ts +7 -0
- package/dist/utils/TimeUtils.d.ts.map +1 -1
- package/dist/utils/TimeUtils.mjs +12 -2
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/lib/index-browser.cjs +3 -2
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-BCM1mkg5.js → index-node-Dy4fVJGl.js} +496 -599
- package/lib/index-node-Dy4fVJGl.js.map +1 -0
- package/lib/index-node.cjs +3 -2
- package/lib/index-node.cjs.map +1 -1
- package/lib/index.cjs +3 -2
- package/lib/index.cjs.map +1 -1
- package/lib/types/account/AccountInfo.d.ts +2 -1
- package/lib/types/account/AccountInfo.d.ts.map +1 -1
- package/lib/types/cache/CacheManager.d.ts +15 -20
- package/lib/types/cache/CacheManager.d.ts.map +1 -1
- package/lib/types/cache/entities/AccountEntity.d.ts +2 -14
- package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/lib/types/cache/entities/CredentialEntity.d.ts +1 -1
- package/lib/types/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/lib/types/cache/interface/ICacheManager.d.ts +2 -10
- package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/lib/types/cache/utils/CacheHelpers.d.ts +4 -13
- package/lib/types/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationError.d.ts +10 -0
- package/lib/types/error/ClientConfigurationError.d.ts.map +1 -1
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts +2 -0
- package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/lib/types/exports-common.d.ts +1 -1
- package/lib/types/exports-common.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/request/BaseAuthRequest.d.ts +5 -1
- package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/lib/types/request/RequestParameterBuilder.d.ts +6 -0
- package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -1
- package/lib/types/response/ResponseHandler.d.ts.map +1 -1
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts +2 -0
- package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +5 -1
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/lib/types/utils/TimeUtils.d.ts +7 -0
- package/lib/types/utils/TimeUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/account/AccountInfo.ts +16 -2
- package/src/cache/CacheManager.ts +50 -125
- package/src/cache/entities/AccountEntity.ts +7 -38
- package/src/cache/entities/CredentialEntity.ts +1 -1
- package/src/cache/interface/ICacheManager.ts +2 -15
- package/src/cache/utils/CacheHelpers.ts +11 -83
- package/src/client/RefreshTokenClient.ts +1 -2
- package/src/client/SilentFlowClient.ts +2 -2
- package/src/error/ClientConfigurationError.ts +16 -0
- package/src/error/ClientConfigurationErrorCodes.ts +3 -0
- package/src/exports-common.ts +1 -0
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +1 -1
- package/src/request/BaseAuthRequest.ts +5 -1
- package/src/request/RequestParameterBuilder.ts +16 -0
- package/src/response/ResponseHandler.ts +3 -1
- package/src/telemetry/performance/PerformanceEvent.ts +14 -0
- package/src/utils/Constants.ts +6 -2
- package/src/utils/TimeUtils.ts +15 -0
- package/lib/index-node-BCM1mkg5.js.map +0 -1
|
@@ -411,5 +411,5 @@ function extractAccountSid(account: AccountInfo): string | null {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
function extractLoginHint(account: AccountInfo): string | null {
|
|
414
|
-
return account.idTokenClaims?.login_hint || null;
|
|
414
|
+
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
415
415
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { AuthenticationScheme } from "../utils/Constants.js";
|
|
6
|
+
import { AuthenticationScheme, HttpMethod } from "../utils/Constants.js";
|
|
7
7
|
import type { AzureCloudOptions } from "../config/ClientConfiguration.js";
|
|
8
8
|
import { StringDict } from "../utils/MsalTypes.js";
|
|
9
9
|
import { StoreInCache } from "./StoreInCache.js";
|
|
@@ -31,6 +31,8 @@ import { ShrOptions } from "../crypto/SignedHttpRequest.js";
|
|
|
31
31
|
* - scenarioId - Scenario id to track custom user prompts
|
|
32
32
|
* - popKid - Key ID to identify the public key for PoP token request
|
|
33
33
|
* - embeddedClientId - Embedded client id. When specified, broker client id (brk_client_id) and redirect uri (brk_redirect_uri) params are set with values from the config, overriding the corresponding extra parameters, if present.
|
|
34
|
+
* - httpMethod - HTTP method to use for the /authorize request. Defaults to GET, but can be set to POST if the request requires body parameters
|
|
35
|
+
* - authorizePostBodyParameters - String to string map of custom parameters added to the body of the /authorize call when httpMethod is set to POST
|
|
34
36
|
*/
|
|
35
37
|
export type BaseAuthRequest = {
|
|
36
38
|
authority: string;
|
|
@@ -54,4 +56,6 @@ export type BaseAuthRequest = {
|
|
|
54
56
|
scenarioId?: string;
|
|
55
57
|
popKid?: string;
|
|
56
58
|
embeddedClientId?: string;
|
|
59
|
+
httpMethod?: HttpMethod;
|
|
60
|
+
authorizePostBodyParameters?: StringDict;
|
|
57
61
|
};
|
|
@@ -632,3 +632,19 @@ export function addEARParameters(
|
|
|
632
632
|
const jweCryptoB64Encoded = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0";
|
|
633
633
|
parameters.set(AADServerParamKeys.EAR_JWE_CRYPTO, jweCryptoB64Encoded);
|
|
634
634
|
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Adds authorize body parameters to the request parameters
|
|
638
|
+
* @param parameters
|
|
639
|
+
* @param bodyParameters
|
|
640
|
+
*/
|
|
641
|
+
export function addPostBodyParameters(
|
|
642
|
+
parameters: Map<string, string>,
|
|
643
|
+
bodyParameters: StringDict
|
|
644
|
+
): void {
|
|
645
|
+
Object.entries(bodyParameters).forEach(([key, value]) => {
|
|
646
|
+
if (value) {
|
|
647
|
+
parameters.set(key, value);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
@@ -278,7 +278,9 @@ export class ResponseHandler {
|
|
|
278
278
|
!forceCacheRefreshTokenResponse &&
|
|
279
279
|
cacheRecord.account
|
|
280
280
|
) {
|
|
281
|
-
const key =
|
|
281
|
+
const key = this.cacheStorage.generateAccountKey(
|
|
282
|
+
cacheRecord.account.getAccountInfo()
|
|
283
|
+
);
|
|
282
284
|
const account = this.cacheStorage.getAccount(
|
|
283
285
|
key,
|
|
284
286
|
request.correlationId
|
|
@@ -859,6 +859,10 @@ export type PerformanceEvent = {
|
|
|
859
859
|
// Event context as JSON string
|
|
860
860
|
context?: string;
|
|
861
861
|
|
|
862
|
+
// Cache Data
|
|
863
|
+
cacheLocation?: string;
|
|
864
|
+
cacheRetentionDays?: number;
|
|
865
|
+
|
|
862
866
|
// Number of tokens in the cache to be reported when cache quota is exceeded
|
|
863
867
|
cacheRtCount?: number;
|
|
864
868
|
cacheIdCount?: number;
|
|
@@ -927,4 +931,14 @@ export const IntFields: ReadonlySet<string> = new Set([
|
|
|
927
931
|
"multiMatchedRT",
|
|
928
932
|
"unencryptedCacheCount",
|
|
929
933
|
"encryptedCacheExpiredCount",
|
|
934
|
+
"oldAccountCount",
|
|
935
|
+
"oldAccessCount",
|
|
936
|
+
"oldIdCount",
|
|
937
|
+
"oldRefreshCount",
|
|
938
|
+
"currAccountCount",
|
|
939
|
+
"currAccessCount",
|
|
940
|
+
"currIdCount",
|
|
941
|
+
"currRefreshCount",
|
|
942
|
+
"expiredCacheRemovedCount",
|
|
943
|
+
"upgradedCacheCount",
|
|
930
944
|
]);
|
package/src/utils/Constants.ts
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
export const Constants = {
|
|
7
7
|
LIBRARY_NAME: "MSAL.JS",
|
|
8
8
|
SKU: "msal.js.common",
|
|
9
|
-
// Prefix for all library cache entries
|
|
10
|
-
CACHE_PREFIX: "msal",
|
|
11
9
|
// default authority
|
|
12
10
|
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
13
11
|
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
@@ -82,6 +80,12 @@ export const HttpStatus = {
|
|
|
82
80
|
} as const;
|
|
83
81
|
export type HttpStatus = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
84
82
|
|
|
83
|
+
export const HttpMethod = {
|
|
84
|
+
GET: "GET",
|
|
85
|
+
POST: "POST",
|
|
86
|
+
} as const;
|
|
87
|
+
export type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];
|
|
88
|
+
|
|
85
89
|
export const OIDC_DEFAULT_SCOPES = [
|
|
86
90
|
Constants.OPENID_SCOPE,
|
|
87
91
|
Constants.PROFILE_SCOPE,
|
package/src/utils/TimeUtils.ts
CHANGED
|
@@ -48,6 +48,21 @@ export function isTokenExpired(expiresOn: string, offset: number): boolean {
|
|
|
48
48
|
return offsetCurrentTimeSec > expirationSec;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a cache entry is expired based on the last updated time and cache retention days.
|
|
53
|
+
* @param lastUpdatedAt
|
|
54
|
+
* @param cacheRetentionDays
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
export function isCacheExpired(
|
|
58
|
+
lastUpdatedAt: string,
|
|
59
|
+
cacheRetentionDays: number
|
|
60
|
+
): boolean {
|
|
61
|
+
const cacheExpirationTimestamp =
|
|
62
|
+
Number(lastUpdatedAt) + cacheRetentionDays * 24 * 60 * 60 * 1000;
|
|
63
|
+
return Date.now() > cacheExpirationTimestamp;
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
/**
|
|
52
67
|
* If the current time is earlier than the time that a token was cached at, we must discard the token
|
|
53
68
|
* i.e. The system clock was turned back after acquiring the cached token
|