Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
fix bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hsimah committed Mar 1, 2020
1 parent 0cb2df5 commit 43bf691
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
1 change: 0 additions & 1 deletion lib/metadata.js
Expand Up @@ -103,7 +103,6 @@ Metadata.prototype.updateOidcMetadata = function updateOidcMetadata(doc, next) {
}

// fetch the signing keys

request.get({ uri: jwksUri, agent: self.httpsProxyAgent, json: true }, (err, response, body) => {
if (err) {
return next(err);
Expand Down
23 changes: 7 additions & 16 deletions lib/oidcstrategy.js
Expand Up @@ -604,12 +604,11 @@ Strategy.prototype.authenticate = function authenticateStrategy(req, options) {
var extraAuthReqQueryParams = options && options.extraAuthReqQueryParams;
var extraTokenReqQueryParams = options && options.extraTokenReqQueryParams;
var response = options && options.response || req.res;
var proxy = options && options.proxy;

// 'params': items we get from the request or metadata, such as id_token, code, policy, metadata, cacheKey, etc
var params = { 'proxy': proxy, 'tenantIdOrName': tenantIdOrName, 'extraAuthReqQueryParams': extraAuthReqQueryParams, 'extraTokenReqQueryParams': extraTokenReqQueryParams };
var params = { 'proxy': self._options.proxy, 'tenantIdOrName': tenantIdOrName, 'extraAuthReqQueryParams': extraAuthReqQueryParams, 'extraTokenReqQueryParams': extraTokenReqQueryParams };
// 'oauthConfig': items needed for oauth flow (like redirection, code redemption), such as token_endpoint, userinfo_endpoint, etc
var oauthConfig = { 'proxy': proxy, 'resource': resource, 'customState': customState, 'domain_hint': domain_hint, 'login_hint': login_hint, 'prompt': prompt, 'response': response };
var oauthConfig = { 'proxy': self._options.proxy, 'resource': resource, 'customState': customState, 'domain_hint': domain_hint, 'login_hint': login_hint, 'prompt': prompt, 'response': response };
// 'optionsToValidate': items we need to validate id_token against, such as issuer, audience, etc
var optionsToValidate = {};

Expand Down Expand Up @@ -1421,12 +1420,7 @@ Strategy.prototype._flowInitializationHandler = function flowInitializationHandl
params[aadutils.getLibraryProductParameterName()] = aadutils.getLibraryProduct();
params[aadutils.getLibraryVersionParameterName()] = aadutils.getLibraryVersion();

// Implement support for standard OpenID Connect params (display, prompt, etc.)
const separator = self._options.isB2C ? '&' : '?';
const location = [
oauthConfig.authorization_endpoint,
querystring.stringify(params)
].join(separator);
const location = aadutils.concatUrl(oauthConfig.authorization_endpoint, querystring.stringify(params));

return self.redirect(location);
};
Expand Down Expand Up @@ -1504,7 +1498,7 @@ Strategy.prototype._getAccessTokenBySecretOrAssertion = function getAccessTokenB
*
* @params {String} message
*/
Strategy.prototype.failWithLog = function (message) {
Strategy.prototype.failWithLog = function(message) {
this.log.info(`authentication failed due to: ${message}`);
return this.fail(message);
};
Expand All @@ -1514,7 +1508,7 @@ Strategy.prototype.failWithLog = function (message) {
*
* @params {Object} oauthConfig
*/
var createOauth2Instance = function (oauthConfig) {
var createOauth2Instance = function(oauthConfig) {
let libraryVersion = aadutils.getLibraryVersion();
let libraryVersionParameterName = aadutils.getLibraryVersionParameterName();
let libraryProduct = aadutils.getLibraryProduct();
Expand All @@ -1526,18 +1520,15 @@ var createOauth2Instance = function (oauthConfig) {
'', // baseURL (empty string because we use absolute urls for authorize and token paths)
oauthConfig.authorization_endpoint, // authorizePath
oauthConfig.token_endpoint, // accessTokenPath
{
libraryProductParameterName: libraryProduct,
libraryVersionParameterName: libraryVersion
} // customHeaders
{libraryProductParameterName : libraryProduct,
libraryVersionParameterName : libraryVersion} // customHeaders
);

if (oauthConfig.proxy) {
// if user has specified proxy settings instantiate agent
oauth2.setAgent(new HttpsProxyAgent(oauthConfig.proxy));
}


return oauth2;
};

Expand Down

0 comments on commit 43bf691

Please sign in to comment.