@azure/msal-common 14.2.0 → 14.4.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/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +4 -5
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +29 -172
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +79 -413
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +2 -2
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs.map +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 +24 -19
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.mjs +51 -33
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.d.ts +12 -43
- package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +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 +15 -73
- package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/dist/cache/entities/IdTokenEntity.d.ts +4 -30
- package/dist/cache/entities/IdTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/RefreshTokenEntity.d.ts +2 -33
- package/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.d.ts +2 -9
- package/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -1
- package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.d.ts +65 -0
- package/dist/cache/utils/CacheHelpers.d.ts.map +1 -0
- package/dist/cache/utils/CacheHelpers.mjs +242 -0
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -0
- package/dist/client/AuthorizationCodeClient.d.ts +2 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +4 -10
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +8 -8
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +2 -2
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.d.ts.map +1 -1
- package/dist/client/SilentFlowClient.mjs +5 -3
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/crypto/ICrypto.d.ts +3 -3
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.d.ts +3 -3
- package/dist/crypto/JoseHeader.d.ts.map +1 -1
- package/dist/crypto/JoseHeader.mjs +3 -3
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +3 -3
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +4 -0
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +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/ServerError.mjs +1 -1
- package/dist/index.cjs +2768 -3303
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +6 -7
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/RequestThumbprint.d.ts +2 -0
- package/dist/network/RequestThumbprint.d.ts.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.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +3 -0
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts +2 -2
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +23 -29
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +6 -2
- 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 +11 -8
- package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
- package/dist/url/UrlString.d.ts +2 -37
- package/dist/url/UrlString.d.ts.map +1 -1
- package/dist/url/UrlString.mjs +7 -126
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/Constants.d.ts +2 -3
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +3 -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.mjs +1 -1
- package/dist/utils/UrlUtils.d.ts +11 -0
- package/dist/utils/UrlUtils.d.ts.map +1 -0
- package/dist/utils/UrlUtils.mjs +52 -0
- package/dist/utils/UrlUtils.mjs.map +1 -0
- package/package.json +1 -1
- package/src/authority/Authority.ts +5 -8
- package/src/authority/AuthorityMetadata.ts +109 -435
- package/src/authority/AuthorityOptions.ts +2 -2
- package/src/cache/CacheManager.ts +79 -42
- package/src/cache/entities/AccessTokenEntity.ts +13 -149
- package/src/cache/entities/CredentialEntity.ts +16 -200
- package/src/cache/entities/IdTokenEntity.ts +4 -64
- package/src/cache/entities/RefreshTokenEntity.ts +2 -69
- package/src/cache/entities/ServerTelemetryEntity.ts +2 -30
- package/src/cache/utils/CacheHelpers.ts +327 -0
- package/src/client/AuthorizationCodeClient.ts +4 -15
- package/src/client/BaseClient.ts +21 -10
- package/src/client/RefreshTokenClient.ts +7 -1
- package/src/client/SilentFlowClient.ts +8 -4
- package/src/crypto/ICrypto.ts +7 -2
- package/src/crypto/JoseHeader.ts +4 -4
- package/src/crypto/PopTokenGenerator.ts +2 -0
- package/src/crypto/SignedHttpRequest.ts +6 -0
- package/src/index.ts +4 -1
- package/src/network/RequestThumbprint.ts +2 -0
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +3 -0
- package/src/response/ResponseHandler.ts +36 -41
- package/src/telemetry/performance/PerformanceEvent.ts +12 -1
- package/src/telemetry/server/ServerTelemetryManager.ts +12 -6
- package/src/url/UrlString.ts +6 -153
- package/src/utils/Constants.ts +3 -3
- package/src/utils/UrlUtils.ts +60 -0
- package/dist/cache/entities/AccessTokenEntity.mjs +0 -121
- package/dist/cache/entities/AccessTokenEntity.mjs.map +0 -1
- package/dist/cache/entities/CredentialEntity.mjs +0 -145
- package/dist/cache/entities/CredentialEntity.mjs.map +0 -1
- package/dist/cache/entities/IdTokenEntity.mjs +0 -64
- package/dist/cache/entities/IdTokenEntity.mjs.map +0 -1
- package/dist/cache/entities/RefreshTokenEntity.mjs +0 -67
- package/dist/cache/entities/RefreshTokenEntity.mjs.map +0 -1
- package/dist/cache/entities/ServerTelemetryEntity.mjs +0 -34
- package/dist/cache/entities/ServerTelemetryEntity.mjs.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.2.0 2023-10-20 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { CredentialEntity } from './CredentialEntity.mjs';
|
|
4
|
-
import { CredentialType, AuthenticationScheme } from '../../utils/Constants.mjs';
|
|
5
|
-
import { TimeUtils } from '../../utils/TimeUtils.mjs';
|
|
6
|
-
import { createClientAuthError } from '../../error/ClientAuthError.mjs';
|
|
7
|
-
import { extractTokenClaims } from '../../account/AuthToken.mjs';
|
|
8
|
-
import { tokenClaimsCnfRequiredForSignedJwt } from '../../error/ClientAuthErrorCodes.mjs';
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* ACCESS_TOKEN Credential Type
|
|
16
|
-
*
|
|
17
|
-
* Key:Value Schema:
|
|
18
|
-
*
|
|
19
|
-
* Key Example: uid.utid-login.microsoftonline.com-accesstoken-clientId-contoso.com-user.read
|
|
20
|
-
*
|
|
21
|
-
* Value Schema:
|
|
22
|
-
* {
|
|
23
|
-
* homeAccountId: home account identifier for the auth scheme,
|
|
24
|
-
* environment: entity that issued the token, represented as a full host
|
|
25
|
-
* credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other
|
|
26
|
-
* clientId: client ID of the application
|
|
27
|
-
* secret: Actual credential as a string
|
|
28
|
-
* familyId: Family ID identifier, usually only used for refresh tokens
|
|
29
|
-
* realm: Full tenant or organizational identifier that the account belongs to
|
|
30
|
-
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
31
|
-
* cachedAt: Absolute device time when entry was created in the cache.
|
|
32
|
-
* expiresOn: Token expiry time, calculated based on current UTC time in seconds. Represented as a string.
|
|
33
|
-
* extendedExpiresOn: Additional extended expiry time until when token is valid in case of server-side outage. Represented as string in UTC seconds.
|
|
34
|
-
* keyId: used for POP and SSH tokenTypes
|
|
35
|
-
* tokenType: Type of the token issued. Usually "Bearer"
|
|
36
|
-
* }
|
|
37
|
-
*/
|
|
38
|
-
class AccessTokenEntity extends CredentialEntity {
|
|
39
|
-
/**
|
|
40
|
-
* Create AccessTokenEntity
|
|
41
|
-
* @param homeAccountId
|
|
42
|
-
* @param environment
|
|
43
|
-
* @param accessToken
|
|
44
|
-
* @param clientId
|
|
45
|
-
* @param tenantId
|
|
46
|
-
* @param scopes
|
|
47
|
-
* @param expiresOn
|
|
48
|
-
* @param extExpiresOn
|
|
49
|
-
*/
|
|
50
|
-
static createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {
|
|
51
|
-
const atEntity = new AccessTokenEntity();
|
|
52
|
-
atEntity.homeAccountId = homeAccountId;
|
|
53
|
-
atEntity.credentialType = CredentialType.ACCESS_TOKEN;
|
|
54
|
-
atEntity.secret = accessToken;
|
|
55
|
-
const currentTime = TimeUtils.nowSeconds();
|
|
56
|
-
atEntity.cachedAt = currentTime.toString();
|
|
57
|
-
/*
|
|
58
|
-
* Token expiry time.
|
|
59
|
-
* This value should be calculated based on the current UTC time measured locally and the value expires_in Represented as a string in JSON.
|
|
60
|
-
*/
|
|
61
|
-
atEntity.expiresOn = expiresOn.toString();
|
|
62
|
-
atEntity.extendedExpiresOn = extExpiresOn.toString();
|
|
63
|
-
if (refreshOn) {
|
|
64
|
-
atEntity.refreshOn = refreshOn.toString();
|
|
65
|
-
}
|
|
66
|
-
atEntity.environment = environment;
|
|
67
|
-
atEntity.clientId = clientId;
|
|
68
|
-
atEntity.realm = tenantId;
|
|
69
|
-
atEntity.target = scopes;
|
|
70
|
-
atEntity.userAssertionHash = userAssertionHash;
|
|
71
|
-
atEntity.tokenType = tokenType || AuthenticationScheme.BEARER;
|
|
72
|
-
if (requestedClaims) {
|
|
73
|
-
atEntity.requestedClaims = requestedClaims;
|
|
74
|
-
atEntity.requestedClaimsHash = requestedClaimsHash;
|
|
75
|
-
}
|
|
76
|
-
/*
|
|
77
|
-
* Create Access Token With Auth Scheme instead of regular access token
|
|
78
|
-
* Cast to lower to handle "bearer" from ADFS
|
|
79
|
-
*/
|
|
80
|
-
if (atEntity.tokenType?.toLowerCase() !==
|
|
81
|
-
AuthenticationScheme.BEARER.toLowerCase()) {
|
|
82
|
-
atEntity.credentialType =
|
|
83
|
-
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
84
|
-
switch (atEntity.tokenType) {
|
|
85
|
-
case AuthenticationScheme.POP:
|
|
86
|
-
// Make sure keyId is present and add it to credential
|
|
87
|
-
const tokenClaims = extractTokenClaims(accessToken, cryptoUtils.base64Decode);
|
|
88
|
-
if (!tokenClaims?.cnf?.kid) {
|
|
89
|
-
throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
|
|
90
|
-
}
|
|
91
|
-
atEntity.keyId = tokenClaims.cnf.kid;
|
|
92
|
-
break;
|
|
93
|
-
case AuthenticationScheme.SSH:
|
|
94
|
-
atEntity.keyId = keyId;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return atEntity;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Validates an entity: checks for all expected params
|
|
101
|
-
* @param entity
|
|
102
|
-
*/
|
|
103
|
-
static isAccessTokenEntity(entity) {
|
|
104
|
-
if (!entity) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
return (entity.hasOwnProperty("homeAccountId") &&
|
|
108
|
-
entity.hasOwnProperty("environment") &&
|
|
109
|
-
entity.hasOwnProperty("credentialType") &&
|
|
110
|
-
entity.hasOwnProperty("realm") &&
|
|
111
|
-
entity.hasOwnProperty("clientId") &&
|
|
112
|
-
entity.hasOwnProperty("secret") &&
|
|
113
|
-
entity.hasOwnProperty("target") &&
|
|
114
|
-
(entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
|
|
115
|
-
entity["credentialType"] ===
|
|
116
|
-
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export { AccessTokenEntity };
|
|
121
|
-
//# sourceMappingURL=AccessTokenEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccessTokenEntity.mjs","sources":["../../../src/cache/entities/AccessTokenEntity.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAKA;AACA;AAEA;AAQA;;;;;;;;;;;;;;;;;;AAuBG;AACH;;;;;;AAMa,MAAA,iBAAU,SAAA,gBAAA,CAAA;;;;;AAMnB;;;;;;;;;;AAUG,QAAA,QAAA,CAAA,cAAA,GAAA,cAAA,CAAA,YAAA,CAAA;AACH,QAAA,QAAO,CAAA,MAAA,GAAA,WACH,CAAA;AAgFJ,QAAA,MAAA,WAAA,GAAA,SAAA,CAAA,UAAA,EAAA,CAAA;;;AAGG;AACH;AAkBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.2.0 2023-10-20 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { CredentialType, CacheType, Separators, Constants, AuthenticationScheme } from '../../utils/Constants.mjs';
|
|
4
|
-
import { createClientAuthError } from '../../error/ClientAuthError.mjs';
|
|
5
|
-
import { unexpectedCredentialType } from '../../error/ClientAuthErrorCodes.mjs';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc
|
|
13
|
-
*
|
|
14
|
-
* Key:Value Schema:
|
|
15
|
-
*
|
|
16
|
-
* Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>
|
|
17
|
-
*
|
|
18
|
-
* Value Schema:
|
|
19
|
-
* {
|
|
20
|
-
* homeAccountId: home account identifier for the auth scheme,
|
|
21
|
-
* environment: entity that issued the token, represented as a full host
|
|
22
|
-
* credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other
|
|
23
|
-
* clientId: client ID of the application
|
|
24
|
-
* secret: Actual credential as a string
|
|
25
|
-
* familyId: Family ID identifier, usually only used for refresh tokens
|
|
26
|
-
* realm: Full tenant or organizational identifier that the account belongs to
|
|
27
|
-
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
28
|
-
* tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)
|
|
29
|
-
* requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request
|
|
30
|
-
* userAssertionHash: Matches the SHA 256 hash of the obo_assertion for the OBO flow
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
class CredentialEntity {
|
|
34
|
-
/**
|
|
35
|
-
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
36
|
-
*/
|
|
37
|
-
generateAccountId() {
|
|
38
|
-
return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generate Credential Id key component as per the schema: <credential_type>-<client_id>-<realm>
|
|
42
|
-
*/
|
|
43
|
-
generateCredentialId() {
|
|
44
|
-
return CredentialEntity.generateCredentialIdForCacheKey(this.credentialType, this.clientId, this.realm, this.familyId);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Generate target key component as per schema: <target>
|
|
48
|
-
*/
|
|
49
|
-
generateTarget() {
|
|
50
|
-
return CredentialEntity.generateTargetForCacheKey(this.target);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* generates credential key
|
|
54
|
-
*/
|
|
55
|
-
generateCredentialKey() {
|
|
56
|
-
return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType, this.requestedClaimsHash);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* returns the type of the cache (in this case credential)
|
|
60
|
-
*/
|
|
61
|
-
generateType() {
|
|
62
|
-
switch (this.credentialType) {
|
|
63
|
-
case CredentialType.ID_TOKEN:
|
|
64
|
-
return CacheType.ID_TOKEN;
|
|
65
|
-
case CredentialType.ACCESS_TOKEN:
|
|
66
|
-
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
67
|
-
return CacheType.ACCESS_TOKEN;
|
|
68
|
-
case CredentialType.REFRESH_TOKEN:
|
|
69
|
-
return CacheType.REFRESH_TOKEN;
|
|
70
|
-
default: {
|
|
71
|
-
throw createClientAuthError(unexpectedCredentialType);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* generates credential key
|
|
77
|
-
* <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>
|
|
78
|
-
*/
|
|
79
|
-
static generateCredentialCacheKey(homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType, requestedClaimsHash) {
|
|
80
|
-
const credentialKey = [
|
|
81
|
-
this.generateAccountIdForCacheKey(homeAccountId, environment),
|
|
82
|
-
this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),
|
|
83
|
-
this.generateTargetForCacheKey(target),
|
|
84
|
-
this.generateClaimsHashForCacheKey(requestedClaimsHash),
|
|
85
|
-
this.generateSchemeForCacheKey(tokenType),
|
|
86
|
-
];
|
|
87
|
-
return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* generates Account Id for keys
|
|
91
|
-
* @param homeAccountId
|
|
92
|
-
* @param environment
|
|
93
|
-
*/
|
|
94
|
-
static generateAccountIdForCacheKey(homeAccountId, environment) {
|
|
95
|
-
const accountId = [homeAccountId, environment];
|
|
96
|
-
return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Generates Credential Id for keys
|
|
100
|
-
* @param credentialType
|
|
101
|
-
* @param realm
|
|
102
|
-
* @param clientId
|
|
103
|
-
* @param familyId
|
|
104
|
-
*/
|
|
105
|
-
static generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId) {
|
|
106
|
-
const clientOrFamilyId = credentialType === CredentialType.REFRESH_TOKEN
|
|
107
|
-
? familyId || clientId
|
|
108
|
-
: clientId;
|
|
109
|
-
const credentialId = [
|
|
110
|
-
credentialType,
|
|
111
|
-
clientOrFamilyId,
|
|
112
|
-
realm || Constants.EMPTY_STRING,
|
|
113
|
-
];
|
|
114
|
-
return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Generate target key component as per schema: <target>
|
|
118
|
-
*/
|
|
119
|
-
static generateTargetForCacheKey(scopes) {
|
|
120
|
-
return (scopes || Constants.EMPTY_STRING).toLowerCase();
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Generate requested claims key component as per schema: <requestedClaims>
|
|
124
|
-
*/
|
|
125
|
-
static generateClaimsHashForCacheKey(requestedClaimsHash) {
|
|
126
|
-
return (requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Generate scheme key componenet as per schema: <scheme>
|
|
130
|
-
*/
|
|
131
|
-
static generateSchemeForCacheKey(tokenType) {
|
|
132
|
-
/*
|
|
133
|
-
* PoP Tokens and SSH certs include scheme in cache key
|
|
134
|
-
* Cast to lowercase to handle "bearer" from ADFS
|
|
135
|
-
*/
|
|
136
|
-
return tokenType &&
|
|
137
|
-
tokenType.toLowerCase() !==
|
|
138
|
-
AuthenticationScheme.BEARER.toLowerCase()
|
|
139
|
-
? tokenType.toLowerCase()
|
|
140
|
-
: Constants.EMPTY_STRING;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export { CredentialEntity };
|
|
145
|
-
//# sourceMappingURL=CredentialEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialEntity.mjs","sources":["../../../src/cache/entities/CredentialEntity.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.unexpectedCredentialType"],"mappings":";;;;;;AAKA;AAYA;;;;;;;;;;;;;;;;;;;AAqBG;AACH;;;;;AAKU,sBAAS,CAAA;;;;IAIf,iBAAiB,GAAG;QACX,OAAG,gBAAA,CAAA,4BAAqB,CAAA,IAAA,CAAA,aAAA,EAAA,IAAA,CAAA,WAAA,CAAA,CAAA;KAC5B;;AAGL;;AAEG,IAAA,oBAAA,GAAA;AACH,QAAA,OAAA,gBAA2B,CAAA,+BAAA,CAAA,IAAA,CAAA,cAAA,EAAA,IAAA,CAAA,QAAA,EAAA,IAAA,CAAA,KAAA,EAAA,IAAA,CAAA,QAAA,CAAA,CAAA;AAO3B,KAAA;;AAEG;AACH;AASA,IAAA,cAAA,GAAA;;AAEG,KAAA;AACH;AAIA;;AAEG,IAAA,qBAAA,GAAA;AACH,QAAA,OAAA,gBAA+B,CAAA,0BAAA,CAAA,IAAA,CAAA,aAAA,EAAA,IAAA,CAAA,WAAA,EAAA,IAAA,CAAA,cAAA,EAAA,IAAA,CAAA,QAAA,EAAA,IAAA,CAAA,KAAA,EAAA,IAAA,CAAA,MAAA,EAAA,IAAA,CAAA,QAAA,EAAA,IAAA,CAAA,SAAA,EAAA,IAAA,CAAA,mBAAA,CAAA,CAAA;AAc/B,KAAA;;AAEG;AACH;AAiBA,IAAA,YAAA,GAAA;;;AAGG,gBAAA,OAAA,SAAA,CAAA,QAAA,CAAA;4CAEC,CAAA;AA0BJ,YAAA,KAAA,cAAA,CAAA,6BAAA;;;;AAIG,YAAA,SAAA;gBACW,MAA6B,qBAAA,CAAAA,wBAAA,CAAA,CAAA;AAQ3C,aAAA;;;;;;AAMG;IACH,OAAO,0BAAuC,CAAA,aAAA,EAAA,WAAA,EAAA,cAAA,EAAA,QAAA,EAAA,KAAA,EAAA,MAAA,EAAA,QAAA,EAAA,SAAA,EAAA,mBAAA,EAAA;AAmB9C,QAAA,MAAA,aAAA,GAAA;;AAEG,YAAA,IAAA,CAAA,+BAAA,CAAA,cAAA,EAAA,QAAA,EAAA,KAAA,EAAA,QAAA,CAAA;YACK,IAAM,CAAA,yBAA0B,CAAA,MAAA,CAAA;AAIxC,YAAA,IAAA,CAAA,6BAAA,CAAA,mBAAA,CAAA;;AAEG,SAAA,CAAA;QACI,OAAO,aAA8B,CAAA,IAAA,CAAA,UAAA,CAAA,mBAAA,CAAA,CAAA,WAAA,EAAA,CAAA;AAM5C,KAAA;;AAEG;;AAYN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.2.0 2023-10-20 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { CredentialEntity } from './CredentialEntity.mjs';
|
|
4
|
-
import { CredentialType } from '../../utils/Constants.mjs';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* ID_TOKEN Cache
|
|
12
|
-
*
|
|
13
|
-
* Key:Value Schema:
|
|
14
|
-
*
|
|
15
|
-
* Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-
|
|
16
|
-
*
|
|
17
|
-
* Value Schema:
|
|
18
|
-
* {
|
|
19
|
-
* homeAccountId: home account identifier for the auth scheme,
|
|
20
|
-
* environment: entity that issued the token, represented as a full host
|
|
21
|
-
* credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other
|
|
22
|
-
* clientId: client ID of the application
|
|
23
|
-
* secret: Actual credential as a string
|
|
24
|
-
* realm: Full tenant or organizational identifier that the account belongs to
|
|
25
|
-
* }
|
|
26
|
-
*/
|
|
27
|
-
class IdTokenEntity extends CredentialEntity {
|
|
28
|
-
/**
|
|
29
|
-
* Create IdTokenEntity
|
|
30
|
-
* @param homeAccountId
|
|
31
|
-
* @param authenticationResult
|
|
32
|
-
* @param clientId
|
|
33
|
-
* @param authority
|
|
34
|
-
*/
|
|
35
|
-
static createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
|
|
36
|
-
const idTokenEntity = new IdTokenEntity();
|
|
37
|
-
idTokenEntity.credentialType = CredentialType.ID_TOKEN;
|
|
38
|
-
idTokenEntity.homeAccountId = homeAccountId;
|
|
39
|
-
idTokenEntity.environment = environment;
|
|
40
|
-
idTokenEntity.clientId = clientId;
|
|
41
|
-
idTokenEntity.secret = idToken;
|
|
42
|
-
idTokenEntity.realm = tenantId;
|
|
43
|
-
return idTokenEntity;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Validates an entity: checks for all expected params
|
|
47
|
-
* @param entity
|
|
48
|
-
*/
|
|
49
|
-
static isIdTokenEntity(entity) {
|
|
50
|
-
if (!entity) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return (entity.hasOwnProperty("homeAccountId") &&
|
|
54
|
-
entity.hasOwnProperty("environment") &&
|
|
55
|
-
entity.hasOwnProperty("credentialType") &&
|
|
56
|
-
entity.hasOwnProperty("realm") &&
|
|
57
|
-
entity.hasOwnProperty("clientId") &&
|
|
58
|
-
entity.hasOwnProperty("secret") &&
|
|
59
|
-
entity["credentialType"] === CredentialType.ID_TOKEN);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { IdTokenEntity };
|
|
64
|
-
//# sourceMappingURL=IdTokenEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IdTokenEntity.mjs","sources":["../../../src/cache/entities/IdTokenEntity.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;AAGA;;;;;;;;;;;;;;AAgBG;AACH;;AAGI;;;;;;AAMG;;AAoBH;;;AAGG,IAAA,OAAA,mBAAA,CAAA,aAAA,EAAA,WAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA;AACH,QAAA,MAAsB,aAAC,OAAQ,aAAgB,EAAA,CAAA;AAelD,QAAA,aAAA,CAAA,cAAA,GAAA,cAAA,CAAA,QAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.2.0 2023-10-20 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { CredentialEntity } from './CredentialEntity.mjs';
|
|
4
|
-
import { CredentialType } from '../../utils/Constants.mjs';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* REFRESH_TOKEN Cache
|
|
12
|
-
*
|
|
13
|
-
* Key:Value Schema:
|
|
14
|
-
*
|
|
15
|
-
* Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--
|
|
16
|
-
*
|
|
17
|
-
* Value:
|
|
18
|
-
* {
|
|
19
|
-
* homeAccountId: home account identifier for the auth scheme,
|
|
20
|
-
* environment: entity that issued the token, represented as a full host
|
|
21
|
-
* credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other
|
|
22
|
-
* clientId: client ID of the application
|
|
23
|
-
* secret: Actual credential as a string
|
|
24
|
-
* familyId: Family ID identifier, '1' represents Microsoft Family
|
|
25
|
-
* realm: Full tenant or organizational identifier that the account belongs to
|
|
26
|
-
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
27
|
-
* }
|
|
28
|
-
*/
|
|
29
|
-
class RefreshTokenEntity extends CredentialEntity {
|
|
30
|
-
/**
|
|
31
|
-
* Create RefreshTokenEntity
|
|
32
|
-
* @param homeAccountId
|
|
33
|
-
* @param authenticationResult
|
|
34
|
-
* @param clientId
|
|
35
|
-
* @param authority
|
|
36
|
-
*/
|
|
37
|
-
static createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash) {
|
|
38
|
-
const rtEntity = new RefreshTokenEntity();
|
|
39
|
-
rtEntity.clientId = clientId;
|
|
40
|
-
rtEntity.credentialType = CredentialType.REFRESH_TOKEN;
|
|
41
|
-
rtEntity.environment = environment;
|
|
42
|
-
rtEntity.homeAccountId = homeAccountId;
|
|
43
|
-
rtEntity.secret = refreshToken;
|
|
44
|
-
rtEntity.userAssertionHash = userAssertionHash;
|
|
45
|
-
if (familyId)
|
|
46
|
-
rtEntity.familyId = familyId;
|
|
47
|
-
return rtEntity;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Validates an entity: checks for all expected params
|
|
51
|
-
* @param entity
|
|
52
|
-
*/
|
|
53
|
-
static isRefreshTokenEntity(entity) {
|
|
54
|
-
if (!entity) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return (entity.hasOwnProperty("homeAccountId") &&
|
|
58
|
-
entity.hasOwnProperty("environment") &&
|
|
59
|
-
entity.hasOwnProperty("credentialType") &&
|
|
60
|
-
entity.hasOwnProperty("clientId") &&
|
|
61
|
-
entity.hasOwnProperty("secret") &&
|
|
62
|
-
entity["credentialType"] === CredentialType.REFRESH_TOKEN);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { RefreshTokenEntity };
|
|
67
|
-
//# sourceMappingURL=RefreshTokenEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshTokenEntity.mjs","sources":["../../../src/cache/entities/RefreshTokenEntity.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;AAGA;;;;;;;;;;;;;;;;AAkBG;AACH;;AAGI;;;;;;AAMG;AACH;AAsBA;;;AAGG,IAAA,OAAA,wBAAA,CAAA,aAAA,EAAA,WAAA,EAAA,YAAA,EAAA,QAAA,EAAA,QAAA,EAAA,iBAAA,EAAA;AACH,QAAA,MAA2B,QAAA,GAAA,IAAA,oBAAkB,CAAO;AAcvD,QAAA,QAAA,CAAA,QAAA,GAAA,QAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.2.0 2023-10-20 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class ServerTelemetryEntity {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.failedRequests = [];
|
|
12
|
-
this.errors = [];
|
|
13
|
-
this.cacheHits = 0;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* validates if a given cache entry is "Telemetry", parses <key,value>
|
|
17
|
-
* @param key
|
|
18
|
-
* @param entity
|
|
19
|
-
*/
|
|
20
|
-
static isServerTelemetryEntity(key, entity) {
|
|
21
|
-
const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
|
|
22
|
-
let validateEntity = true;
|
|
23
|
-
if (entity) {
|
|
24
|
-
validateEntity =
|
|
25
|
-
entity.hasOwnProperty("failedRequests") &&
|
|
26
|
-
entity.hasOwnProperty("errors") &&
|
|
27
|
-
entity.hasOwnProperty("cacheHits");
|
|
28
|
-
}
|
|
29
|
-
return validateKey && validateEntity;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { ServerTelemetryEntity };
|
|
34
|
-
//# sourceMappingURL=ServerTelemetryEntity.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerTelemetryEntity.mjs","sources":["../../../src/cache/entities/ServerTelemetryEntity.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;AACI;;;AAUA,MAAA,qBAAA,CAAA;;;;AAIG,QAAA,IAAA,CAAA,SAAA,GAAA,CAAA,CAAA;AACH,KAAA;AAcH;;;;;;;;;;;;;;;;;;;;"}
|