Skip to content

Commit

Permalink
Add support for destroying idp session
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Feb 13, 2025
1 parent 88247a1 commit d96d9fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dummy-idp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ app.get('/health', (_, res) => {
app.post('/idp/users/clear', clearUsers)
app.post('/idp/users', express.json(), upsertUser)

app.get('/idp/sso', samlSingleSignOnRoute)
app.get(
'/idp/sso',
(req, res, next) => {
req.query.action === 'destroy' ? req.session.regenerate(next) : next()
},
samlSingleSignOnRoute
)
app.get('/idp/sso-login-confirm', samlSingleSignOnConfirmRoute)
app.get('/idp/sso-login-finish', samlSingleSignOnFinishRoute)
app.get('/idp/slo', samlSingleLogoutRoute)
Expand Down
10 changes: 9 additions & 1 deletion dummy-idp/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ const confirmHandler: express.RequestHandler = (req, res) => {
return renderSamlFormPage(req, res, {
uri: `${req.baseUrl}/idp/sso-login-finish`,
bodyHtml: html`
<button type="submit">Jatka</button>
<button name="action" value="login" type="submit">Jatka</button>
<button
name="action"
value="destroy"
formaction="${req.baseUrl}/idp/sso"
type="submit"
>
Vaihda käyttäjää
</button>
<h2>Välitettävät tiedot:</h2>
<table>
${attrs}
Expand Down

0 comments on commit d96d9fb

Please sign in to comment.