Logout
This commit is contained in:
parent
40f14ff491
commit
bd8289828a
3 changed files with 36 additions and 9 deletions
34
library.js
34
library.js
|
|
@ -9,7 +9,8 @@
|
||||||
fs = module.parent.require('fs'),
|
fs = module.parent.require('fs'),
|
||||||
path = module.parent.require('path'),
|
path = module.parent.require('path'),
|
||||||
nconf = module.parent.require('nconf'),
|
nconf = module.parent.require('nconf'),
|
||||||
async = module.parent.require('async');
|
async = module.parent.require('async'),
|
||||||
|
winston = require('winston');
|
||||||
|
|
||||||
var constants = Object.freeze({
|
var constants = Object.freeze({
|
||||||
'name': "SAML",
|
'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();
|
callback();
|
||||||
|
|
@ -131,12 +156,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log({
|
|
||||||
username: userdata.username,
|
|
||||||
email: userdata.email,
|
|
||||||
fullname : userdata.cn + " " + userdata.sn
|
|
||||||
|
|
||||||
});
|
|
||||||
// New User
|
// New User
|
||||||
user.create({
|
user.create({
|
||||||
username: userdata.username,
|
username: userdata.username,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "nodebb-plugin-sso-saml",
|
"name": "nodebb-plugin-sso-saml",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "NodeBB SAML SSO",
|
"description": "NodeBB SAML SSO",
|
||||||
"main": "library.js",
|
"main": "library.js",
|
||||||
"repository": {
|
"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",
|
"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",
|
"readmeFilename": "README.md",
|
||||||
"dependencies": {
|
"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",
|
"homepage": "https://github.com/GeographicaGS/nodebb-plugin-sso-saml.git",
|
||||||
"_id": "nodebb-plugin-sso-saml@0.0.2"
|
"_id": "nodebb-plugin-sso-saml@0.0.2"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,12 @@
|
||||||
<br/>
|
<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 /. ">
|
<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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue