Skip to content

Commit 930b6cf

Browse files
authored
fix: clear backchannel logout tokens (#649)
1 parent 7783c63 commit 930b6cf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
const { promisify } = require('util');
22
const { get: getClient } = require('../../client');
33

4-
// Remove any Back-Channel Logout tokens for this `sub`
4+
// Remove any Back-Channel Logout tokens for this `sub` and `sid`
55
module.exports = async (req, config) => {
66
const {
77
issuer: { issuer },
88
} = await getClient(config);
99
const { session, backchannelLogout } = config;
1010
const store = (backchannelLogout && backchannelLogout.store) || session.store;
1111
const destroy = promisify(store.destroy).bind(store);
12-
await destroy(`${issuer}|${req.oidc.idTokenClaims.sub}`);
12+
13+
// Get the sub and sid from the ID token claims
14+
const { sub, sid } = req.oidc.idTokenClaims;
15+
16+
// Remove both sub and sid based entries
17+
await Promise.all([
18+
destroy(`${issuer}|${sub}`),
19+
sid && destroy(`${issuer}|${sid}`),
20+
]);
1321
};

0 commit comments

Comments
 (0)