Skip to content

Commit

Permalink
step 9: Logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ballinette committed Oct 12, 2019
1 parent efa5321 commit aed5628
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
userInfo,
checkUserConsent,
setUserConsent,
userLogout,
} = require('./controllers/oidcProvider');

const memoryStorage = require('./services/memoryStorage');
Expand Down Expand Up @@ -66,6 +67,7 @@ app.post('/user/token', userToken);
app.get('/api/user', userInfo);
app.get('/user/consent', checkUserConsent);
app.post('/user/consent', setUserConsent);
app.get('/user/session/end', userLogout);
/**** END OIDC End points ****/

// Setting app port
Expand Down
8 changes: 8 additions & 0 deletions controllers/oidcProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,18 @@ const userInfo = (req, res) => {
return res.json(data);
};

const userLogout = (req, res) => {
// Empty session
req.session.destroy();

return res.redirect(req.query.post_logout_redirect_uri);
};

module.exports = {
userAuthorize,
userToken,
userInfo,
checkUserConsent,
setUserConsent,
userLogout,
}

0 comments on commit aed5628

Please sign in to comment.