Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Commit 63e1580

Browse files
committed
fix(signout): the return in Client.get callback doesn't avoid res.sendStatus(204) below
1 parent 747b625 commit 63e1580

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

oidc/signout.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ function signout (req, res, next) {
3434
if (idToken instanceof Error) { return next(idToken) }
3535
clientId = idToken.payload.aud
3636
}
37-
if (idToken && postLogoutUri) {
37+
authenticator.logout(req)
38+
if (clientId && postLogoutUri) {
3839
// Verify the post-signout uri (must have been registered for this client)
39-
Client.get(clientId, function (err, client) {
40+
return Client.get(clientId, function (err, client) {
4041
if (err) { return next(err) }
4142
var isValidUri = false
4243
if (client) {
@@ -49,22 +50,24 @@ function signout (req, res, next) {
4950
postLogoutUri += '?state=' + state
5051
}
5152
// sign out and redirect
52-
authenticator.logout(req)
53-
res.redirect(303, postLogoutUri)
54-
return
53+
return res.redirect(303, postLogoutUri)
5554
}
5655
// Otherwise, fall through to default case below
56+
return emptyresponse(res)
5757
})
5858
}
5959
// Handle all the other cases - no postLogoutUri specified, or the client is
6060
// unknown, or the given postLogoutUri has not been registered previously.
6161
// Do not redirect, simply sign out
62-
authenticator.logout(req)
62+
return emptyresponse(res)
63+
}
64+
65+
function emptyresponse (res) {
6366
res.set({
6467
'Cache-Control': 'no-store',
6568
'Pragma': 'no-cache'
6669
})
67-
res.sendStatus(204)
70+
return res.sendStatus(204)
6871
}
6972

7073
/**

0 commit comments

Comments
 (0)