зеркало из
1
0
Форкнуть 0
This commit is contained in:
Jeff Wilcox 2016-07-27 09:06:45 -07:00
Родитель b97d3905b2
Коммит cca50e198f
4 изменённых файлов: 12 добавлений и 16 удалений

Просмотреть файл

@ -94,8 +94,6 @@ module.exports = function configurePassport(app, passport, initialConfig) {
if (clone === undefined) {
clone = shallowTruncatingCopy(req.user);
}
console.log('resaving hoist');
console.dir(clone);
req.login(clone, callback);
}

Просмотреть файл

@ -87,8 +87,8 @@ OpenSourceUserContext.prototype.setPropertiesFromLink = function (link, callback
this.entities.link = link;
this.displayNames.azure = link.aadname;
this.avatars.github = link.ghavatar;
this.tokens.github = link.gitHubToken;
this.tokens.githubIncreasedScope = link.gitHubTokenIncreasedScope;
this.tokens.github = link.githubToken;
this.tokens.githubIncreasedScope = link.githubTokenIncreasedScope;
var modernUser = this.modernUser();
if (!modernUser && this.id.github) {
modernUser = this.createModernUser(this.id.github, this.usernames.github);

Просмотреть файл

@ -19,7 +19,6 @@ router.use(function (req, res, next) {
if (req.isAuthenticated()) {
var expectedAuthenticationProperty = config.authentication.scheme === 'github' ? 'github' : 'azure';
if (req.user && !req.user[expectedAuthenticationProperty]) {
console.dir(req.user);
console.warn(`A user session was authenticated but did not have present the property "${expectedAuthenticationProperty}" expected for this type of authentication. Signing them out.`);
return res.redirect('/signout');
}
@ -75,10 +74,10 @@ router.use((req, res, next) => {
github: {
username: 'ghu',
avatarUrl: 'ghavatar',
accessToken: 'gitHubToken',
accessToken: 'githubToken',
},
githubIncreasedScope: {
accessToken: 'gitHubTokenIncreasedScope',
accessToken: 'githubTokenIncreasedScope',
},
azure: {
displayName: 'aadname',
@ -96,15 +95,15 @@ router.use((req, res, next) => {
}
}
if (updatedProperties.has('github.accessToken')) {
linkUpdates.gitHubTokenUpdated = new Date().getTime();
linkUpdates.githubTokenUpdated = new Date().getTime();
}
if (updatedProperties.has('githubIncreasedScope.accessToken')) {
linkUpdates.githubTokenIncreasedScopeUpdated = new Date().getTime();
}
// ? githubIncreasedScope.accessToken
if (Object.keys(linkUpdates).length === 0) {
return next();
}
console.dir(linkUpdates);
utils.merge(link, linkUpdates);
console.dir(link);
req.oss.modernUser().updateLink(link, (mergeError /*, mergedLink*/) => {
if (mergeError) {
return next(mergeError);
@ -121,7 +120,7 @@ router.use((req, res, next) => {
router.use((req, res, next) => {
if (req.app.settings.runtimeConfig.authentication.scheme === 'aad' && req.oss && req.oss.modernUser()) {
var link = req.oss.modernUser().link;
if (link && !link.gitHubToken) {
if (link && !link.githubToken) {
return utils.storeOriginalUrlAsReferrer(req, res, '/link/reconnect');
}
}

Просмотреть файл

@ -79,8 +79,7 @@ router.get('/express', function (req, res, next) {
} else if (req.user.githubIncreasedScope && req.user.githubIncreasedScope.accessToken) {
joinOrg(req, res, next);
} else {
next(new Error('damn'));
// utils.storeOriginalUrlAsReferrer(req, res, '/auth/github/increased-scope');
utils.storeOriginalUrlAsReferrer(req, res, '/auth/github/increased-scope');
}
});
});