Skip to content

Commit

Permalink
Merge pull request #14 from partio-scout/logout
Browse files Browse the repository at this point in the history
Logout
  • Loading branch information
Kaisa Korpela authored Feb 4, 2021
2 parents 1fe4a2a + 148dfc6 commit cebc895
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ const main = async () => {
})
)

app.get('/logout', function(req, res) {
req.logout()
res.redirect(clientUrl)
})

app.post(
'/login/callback',
passport.authenticate('saml', {
Expand All @@ -102,6 +107,13 @@ const main = async () => {
res.redirect(clientUrl)
}
)

app.post('/logout/callback', async (req, res) => {
req.logout()
req.clearCache()
res.redirect(clientUrl)
})

app.get('/user', isLoggedIn, async (req, res) => {
res.json({
name: `${req.user.firstname} ${req.user.lastname}`,
Expand Down

0 comments on commit cebc895

Please sign in to comment.