working saml attributes
This commit is contained in:
parent
33865b9d02
commit
6a1c484356
2 changed files with 19 additions and 4 deletions
|
|
@ -24,9 +24,10 @@ passport.use(
|
|||
console.log("profile", profile);
|
||||
let user = profile["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"];
|
||||
return done(null, {
|
||||
upn: profile["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"],
|
||||
// e.g. if you added a Group claim
|
||||
group: profile["http://schemas.xmlsoap.org/claims/Group"],
|
||||
username: profile["username"],
|
||||
first_name: profile["first_name"],
|
||||
last_name: profile["last_name"],
|
||||
org_unit: profile["org_unit"],
|
||||
});
|
||||
}
|
||||
)
|
||||
|
|
|
|||
16
index.js
16
index.js
|
|
@ -23,11 +23,25 @@ app.use(express.json());
|
|||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('Hello World!<br><a href="/login">Login</a>');
|
||||
response = 'Hello World!<br>';
|
||||
console.log('User:', req.user);
|
||||
if (req.user) {
|
||||
console.log('User:', req.user);
|
||||
response += 'Username: ' + req.user.username + '<br>';
|
||||
response += 'First Name: ' + req.user.first_name + '<br>';
|
||||
response += 'Last Name: ' + req.user.last_name + '<br>';
|
||||
response += 'Org Unit: ' + req.user.org_unit + '<br>';
|
||||
response += '<a href="/logout">Logout</a>';
|
||||
}
|
||||
else {
|
||||
response += '<a href="/login">Login</a>';
|
||||
}
|
||||
res.send(response);
|
||||
});
|
||||
|
||||
app.get('/logout', function (req, res) {
|
||||
req.logout();
|
||||
res.redirect('/');
|
||||
});
|
||||
|
||||
app.get('/login',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue