@azure/msal-common 6.2.0 → 6.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/_virtual/_tslib.js +1 -1
- package/dist/account/AccountInfo.d.ts +6 -1
- package/dist/account/AccountInfo.d.ts.map +1 -1
- package/dist/account/AuthToken.js +1 -1
- package/dist/account/CcsCredential.js +1 -1
- package/dist/account/ClientInfo.js +1 -1
- package/dist/account/TokenClaims.d.ts +30 -1
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.js +1 -1
- package/dist/authority/AuthorityFactory.js +1 -1
- package/dist/authority/AuthorityOptions.js +1 -1
- package/dist/authority/AuthorityType.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
- package/dist/authority/OpenIdConfigResponse.js +1 -1
- package/dist/authority/ProtocolMode.js +1 -1
- package/dist/authority/RegionDiscovery.js +1 -1
- package/dist/cache/CacheManager.d.ts +1 -1
- package/dist/cache/CacheManager.js +2 -2
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/entities/AccessTokenEntity.js +1 -1
- package/dist/cache/entities/AccountEntity.d.ts +3 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.js +7 -3
- package/dist/cache/entities/AccountEntity.js.map +1 -1
- package/dist/cache/entities/AppMetadataEntity.js +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
- package/dist/cache/entities/CacheRecord.js +1 -1
- package/dist/cache/entities/CredentialEntity.js +1 -1
- package/dist/cache/entities/IdTokenEntity.js +1 -1
- package/dist/cache/entities/RefreshTokenEntity.js +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
- package/dist/cache/entities/ThrottlingEntity.js +1 -1
- package/dist/cache/persistence/TokenCacheContext.js +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +121 -99
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.js +1 -1
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.js +4 -3
- package/dist/client/ClientCredentialClient.js.map +1 -1
- package/dist/client/DeviceCodeClient.js +1 -1
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.js +4 -3
- package/dist/client/OnBehalfOfClient.js.map +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +7 -6
- package/dist/client/RefreshTokenClient.js.map +1 -1
- package/dist/client/SilentFlowClient.js +1 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.js +5 -3
- package/dist/client/UsernamePasswordClient.js.map +1 -1
- package/dist/config/ClientConfiguration.d.ts +5 -4
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +1 -1
- package/dist/config/ClientConfiguration.js.map +1 -1
- package/dist/crypto/ICrypto.js +1 -1
- package/dist/crypto/JoseHeader.d.ts +22 -0
- package/dist/crypto/JoseHeader.d.ts.map +1 -0
- package/dist/crypto/JoseHeader.js +45 -0
- package/dist/crypto/JoseHeader.js.map +1 -0
- package/dist/crypto/PopTokenGenerator.d.ts +33 -3
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.js +43 -19
- package/dist/crypto/PopTokenGenerator.js.map +1 -1
- package/dist/error/AuthError.js +1 -1
- package/dist/error/ClientAuthError.d.ts +8 -0
- package/dist/error/ClientAuthError.d.ts.map +1 -1
- package/dist/error/ClientAuthError.js +11 -1
- package/dist/error/ClientAuthError.js.map +1 -1
- package/dist/error/ClientConfigurationError.js +1 -1
- package/dist/error/InteractionRequiredAuthError.js +1 -1
- package/dist/error/JoseHeaderError.d.ts +29 -0
- package/dist/error/JoseHeaderError.d.ts.map +1 -0
- package/dist/error/JoseHeaderError.js +50 -0
- package/dist/error/JoseHeaderError.js.map +1 -0
- package/dist/error/ServerError.js +1 -1
- package/dist/index.cjs.js +329 -140
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logger/Logger.js +1 -1
- package/dist/network/INetworkModule.js +1 -1
- package/dist/network/NetworkManager.js +1 -1
- package/dist/network/ThrottlingUtils.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthenticationHeaderParser.js +1 -1
- package/dist/request/BaseAuthRequest.d.ts +5 -3
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonAuthorizationUrlRequest.d.ts +1 -0
- package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +8 -0
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +15 -3
- package/dist/request/RequestParameterBuilder.js.map +1 -1
- package/dist/request/RequestValidator.js +1 -1
- package/dist/request/ScopeSet.js +1 -1
- package/dist/response/AuthenticationResult.d.ts +1 -0
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.js +14 -9
- package/dist/response/ResponseHandler.js.map +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +1 -0
- package/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.js +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +22 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.js +16 -1
- package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
- package/dist/url/UrlString.js +1 -1
- package/dist/utils/Constants.d.ts +7 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +12 -4
- package/dist/utils/Constants.js.map +1 -1
- package/dist/utils/ProtocolUtils.js +1 -1
- package/dist/utils/StringUtils.js +1 -1
- package/dist/utils/TimeUtils.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v6.
|
|
1
|
+
/*! @azure/msal-common v6.4.0 2022-06-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -136,7 +136,9 @@ var Constants = {
|
|
|
136
136
|
IMDS_TIMEOUT: 2000,
|
|
137
137
|
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
138
138
|
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
139
|
-
KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"]
|
|
139
|
+
KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
|
|
140
|
+
TOKEN_RESPONSE_TYPE: "token",
|
|
141
|
+
ID_TOKEN_RESPONSE_TYPE: "id_token"
|
|
140
142
|
};
|
|
141
143
|
var OIDC_DEFAULT_SCOPES = [
|
|
142
144
|
Constants.OPENID_SCOPE,
|
|
@@ -229,6 +231,7 @@ var AADServerParamKeys;
|
|
|
229
231
|
AADServerParamKeys["FOCI"] = "foci";
|
|
230
232
|
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
231
233
|
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
234
|
+
AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
|
|
232
235
|
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
233
236
|
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
234
237
|
/**
|
|
@@ -459,7 +462,12 @@ var CacheOutcome;
|
|
|
459
462
|
CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
|
|
460
463
|
CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
|
|
461
464
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
462
|
-
})(CacheOutcome || (CacheOutcome = {}));
|
|
465
|
+
})(CacheOutcome || (CacheOutcome = {}));
|
|
466
|
+
var JsonTypes;
|
|
467
|
+
(function (JsonTypes) {
|
|
468
|
+
JsonTypes["Jwt"] = "JWT";
|
|
469
|
+
JsonTypes["Jwk"] = "JWK";
|
|
470
|
+
})(JsonTypes || (JsonTypes = {}));
|
|
463
471
|
|
|
464
472
|
/*
|
|
465
473
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -764,6 +772,10 @@ var ClientAuthErrorMessage = {
|
|
|
764
772
|
logoutNotSupported: {
|
|
765
773
|
code: "end_session_endpoint_not_supported",
|
|
766
774
|
desc: "Provided authority does not support logout."
|
|
775
|
+
},
|
|
776
|
+
keyIdMissing: {
|
|
777
|
+
code: "key_id_missing",
|
|
778
|
+
desc: "A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key."
|
|
767
779
|
}
|
|
768
780
|
};
|
|
769
781
|
/**
|
|
@@ -1033,6 +1045,12 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1033
1045
|
ClientAuthError.createLogoutNotSupportedError = function () {
|
|
1034
1046
|
return new ClientAuthError(ClientAuthErrorMessage.logoutNotSupported.code, ClientAuthErrorMessage.logoutNotSupported.desc);
|
|
1035
1047
|
};
|
|
1048
|
+
/**
|
|
1049
|
+
* Create an error when kid attribute is missing from a PoP token's cache record
|
|
1050
|
+
*/
|
|
1051
|
+
ClientAuthError.createKeyIdMissingError = function () {
|
|
1052
|
+
return new ClientAuthError(ClientAuthErrorMessage.keyIdMissing.code, ClientAuthErrorMessage.keyIdMissing.desc);
|
|
1053
|
+
};
|
|
1036
1054
|
return ClientAuthError;
|
|
1037
1055
|
}(AuthError));
|
|
1038
1056
|
|
|
@@ -1339,7 +1357,7 @@ var Logger = /** @class */ (function () {
|
|
|
1339
1357
|
|
|
1340
1358
|
/* eslint-disable header/header */
|
|
1341
1359
|
var name = "@azure/msal-common";
|
|
1342
|
-
var version = "6.
|
|
1360
|
+
var version = "6.4.0";
|
|
1343
1361
|
|
|
1344
1362
|
/*
|
|
1345
1363
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2027,6 +2045,7 @@ exports.AuthorityType = void 0;
|
|
|
2027
2045
|
* lastModificationApp:
|
|
2028
2046
|
* oboAssertion: access token passed in as part of OBO request
|
|
2029
2047
|
* idTokenClaims: Object containing claims parsed from ID token
|
|
2048
|
+
* nativeAccountId: Account identifier on the native device
|
|
2030
2049
|
* }
|
|
2031
2050
|
*/
|
|
2032
2051
|
var AccountEntity = /** @class */ (function () {
|
|
@@ -2080,7 +2099,8 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2080
2099
|
username: this.username,
|
|
2081
2100
|
localAccountId: this.localAccountId,
|
|
2082
2101
|
name: this.name,
|
|
2083
|
-
idTokenClaims: this.idTokenClaims
|
|
2102
|
+
idTokenClaims: this.idTokenClaims,
|
|
2103
|
+
nativeAccountId: this.nativeAccountId
|
|
2084
2104
|
};
|
|
2085
2105
|
};
|
|
2086
2106
|
/**
|
|
@@ -2102,12 +2122,13 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2102
2122
|
* @param idToken
|
|
2103
2123
|
* @param policy
|
|
2104
2124
|
*/
|
|
2105
|
-
AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, oboAssertion, cloudGraphHostName, msGraphHost, environment) {
|
|
2125
|
+
AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, oboAssertion, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {
|
|
2106
2126
|
var _a, _b, _c, _d, _e, _f;
|
|
2107
2127
|
var account = new AccountEntity();
|
|
2108
2128
|
account.authorityType = exports.CacheAccountType.MSSTS_ACCOUNT_TYPE;
|
|
2109
2129
|
account.clientInfo = clientInfo;
|
|
2110
2130
|
account.homeAccountId = homeAccountId;
|
|
2131
|
+
account.nativeAccountId = nativeAccountId;
|
|
2111
2132
|
var env = environment || (authority && authority.getPreferredCache());
|
|
2112
2133
|
if (!env) {
|
|
2113
2134
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
@@ -2229,6 +2250,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2229
2250
|
(accountA.username === accountB.username) &&
|
|
2230
2251
|
(accountA.tenantId === accountB.tenantId) &&
|
|
2231
2252
|
(accountA.environment === accountB.environment) &&
|
|
2253
|
+
(accountA.nativeAccountId === accountB.nativeAccountId) &&
|
|
2232
2254
|
claimsMatch;
|
|
2233
2255
|
};
|
|
2234
2256
|
return AccountEntity;
|
|
@@ -2636,7 +2658,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2636
2658
|
});
|
|
2637
2659
|
};
|
|
2638
2660
|
/**
|
|
2639
|
-
*
|
|
2661
|
+
* Removes credentials associated with the provided account
|
|
2640
2662
|
* @param account
|
|
2641
2663
|
*/
|
|
2642
2664
|
CacheManager.prototype.removeAccountContext = function (account) {
|
|
@@ -3556,6 +3578,12 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3556
3578
|
RequestParameterBuilder.prototype.addResponseTypeCode = function () {
|
|
3557
3579
|
this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));
|
|
3558
3580
|
};
|
|
3581
|
+
/**
|
|
3582
|
+
* add response_type = token id_token
|
|
3583
|
+
*/
|
|
3584
|
+
RequestParameterBuilder.prototype.addResponseTypeForTokenAndIdToken = function () {
|
|
3585
|
+
this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.TOKEN_RESPONSE_TYPE + " " + Constants.ID_TOKEN_RESPONSE_TYPE));
|
|
3586
|
+
};
|
|
3559
3587
|
/**
|
|
3560
3588
|
* add response_mode. defaults to query.
|
|
3561
3589
|
* @param responseMode
|
|
@@ -3563,6 +3591,12 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3563
3591
|
RequestParameterBuilder.prototype.addResponseMode = function (responseMode) {
|
|
3564
3592
|
this.parameters.set(AADServerParamKeys.RESPONSE_MODE, encodeURIComponent((responseMode) ? responseMode : exports.ResponseMode.QUERY));
|
|
3565
3593
|
};
|
|
3594
|
+
/**
|
|
3595
|
+
* Add flag to indicate STS should attempt to use WAM if available
|
|
3596
|
+
*/
|
|
3597
|
+
RequestParameterBuilder.prototype.addNativeBroker = function () {
|
|
3598
|
+
this.parameters.set(AADServerParamKeys.NATIVE_BROKER, encodeURIComponent("1"));
|
|
3599
|
+
};
|
|
3566
3600
|
/**
|
|
3567
3601
|
* add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
|
|
3568
3602
|
* @param scopeSet
|
|
@@ -3841,14 +3875,14 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3841
3875
|
* @param username
|
|
3842
3876
|
*/
|
|
3843
3877
|
RequestParameterBuilder.prototype.addUsername = function (username) {
|
|
3844
|
-
this.parameters.set(PasswordGrantConstants.username, username);
|
|
3878
|
+
this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));
|
|
3845
3879
|
};
|
|
3846
3880
|
/**
|
|
3847
3881
|
* adds `password` for Password Grant flow
|
|
3848
3882
|
* @param password
|
|
3849
3883
|
*/
|
|
3850
3884
|
RequestParameterBuilder.prototype.addPassword = function (password) {
|
|
3851
|
-
this.parameters.set(PasswordGrantConstants.password, password);
|
|
3885
|
+
this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));
|
|
3852
3886
|
};
|
|
3853
3887
|
/**
|
|
3854
3888
|
* add pop_jwk to query params
|
|
@@ -4549,19 +4583,37 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4549
4583
|
function PopTokenGenerator(cryptoUtils) {
|
|
4550
4584
|
this.cryptoUtils = cryptoUtils;
|
|
4551
4585
|
}
|
|
4586
|
+
/**
|
|
4587
|
+
* Generates the req_cnf validated at the RP in the POP protocol for SHR parameters
|
|
4588
|
+
* and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash
|
|
4589
|
+
* @param request
|
|
4590
|
+
* @returns
|
|
4591
|
+
*/
|
|
4552
4592
|
PopTokenGenerator.prototype.generateCnf = function (request) {
|
|
4553
4593
|
return __awaiter(this, void 0, void 0, function () {
|
|
4554
|
-
var reqCnf;
|
|
4555
|
-
return __generator(this, function (
|
|
4556
|
-
switch (
|
|
4594
|
+
var reqCnf, reqCnfString, _a;
|
|
4595
|
+
return __generator(this, function (_b) {
|
|
4596
|
+
switch (_b.label) {
|
|
4557
4597
|
case 0: return [4 /*yield*/, this.generateKid(request)];
|
|
4558
4598
|
case 1:
|
|
4559
|
-
reqCnf =
|
|
4560
|
-
|
|
4599
|
+
reqCnf = _b.sent();
|
|
4600
|
+
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
4601
|
+
_a = {
|
|
4602
|
+
kid: reqCnf.kid,
|
|
4603
|
+
reqCnfString: reqCnfString
|
|
4604
|
+
};
|
|
4605
|
+
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
4606
|
+
case 2: return [2 /*return*/, (_a.reqCnfHash = _b.sent(),
|
|
4607
|
+
_a)];
|
|
4561
4608
|
}
|
|
4562
4609
|
});
|
|
4563
4610
|
});
|
|
4564
4611
|
};
|
|
4612
|
+
/**
|
|
4613
|
+
* Generates key_id for a SHR token request
|
|
4614
|
+
* @param request
|
|
4615
|
+
* @returns
|
|
4616
|
+
*/
|
|
4565
4617
|
PopTokenGenerator.prototype.generateKid = function (request) {
|
|
4566
4618
|
return __awaiter(this, void 0, void 0, function () {
|
|
4567
4619
|
var kidThumbprint;
|
|
@@ -4578,20 +4630,28 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4578
4630
|
});
|
|
4579
4631
|
});
|
|
4580
4632
|
};
|
|
4581
|
-
|
|
4582
|
-
|
|
4633
|
+
/**
|
|
4634
|
+
* Signs the POP access_token with the local generated key-pair
|
|
4635
|
+
* @param accessToken
|
|
4636
|
+
* @param request
|
|
4637
|
+
* @returns
|
|
4638
|
+
*/
|
|
4639
|
+
PopTokenGenerator.prototype.signPopToken = function (accessToken, keyId, request) {
|
|
4583
4640
|
return __awaiter(this, void 0, void 0, function () {
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
tokenClaims = AuthToken.extractTokenClaims(accessToken, this.cryptoUtils);
|
|
4587
|
-
if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {
|
|
4588
|
-
throw ClientAuthError.createTokenClaimsRequiredError();
|
|
4589
|
-
}
|
|
4590
|
-
return [2 /*return*/, this.signPayload(accessToken, tokenClaims.cnf.kid, request)];
|
|
4641
|
+
return __generator(this, function (_a) {
|
|
4642
|
+
return [2 /*return*/, this.signPayload(accessToken, keyId, request)];
|
|
4591
4643
|
});
|
|
4592
4644
|
});
|
|
4593
4645
|
};
|
|
4594
|
-
|
|
4646
|
+
/**
|
|
4647
|
+
* Utility function to generate the signed JWT for an access_token
|
|
4648
|
+
* @param payload
|
|
4649
|
+
* @param kid
|
|
4650
|
+
* @param request
|
|
4651
|
+
* @param claims
|
|
4652
|
+
* @returns
|
|
4653
|
+
*/
|
|
4654
|
+
PopTokenGenerator.prototype.signPayload = function (payload, keyId, request, claims) {
|
|
4595
4655
|
return __awaiter(this, void 0, void 0, function () {
|
|
4596
4656
|
var resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, resourceUrlString, resourceUrlComponents;
|
|
4597
4657
|
return __generator(this, function (_a) {
|
|
@@ -4600,7 +4660,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4600
4660
|
resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims, shrNonce = request.shrNonce;
|
|
4601
4661
|
resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;
|
|
4602
4662
|
resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();
|
|
4603
|
-
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims),
|
|
4663
|
+
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims), keyId, request.correlationId)];
|
|
4604
4664
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4605
4665
|
}
|
|
4606
4666
|
});
|
|
@@ -4919,9 +4979,9 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
4919
4979
|
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code) {
|
|
4920
4980
|
var _a, _b, _c;
|
|
4921
4981
|
return __awaiter(this, void 0, void 0, function () {
|
|
4922
|
-
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;
|
|
4923
|
-
return __generator(this, function (
|
|
4924
|
-
switch (
|
|
4982
|
+
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, _d, secret, keyId, uid, tid;
|
|
4983
|
+
return __generator(this, function (_e) {
|
|
4984
|
+
switch (_e.label) {
|
|
4925
4985
|
case 0:
|
|
4926
4986
|
accessToken = Constants.EMPTY_STRING;
|
|
4927
4987
|
responseScopes = [];
|
|
@@ -4930,18 +4990,22 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
4930
4990
|
if (!cacheRecord.accessToken) return [3 /*break*/, 4];
|
|
4931
4991
|
if (!(cacheRecord.accessToken.tokenType === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
4932
4992
|
popTokenGenerator = new PopTokenGenerator(cryptoObj);
|
|
4933
|
-
|
|
4993
|
+
_d = cacheRecord.accessToken, secret = _d.secret, keyId = _d.keyId;
|
|
4994
|
+
if (!keyId) {
|
|
4995
|
+
throw ClientAuthError.createKeyIdMissingError();
|
|
4996
|
+
}
|
|
4997
|
+
return [4 /*yield*/, popTokenGenerator.signPopToken(secret, keyId, request)];
|
|
4934
4998
|
case 1:
|
|
4935
|
-
accessToken =
|
|
4999
|
+
accessToken = _e.sent();
|
|
4936
5000
|
return [3 /*break*/, 3];
|
|
4937
5001
|
case 2:
|
|
4938
5002
|
accessToken = cacheRecord.accessToken.secret;
|
|
4939
|
-
|
|
5003
|
+
_e.label = 3;
|
|
4940
5004
|
case 3:
|
|
4941
5005
|
responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
|
|
4942
5006
|
expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
|
|
4943
5007
|
extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
|
|
4944
|
-
|
|
5008
|
+
_e.label = 4;
|
|
4945
5009
|
case 4:
|
|
4946
5010
|
if (cacheRecord.appMetadata) {
|
|
4947
5011
|
familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;
|
|
@@ -4966,7 +5030,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
4966
5030
|
state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,
|
|
4967
5031
|
cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
|
|
4968
5032
|
msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
|
|
4969
|
-
code: code
|
|
5033
|
+
code: code,
|
|
5034
|
+
fromNativeBroker: false
|
|
4970
5035
|
}];
|
|
4971
5036
|
}
|
|
4972
5037
|
});
|
|
@@ -5004,8 +5069,12 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5004
5069
|
return __awaiter(this, void 0, void 0, function () {
|
|
5005
5070
|
var queryString;
|
|
5006
5071
|
return __generator(this, function (_a) {
|
|
5007
|
-
|
|
5008
|
-
|
|
5072
|
+
switch (_a.label) {
|
|
5073
|
+
case 0: return [4 /*yield*/, this.createAuthCodeUrlQueryString(request)];
|
|
5074
|
+
case 1:
|
|
5075
|
+
queryString = _a.sent();
|
|
5076
|
+
return [2 /*return*/, UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString)];
|
|
5077
|
+
}
|
|
5009
5078
|
});
|
|
5010
5079
|
});
|
|
5011
5080
|
};
|
|
@@ -5136,7 +5205,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5136
5205
|
*/
|
|
5137
5206
|
AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
|
|
5138
5207
|
return __awaiter(this, void 0, void 0, function () {
|
|
5139
|
-
var parameterBuilder, clientAssertion, popTokenGenerator,
|
|
5208
|
+
var parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, correlationId, ccsCred, clientInfo, clientInfo;
|
|
5140
5209
|
var _a;
|
|
5141
5210
|
return __generator(this, function (_b) {
|
|
5142
5211
|
switch (_b.label) {
|
|
@@ -5173,8 +5242,8 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5173
5242
|
if (this.config.clientCredentials.clientSecret) {
|
|
5174
5243
|
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
5175
5244
|
}
|
|
5176
|
-
|
|
5177
|
-
|
|
5245
|
+
clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;
|
|
5246
|
+
if (clientAssertion) {
|
|
5178
5247
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
5179
5248
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
5180
5249
|
}
|
|
@@ -5184,8 +5253,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5184
5253
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5185
5254
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5186
5255
|
case 1:
|
|
5187
|
-
|
|
5188
|
-
|
|
5256
|
+
reqCnfData = _b.sent();
|
|
5257
|
+
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5258
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5189
5259
|
return [3 /*break*/, 3];
|
|
5190
5260
|
case 2:
|
|
5191
5261
|
if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
@@ -5255,96 +5325,113 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5255
5325
|
* @param request
|
|
5256
5326
|
*/
|
|
5257
5327
|
AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5328
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5329
|
+
var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
|
|
5330
|
+
return __generator(this, function (_a) {
|
|
5331
|
+
switch (_a.label) {
|
|
5332
|
+
case 0:
|
|
5333
|
+
parameterBuilder = new RequestParameterBuilder();
|
|
5334
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5335
|
+
requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);
|
|
5336
|
+
parameterBuilder.addScopes(requestScopes);
|
|
5337
|
+
// validate the redirectUri (to be a non null value)
|
|
5338
|
+
parameterBuilder.addRedirectUri(request.redirectUri);
|
|
5339
|
+
correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
5340
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
5341
|
+
// add response_mode. If not passed in it defaults to query.
|
|
5342
|
+
parameterBuilder.addResponseMode(request.responseMode);
|
|
5343
|
+
// add response_type = code
|
|
5344
|
+
parameterBuilder.addResponseTypeCode();
|
|
5345
|
+
// add library info parameters
|
|
5346
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5347
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5348
|
+
// add client_info=1
|
|
5349
|
+
parameterBuilder.addClientInfo();
|
|
5350
|
+
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
5351
|
+
parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);
|
|
5352
|
+
}
|
|
5353
|
+
if (request.prompt) {
|
|
5354
|
+
parameterBuilder.addPrompt(request.prompt);
|
|
5355
|
+
}
|
|
5356
|
+
if (request.domainHint) {
|
|
5357
|
+
parameterBuilder.addDomainHint(request.domainHint);
|
|
5358
|
+
}
|
|
5359
|
+
// Add sid or loginHint with preference for sid -> loginHint -> username of AccountInfo object
|
|
5360
|
+
if (request.prompt !== PromptValue.SELECT_ACCOUNT) {
|
|
5361
|
+
// AAD will throw if prompt=select_account is passed with an account hint
|
|
5362
|
+
if (request.sid && request.prompt === PromptValue.NONE) {
|
|
5363
|
+
// SessionID is only used in silent calls
|
|
5364
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request");
|
|
5365
|
+
parameterBuilder.addSid(request.sid);
|
|
5366
|
+
}
|
|
5367
|
+
else if (request.account) {
|
|
5368
|
+
accountSid = this.extractAccountSid(request.account);
|
|
5369
|
+
// If account and loginHint are provided, we will check account first for sid before adding loginHint
|
|
5370
|
+
if (accountSid && request.prompt === PromptValue.NONE) {
|
|
5371
|
+
// SessionId is only used in silent calls
|
|
5372
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account");
|
|
5373
|
+
parameterBuilder.addSid(accountSid);
|
|
5374
|
+
try {
|
|
5375
|
+
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
5376
|
+
parameterBuilder.addCcsOid(clientInfo);
|
|
5377
|
+
}
|
|
5378
|
+
catch (e) {
|
|
5379
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
else if (request.loginHint) {
|
|
5383
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request");
|
|
5384
|
+
parameterBuilder.addLoginHint(request.loginHint);
|
|
5385
|
+
parameterBuilder.addCcsUpn(request.loginHint);
|
|
5386
|
+
}
|
|
5387
|
+
else if (request.account.username) {
|
|
5388
|
+
// Fallback to account username if provided
|
|
5389
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
5390
|
+
parameterBuilder.addLoginHint(request.account.username);
|
|
5391
|
+
try {
|
|
5392
|
+
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
5393
|
+
parameterBuilder.addCcsOid(clientInfo);
|
|
5394
|
+
}
|
|
5395
|
+
catch (e) {
|
|
5396
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
5397
|
+
}
|
|
5398
|
+
}
|
|
5399
|
+
}
|
|
5400
|
+
else if (request.loginHint) {
|
|
5401
|
+
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
5402
|
+
parameterBuilder.addLoginHint(request.loginHint);
|
|
5403
|
+
parameterBuilder.addCcsUpn(request.loginHint);
|
|
5404
|
+
}
|
|
5405
|
+
}
|
|
5406
|
+
else {
|
|
5407
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
5408
|
+
}
|
|
5409
|
+
if (request.nonce) {
|
|
5410
|
+
parameterBuilder.addNonce(request.nonce);
|
|
5411
|
+
}
|
|
5412
|
+
if (request.state) {
|
|
5413
|
+
parameterBuilder.addState(request.state);
|
|
5414
|
+
}
|
|
5415
|
+
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
5416
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
5417
|
+
}
|
|
5418
|
+
if (request.extraQueryParameters) {
|
|
5419
|
+
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5420
|
+
}
|
|
5421
|
+
if (!request.nativeBroker) return [3 /*break*/, 2];
|
|
5422
|
+
// signal ests that this is a WAM call
|
|
5423
|
+
parameterBuilder.addNativeBroker();
|
|
5424
|
+
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5425
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5426
|
+
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5427
|
+
case 1:
|
|
5428
|
+
reqCnfData = _a.sent();
|
|
5429
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
|
|
5430
|
+
_a.label = 2;
|
|
5431
|
+
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5324
5432
|
}
|
|
5325
|
-
}
|
|
5326
|
-
|
|
5327
|
-
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
5328
|
-
parameterBuilder.addLoginHint(request.loginHint);
|
|
5329
|
-
parameterBuilder.addCcsUpn(request.loginHint);
|
|
5330
|
-
}
|
|
5331
|
-
}
|
|
5332
|
-
else {
|
|
5333
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
5334
|
-
}
|
|
5335
|
-
if (request.nonce) {
|
|
5336
|
-
parameterBuilder.addNonce(request.nonce);
|
|
5337
|
-
}
|
|
5338
|
-
if (request.state) {
|
|
5339
|
-
parameterBuilder.addState(request.state);
|
|
5340
|
-
}
|
|
5341
|
-
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
5342
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
5343
|
-
}
|
|
5344
|
-
if (request.extraQueryParameters) {
|
|
5345
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5346
|
-
}
|
|
5347
|
-
return parameterBuilder.createQueryString();
|
|
5433
|
+
});
|
|
5434
|
+
});
|
|
5348
5435
|
};
|
|
5349
5436
|
/**
|
|
5350
5437
|
* This API validates the `EndSessionRequest` and creates a URL
|
|
@@ -5738,7 +5825,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5738
5825
|
*/
|
|
5739
5826
|
RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
|
|
5740
5827
|
return __awaiter(this, void 0, void 0, function () {
|
|
5741
|
-
var parameterBuilder, correlationId, clientAssertion, popTokenGenerator,
|
|
5828
|
+
var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
|
|
5742
5829
|
return __generator(this, function (_a) {
|
|
5743
5830
|
switch (_a.label) {
|
|
5744
5831
|
case 0:
|
|
@@ -5759,8 +5846,8 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5759
5846
|
if (this.config.clientCredentials.clientSecret) {
|
|
5760
5847
|
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
5761
5848
|
}
|
|
5762
|
-
|
|
5763
|
-
|
|
5849
|
+
clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;
|
|
5850
|
+
if (clientAssertion) {
|
|
5764
5851
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
5765
5852
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
5766
5853
|
}
|
|
@@ -5768,8 +5855,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5768
5855
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5769
5856
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5770
5857
|
case 1:
|
|
5771
|
-
|
|
5772
|
-
|
|
5858
|
+
reqCnfData = _a.sent();
|
|
5859
|
+
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5860
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5773
5861
|
return [3 /*break*/, 3];
|
|
5774
5862
|
case 2:
|
|
5775
5863
|
if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
@@ -5958,8 +6046,9 @@ var ClientCredentialClient = /** @class */ (function (_super) {
|
|
|
5958
6046
|
if (this.config.clientCredentials.clientSecret) {
|
|
5959
6047
|
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
5960
6048
|
}
|
|
5961
|
-
|
|
5962
|
-
|
|
6049
|
+
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
6050
|
+
var clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;
|
|
6051
|
+
if (clientAssertion) {
|
|
5963
6052
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
5964
6053
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
5965
6054
|
}
|
|
@@ -6163,8 +6252,9 @@ var OnBehalfOfClient = /** @class */ (function (_super) {
|
|
|
6163
6252
|
if (this.config.clientCredentials.clientSecret) {
|
|
6164
6253
|
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
6165
6254
|
}
|
|
6166
|
-
|
|
6167
|
-
|
|
6255
|
+
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
6256
|
+
var clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;
|
|
6257
|
+
if (clientAssertion) {
|
|
6168
6258
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
6169
6259
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6170
6260
|
}
|
|
@@ -6364,6 +6454,7 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
|
|
|
6364
6454
|
parameterBuilder.addUsername(request.username);
|
|
6365
6455
|
parameterBuilder.addPassword(request.password);
|
|
6366
6456
|
parameterBuilder.addScopes(request.scopes);
|
|
6457
|
+
parameterBuilder.addResponseTypeForTokenAndIdToken();
|
|
6367
6458
|
parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);
|
|
6368
6459
|
parameterBuilder.addClientInfo();
|
|
6369
6460
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
@@ -6377,8 +6468,9 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
|
|
|
6377
6468
|
if (this.config.clientCredentials.clientSecret) {
|
|
6378
6469
|
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
6379
6470
|
}
|
|
6380
|
-
|
|
6381
|
-
|
|
6471
|
+
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
6472
|
+
var clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;
|
|
6473
|
+
if (clientAssertion) {
|
|
6382
6474
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
6383
6475
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6384
6476
|
}
|
|
@@ -7335,6 +7427,87 @@ var StubbedNetworkModule = {
|
|
|
7335
7427
|
}
|
|
7336
7428
|
};
|
|
7337
7429
|
|
|
7430
|
+
/*
|
|
7431
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7432
|
+
* Licensed under the MIT License.
|
|
7433
|
+
*/
|
|
7434
|
+
/**
|
|
7435
|
+
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
7436
|
+
*/
|
|
7437
|
+
var JoseHeaderErrorMessage = {
|
|
7438
|
+
missingKidError: {
|
|
7439
|
+
code: "missing_kid_error",
|
|
7440
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided."
|
|
7441
|
+
},
|
|
7442
|
+
missingAlgError: {
|
|
7443
|
+
code: "missing_alg_error",
|
|
7444
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."
|
|
7445
|
+
},
|
|
7446
|
+
};
|
|
7447
|
+
/**
|
|
7448
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
7449
|
+
*/
|
|
7450
|
+
var JoseHeaderError = /** @class */ (function (_super) {
|
|
7451
|
+
__extends(JoseHeaderError, _super);
|
|
7452
|
+
function JoseHeaderError(errorCode, errorMessage) {
|
|
7453
|
+
var _this = _super.call(this, errorCode, errorMessage) || this;
|
|
7454
|
+
_this.name = "JoseHeaderError";
|
|
7455
|
+
Object.setPrototypeOf(_this, JoseHeaderError.prototype);
|
|
7456
|
+
return _this;
|
|
7457
|
+
}
|
|
7458
|
+
/**
|
|
7459
|
+
* Creates an error thrown when keyId isn't set on JOSE header.
|
|
7460
|
+
*/
|
|
7461
|
+
JoseHeaderError.createMissingKidError = function () {
|
|
7462
|
+
return new JoseHeaderError(JoseHeaderErrorMessage.missingKidError.code, JoseHeaderErrorMessage.missingKidError.desc);
|
|
7463
|
+
};
|
|
7464
|
+
/**
|
|
7465
|
+
* Creates an error thrown when algorithm isn't set on JOSE header.
|
|
7466
|
+
*/
|
|
7467
|
+
JoseHeaderError.createMissingAlgError = function () {
|
|
7468
|
+
return new JoseHeaderError(JoseHeaderErrorMessage.missingAlgError.code, JoseHeaderErrorMessage.missingAlgError.desc);
|
|
7469
|
+
};
|
|
7470
|
+
return JoseHeaderError;
|
|
7471
|
+
}(AuthError));
|
|
7472
|
+
|
|
7473
|
+
/*
|
|
7474
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7475
|
+
* Licensed under the MIT License.
|
|
7476
|
+
*/
|
|
7477
|
+
var JoseHeader = /** @class */ (function () {
|
|
7478
|
+
function JoseHeader(options) {
|
|
7479
|
+
this.typ = options.typ;
|
|
7480
|
+
this.alg = options.alg;
|
|
7481
|
+
this.kid = options.kid;
|
|
7482
|
+
}
|
|
7483
|
+
/**
|
|
7484
|
+
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
7485
|
+
* JOSE Header options provided or previously set on the object and returns
|
|
7486
|
+
* the stringified header object.
|
|
7487
|
+
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
7488
|
+
* @param shrHeaderOptions
|
|
7489
|
+
* @returns
|
|
7490
|
+
*/
|
|
7491
|
+
JoseHeader.getShrHeaderString = function (shrHeaderOptions) {
|
|
7492
|
+
// KeyID is required on the SHR header
|
|
7493
|
+
if (!shrHeaderOptions.kid) {
|
|
7494
|
+
throw JoseHeaderError.createMissingKidError();
|
|
7495
|
+
}
|
|
7496
|
+
// Alg is required on the SHR header
|
|
7497
|
+
if (!shrHeaderOptions.alg) {
|
|
7498
|
+
throw JoseHeaderError.createMissingAlgError();
|
|
7499
|
+
}
|
|
7500
|
+
var shrHeader = new JoseHeader({
|
|
7501
|
+
// Access Token PoP headers must have type JWT, but the type header can be overriden for special cases
|
|
7502
|
+
typ: shrHeaderOptions.typ || JsonTypes.Jwt,
|
|
7503
|
+
kid: shrHeaderOptions.kid,
|
|
7504
|
+
alg: shrHeaderOptions.alg
|
|
7505
|
+
});
|
|
7506
|
+
return JSON.stringify(shrHeader);
|
|
7507
|
+
};
|
|
7508
|
+
return JoseHeader;
|
|
7509
|
+
}());
|
|
7510
|
+
|
|
7338
7511
|
/*
|
|
7339
7512
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7340
7513
|
* Licensed under the MIT License.
|
|
@@ -7584,6 +7757,11 @@ exports.PerformanceEvents = void 0;
|
|
|
7584
7757
|
* Internal API for acquireTokenSilent.
|
|
7585
7758
|
*/
|
|
7586
7759
|
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
7760
|
+
/**
|
|
7761
|
+
* acquireTokenPopup (msal-browser).
|
|
7762
|
+
* Used to acquire a new access token interactively through pop ups
|
|
7763
|
+
*/
|
|
7764
|
+
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
|
|
7587
7765
|
/**
|
|
7588
7766
|
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
7589
7767
|
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
@@ -7619,6 +7797,16 @@ exports.PerformanceEvents = void 0;
|
|
|
7619
7797
|
* Used to load authority metadata for a request.
|
|
7620
7798
|
*/
|
|
7621
7799
|
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
7800
|
+
/**
|
|
7801
|
+
* acquireToken APIs in msal-browser.
|
|
7802
|
+
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
7803
|
+
*/
|
|
7804
|
+
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
|
|
7805
|
+
/**
|
|
7806
|
+
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
7807
|
+
* Used to acquire a token from Native component when native brokering is enabled.
|
|
7808
|
+
*/
|
|
7809
|
+
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
7622
7810
|
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
7623
7811
|
/**
|
|
7624
7812
|
* State of the performance event.
|
|
@@ -7958,6 +8146,7 @@ exports.IdToken = AuthToken;
|
|
|
7958
8146
|
exports.IdTokenEntity = IdTokenEntity;
|
|
7959
8147
|
exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
|
|
7960
8148
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
8149
|
+
exports.JoseHeader = JoseHeader;
|
|
7961
8150
|
exports.Logger = Logger;
|
|
7962
8151
|
exports.NetworkManager = NetworkManager;
|
|
7963
8152
|
exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
|