adding subject to users

This commit is contained in:
Manuel Romero
2022-06-29 10:30:49 +02:00
parent 1e450bf019
commit a4bc5e4e7b
2 changed files with 5 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ const userSchema = new mongoose.Schema({
},
displayName: String,
upn: String,
sub: String,
oid: {
type: String,
index: true

View File

@@ -91,7 +91,7 @@ passport.use(new OIDCStrategy({
//console.log("refreshToken", refreshToken);
//console.log("jwtClaims", jwtClaims);
//console.log("params", params);
console.log(`Passport# new login from: ${profile.upn} (${profile.displayName})` );
console.log(`Passport# new login from: ${profile.upn} (${profile.displayName}) - sub: ${sub}` );
//Save user photo
axios({
@@ -117,11 +117,12 @@ passport.use(new OIDCStrategy({
"oid": profile.oid,
"upn": profile.upn,
"displayName": profile.displayName,
"lastLogin": new Date()
"lastLogin": new Date(),
"sub": sub
});
return done(null, user);
}
db.user.update(user._id, {"lastLogin": new Date()});
db.user.update(user._id, {"lastLogin": new Date(), "sub": sub});
return done(null, user);
});
});