@azure/msal-common 14.10.0 → 14.12.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.mjs +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 +1 -1
- package/dist/cache/CacheManager.mjs +2 -2
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +20 -6
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +10 -3
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.d.ts +10 -0
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +7 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +0 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +2 -3
- package/dist/crypto/PopTokenGenerator.mjs.map +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.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 +4767 -4728
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +16 -16
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +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 +2 -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.map +1 -1
- package/dist/response/ResponseHandler.mjs +8 -2
- 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 +9 -2
- 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.mjs +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.mjs +1 -1
- package/package.json +4 -2
- package/src/cache/CacheManager.ts +1 -1
- package/src/client/AuthorizationCodeClient.ts +31 -17
- package/src/client/RefreshTokenClient.ts +17 -8
- package/src/crypto/ICrypto.ts +16 -0
- package/src/crypto/PopTokenGenerator.ts +1 -3
- package/src/index.ts +12 -7
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +2 -0
- package/src/response/ResponseHandler.ts +7 -1
- package/src/telemetry/performance/PerformanceEvent.ts +9 -1
|
@@ -390,15 +390,22 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
390
390
|
this.performanceClient
|
|
391
391
|
);
|
|
392
392
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
393
|
+
let reqCnfData;
|
|
394
|
+
if (!request.popKid) {
|
|
395
|
+
const generatedReqCnfData = await invokeAsync(
|
|
396
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
397
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
398
|
+
this.logger,
|
|
399
|
+
this.performanceClient,
|
|
400
|
+
request.correlationId
|
|
401
|
+
)(request, this.logger);
|
|
402
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
403
|
+
} else {
|
|
404
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
405
|
+
}
|
|
406
|
+
|
|
400
407
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
401
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
408
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
402
409
|
} else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
403
410
|
if (request.sshJwk) {
|
|
404
411
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
@@ -682,15 +689,22 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
682
689
|
const popTokenGenerator = new PopTokenGenerator(
|
|
683
690
|
this.cryptoUtils
|
|
684
691
|
);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
|
|
693
|
+
// req_cnf is always sent as a string for SPAs
|
|
694
|
+
let reqCnfData;
|
|
695
|
+
if (!request.popKid) {
|
|
696
|
+
const generatedReqCnfData = await invokeAsync(
|
|
697
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
698
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
699
|
+
this.logger,
|
|
700
|
+
this.performanceClient,
|
|
701
|
+
request.correlationId
|
|
702
|
+
)(request, this.logger);
|
|
703
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
704
|
+
} else {
|
|
705
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
706
|
+
}
|
|
707
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
694
708
|
}
|
|
695
709
|
}
|
|
696
710
|
|
|
@@ -407,15 +407,24 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
407
407
|
this.cryptoUtils,
|
|
408
408
|
this.performanceClient
|
|
409
409
|
);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
410
|
+
|
|
411
|
+
let reqCnfData;
|
|
412
|
+
if (!request.popKid) {
|
|
413
|
+
const generatedReqCnfData = await invokeAsync(
|
|
414
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
415
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
416
|
+
this.logger,
|
|
417
|
+
this.performanceClient,
|
|
418
|
+
request.correlationId
|
|
419
|
+
)(request, this.logger);
|
|
420
|
+
|
|
421
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
422
|
+
} else {
|
|
423
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
424
|
+
}
|
|
425
|
+
|
|
417
426
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
418
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
427
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
419
428
|
} else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
420
429
|
if (request.sshJwk) {
|
|
421
430
|
parameterBuilder.addSshJwk(request.sshJwk);
|
package/src/crypto/ICrypto.ts
CHANGED
|
@@ -49,6 +49,16 @@ export interface ICrypto {
|
|
|
49
49
|
* @param input
|
|
50
50
|
*/
|
|
51
51
|
base64Decode(input: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* base64 URL safe encoded string
|
|
54
|
+
*/
|
|
55
|
+
base64UrlEncode(input: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Stringifies and base64Url encodes input public key
|
|
58
|
+
* @param inputKid
|
|
59
|
+
* @returns Base64Url encoded public key
|
|
60
|
+
*/
|
|
61
|
+
encodeKid(inputKid: string): string;
|
|
52
62
|
/**
|
|
53
63
|
* Generates an JWK RSA S256 Thumbprint
|
|
54
64
|
* @param request
|
|
@@ -92,6 +102,12 @@ export const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {
|
|
|
92
102
|
base64Encode: (): string => {
|
|
93
103
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
94
104
|
},
|
|
105
|
+
base64UrlEncode: (): string => {
|
|
106
|
+
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
107
|
+
},
|
|
108
|
+
encodeKid: (): string => {
|
|
109
|
+
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
110
|
+
},
|
|
95
111
|
async getPublicKeyThumbprint(): Promise<string> {
|
|
96
112
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
97
113
|
},
|
|
@@ -26,7 +26,6 @@ type ReqCnf = {
|
|
|
26
26
|
export type ReqCnfData = {
|
|
27
27
|
kid: string;
|
|
28
28
|
reqCnfString: string;
|
|
29
|
-
reqCnfHash: string;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
const KeyLocation = {
|
|
@@ -67,14 +66,13 @@ export class PopTokenGenerator {
|
|
|
67
66
|
this.performanceClient,
|
|
68
67
|
request.correlationId
|
|
69
68
|
)(request);
|
|
70
|
-
const reqCnfString: string = this.cryptoUtils.
|
|
69
|
+
const reqCnfString: string = this.cryptoUtils.base64UrlEncode(
|
|
71
70
|
JSON.stringify(reqCnf)
|
|
72
71
|
);
|
|
73
72
|
|
|
74
73
|
return {
|
|
75
74
|
kid: reqCnf.kid,
|
|
76
75
|
reqCnfString,
|
|
77
|
-
reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
|
|
78
76
|
};
|
|
79
77
|
}
|
|
80
78
|
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
* @module @azure/msal-common
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import * as AuthToken from "./account/AuthToken";
|
|
12
|
+
import * as AuthorityFactory from "./authority/AuthorityFactory";
|
|
13
|
+
import * as CacheHelpers from "./cache/utils/CacheHelpers";
|
|
14
|
+
import * as TimeUtils from "./utils/TimeUtils";
|
|
15
|
+
import * as UrlUtils from "./utils/UrlUtils";
|
|
16
|
+
import * as ClientAssertionUtils from "./utils/ClientAssertionUtils";
|
|
17
|
+
import * as AADServerParamKeys from "./constants/AADServerParamKeys";
|
|
11
18
|
export { AuthorizationCodeClient } from "./client/AuthorizationCodeClient";
|
|
12
19
|
export { RefreshTokenClient } from "./client/RefreshTokenClient";
|
|
13
20
|
export { SilentFlowClient } from "./client/SilentFlowClient";
|
|
@@ -36,7 +43,7 @@ export {
|
|
|
36
43
|
tenantIdMatchesHomeTenant,
|
|
37
44
|
buildTenantProfileFromIdTokenClaims,
|
|
38
45
|
} from "./account/AccountInfo";
|
|
39
|
-
export
|
|
46
|
+
export { AuthToken };
|
|
40
47
|
export {
|
|
41
48
|
TokenClaims,
|
|
42
49
|
getTenantIdFromIdTokenClaims,
|
|
@@ -59,7 +66,7 @@ export {
|
|
|
59
66
|
AzureCloudInstance,
|
|
60
67
|
StaticAuthorityOptions,
|
|
61
68
|
} from "./authority/AuthorityOptions";
|
|
62
|
-
export
|
|
69
|
+
export { AuthorityFactory };
|
|
63
70
|
export { AuthorityType } from "./authority/AuthorityType";
|
|
64
71
|
export { ProtocolMode } from "./authority/ProtocolMode";
|
|
65
72
|
export { OIDCOptions } from "./authority/OIDCOptions";
|
|
@@ -81,7 +88,7 @@ export {
|
|
|
81
88
|
} from "./cache/utils/CacheTypes";
|
|
82
89
|
export { CacheRecord } from "./cache/entities/CacheRecord";
|
|
83
90
|
export { CredentialEntity } from "./cache/entities/CredentialEntity";
|
|
84
|
-
export
|
|
91
|
+
export { CacheHelpers };
|
|
85
92
|
export { AppMetadataEntity } from "./cache/entities/AppMetadataEntity";
|
|
86
93
|
export { AccountEntity } from "./cache/entities/AccountEntity";
|
|
87
94
|
export { IdTokenEntity } from "./cache/entities/IdTokenEntity";
|
|
@@ -213,7 +220,7 @@ export {
|
|
|
213
220
|
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
214
221
|
JsonWebTokenTypes,
|
|
215
222
|
} from "./utils/Constants";
|
|
216
|
-
export
|
|
223
|
+
export { AADServerParamKeys };
|
|
217
224
|
export { StringUtils } from "./utils/StringUtils";
|
|
218
225
|
export { StringDict } from "./utils/MsalTypes";
|
|
219
226
|
export {
|
|
@@ -221,9 +228,7 @@ export {
|
|
|
221
228
|
RequestStateObject,
|
|
222
229
|
LibraryStateObject,
|
|
223
230
|
} from "./utils/ProtocolUtils";
|
|
224
|
-
export
|
|
225
|
-
export * as UrlUtils from "./utils/UrlUtils";
|
|
226
|
-
export * as ClientAssertionUtils from "./utils/ClientAssertionUtils";
|
|
231
|
+
export { TimeUtils, UrlUtils, ClientAssertionUtils };
|
|
227
232
|
export * from "./utils/FunctionWrappers";
|
|
228
233
|
// Server Telemetry
|
|
229
234
|
export { ServerTelemetryManager } from "./telemetry/server/ServerTelemetryManager";
|
package/src/packageMetadata.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { ShrOptions } from "../crypto/SignedHttpRequest";
|
|
|
28
28
|
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
29
29
|
* - storeInCache - Object containing boolean values indicating whether to store tokens in the cache or not (default is true)
|
|
30
30
|
* - scenarioId - Scenario id to track custom user prompts
|
|
31
|
+
* - popKid - Key ID to identify the public key for PoP token request
|
|
31
32
|
*/
|
|
32
33
|
export type BaseAuthRequest = {
|
|
33
34
|
authority: string;
|
|
@@ -48,4 +49,5 @@ export type BaseAuthRequest = {
|
|
|
48
49
|
tokenQueryParameters?: StringDict;
|
|
49
50
|
storeInCache?: StoreInCache;
|
|
50
51
|
scenarioId?: string;
|
|
52
|
+
popKid?: string;
|
|
51
53
|
};
|
|
@@ -591,8 +591,14 @@ export class ResponseHandler {
|
|
|
591
591
|
let familyId: string = Constants.EMPTY_STRING;
|
|
592
592
|
|
|
593
593
|
if (cacheRecord.accessToken) {
|
|
594
|
+
/*
|
|
595
|
+
* if the request object has `popKid` property, `signPopToken` will be set to false and
|
|
596
|
+
* the token will be returned unsigned
|
|
597
|
+
*/
|
|
594
598
|
if (
|
|
595
|
-
cacheRecord.accessToken.tokenType ===
|
|
599
|
+
cacheRecord.accessToken.tokenType ===
|
|
600
|
+
AuthenticationScheme.POP &&
|
|
601
|
+
!request.popKid
|
|
596
602
|
) {
|
|
597
603
|
const popTokenGenerator: PopTokenGenerator =
|
|
598
604
|
new PopTokenGenerator(cryptoObj);
|
|
@@ -40,9 +40,17 @@ export const PerformanceEvents = {
|
|
|
40
40
|
*/
|
|
41
41
|
AcquireTokenPopup: "acquireTokenPopup",
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* acquireTokenPreRedirect (msal-browser).
|
|
45
|
+
* First part of the redirect flow.
|
|
46
|
+
* Used to acquire a new access token interactively through redirects.
|
|
47
|
+
*/
|
|
48
|
+
AcquireTokenPreRedirect: "acquireTokenPreRedirect",
|
|
49
|
+
|
|
43
50
|
/**
|
|
44
51
|
* acquireTokenRedirect (msal-browser).
|
|
45
|
-
*
|
|
52
|
+
* Second part of the redirect flow.
|
|
53
|
+
* Used to acquire a new access token interactively through redirects.
|
|
46
54
|
*/
|
|
47
55
|
AcquireTokenRedirect: "acquireTokenRedirect",
|
|
48
56
|
|