Logout
This commit is contained in:
parent
40f14ff491
commit
bd8289828a
3 changed files with 36 additions and 9 deletions
32
library.js
32
library.js
|
|
@ -9,7 +9,8 @@
|
|||
fs = module.parent.require('fs'),
|
||||
path = module.parent.require('path'),
|
||||
nconf = module.parent.require('nconf'),
|
||||
async = module.parent.require('async');
|
||||
async = module.parent.require('async'),
|
||||
winston = require('winston');
|
||||
|
||||
var constants = Object.freeze({
|
||||
'name': "SAML",
|
||||
|
|
@ -94,6 +95,30 @@
|
|||
}
|
||||
|
||||
);
|
||||
|
||||
if (meta.config['sso:saml:logouturl']) {
|
||||
|
||||
app.get(meta.config['sso:saml:logouturl'],function(req,res){
|
||||
if (req.user && parseInt(req.user.uid, 10) > 0) {
|
||||
winston.info('[Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')');
|
||||
|
||||
var ws = module.parent.require('./socket.io');
|
||||
ws.logoutUser(req.user.uid);
|
||||
|
||||
req.logout();
|
||||
|
||||
if (meta.config['sso:saml:logoutredirecturl']){
|
||||
res.redirect(meta.config['sso:saml:logoutredirecturl']);
|
||||
}
|
||||
else{
|
||||
res.redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
callback();
|
||||
|
|
@ -131,12 +156,7 @@
|
|||
});
|
||||
}
|
||||
else {
|
||||
console.log({
|
||||
username: userdata.username,
|
||||
email: userdata.email,
|
||||
fullname : userdata.cn + " " + userdata.sn
|
||||
|
||||
});
|
||||
// New User
|
||||
user.create({
|
||||
username: userdata.username,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nodebb-plugin-sso-saml",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.4",
|
||||
"description": "NodeBB SAML SSO",
|
||||
"main": "library.js",
|
||||
"repository": {
|
||||
|
|
@ -27,7 +27,8 @@
|
|||
"readme": "# NodeBB SAML SSO\n\nNodeBB Plugin that allows users to login/register via a account.\n\n## Installation\n\n npm install nodebb-plugin-sso-saml\n",
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"passport-saml": "~0.5.3"
|
||||
"passport-saml": "~0.5.3",
|
||||
"winston" : "0.8.1"
|
||||
},
|
||||
"homepage": "https://github.com/GeographicaGS/nodebb-plugin-sso-saml.git",
|
||||
"_id": "nodebb-plugin-sso-saml@0.0.2"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@
|
|||
<br/>
|
||||
<input type="text" data-field="sso:saml:loginsuccessredirecturl" title="URL to redirect after a successfull login" class="form-control input-md" placeholder="URL to redirect after a successfull login. Leave empty to redirect to /. ">
|
||||
|
||||
<br/>
|
||||
<input type="text" data-field="sso:saml:logouturl" title="Logout URL" class="form-control input-md" placeholder="Logout URL ">
|
||||
|
||||
<br/>
|
||||
<input type="text" data-field="sso:saml:logoutredirecturl" title="Logout redirect URL" class="form-control input-md" placeholder="Logout redirect URL">
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue