From 8ef5b11a2b056d4864614d59a99c98e376de8e3b Mon Sep 17 00:00:00 2001 From: Vineeth-Mohan Date: Wed, 6 Aug 2014 22:53:57 +0530 Subject: [PATCH] Adding logout feature --- lib/cas-auth.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/cas-auth.js b/lib/cas-auth.js index 8b3d786..1263385 100644 --- a/lib/cas-auth.js +++ b/lib/cas-auth.js @@ -23,6 +23,14 @@ exports.configureCas = function(express, app, config) { config.cas_server_url = config.cas_server_url.replace(/\s+$/,''); + + app.get('/auth/cas/logout', function (req, res) { + var logoutUrl = config.cas_server_url + '/logout'; + delete req.session['cas_user_name']; + res.redirect(logoutUrl); + }); + + app.get('/auth/cas/login', function (req, res) { var service_url = req.protocol + "://" + req.get('host') + '/auth/cas/login';