Skip to content

Commit

Permalink
Small rework of verify hijack (#1707)
Browse files Browse the repository at this point in the history
* Too many nested if/else's makes it highly unreadable between OAuth and OpenID i.e. easier commit history searching. Been thinking about doing this since removal commit... doing it.
* Probable location to add `aToken` to  which is actually `aAccessToken` in dep README's. Possible location could be `aReq.session.accessToken` Applies to #1705

Post #889 #564

Auto-merge
  • Loading branch information
Martii authored Feb 6, 2020
1 parent 4badd2e commit 085dc9e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,25 @@ exports.callback = function (aReq, aRes, aNext) {
// Hijack the private verify method so we can mess stuff up freely
// We use this library for things it was never intended to do
if (openIdStrategies[strategy]) {
if (strategy === 'steam') {
strategyInstance._verify = function (aIgnore, aId, aDone) {
verifyPassport(aId, strategy, username, aReq.session.user, aDone);
};
} else {
strategyInstance._verify = function (aId, aDone) {
verifyPassport(aId, strategy, username, aReq.session.user, aDone);
};
switch(strategy) {
case 'steam':
strategyInstance._verify = function (aIgnore, aId, aDone) {
verifyPassport(aId, strategy, username, aReq.session.user, aDone);
};
break;
default:
strategyInstance._verify = function (aId, aDone) {
verifyPassport(aId, strategy, username, aReq.session.user, aDone);
};
}
} else {
strategyInstance._verify =
function (aToken, aRefreshOrSecretToken, aProfile, aDone) {
aReq.session.profile = aProfile;
verifyPassport(aProfile.id, strategy, username, aReq.session.user, aDone);
};
switch(strategy) {
default:
strategyInstance._verify = function (aToken, aRefreshOrSecretToken, aProfile, aDone) {
aReq.session.profile = aProfile;
verifyPassport(aProfile.id, strategy, username, aReq.session.user, aDone);
};
}
}

// This callback will happen after the verify routine
Expand Down

0 comments on commit 085dc9e

Please sign in to comment.