@defra/lis-hubs-infra-access 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -196,13 +196,18 @@ function createLogoutController({
|
|
|
196
196
|
auth: false
|
|
197
197
|
},
|
|
198
198
|
async handler(request, h) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
// Build the logout URL while the session is still alive (it reads the
|
|
200
|
+
// id token for id_token_hint), but invalidate the session in `finally`
|
|
201
|
+
// so a failure building the URL cannot leave the session replayable.
|
|
202
|
+
try {
|
|
203
|
+
const logoutUrl = await buildLogoutUrl(request)
|
|
202
204
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
return h
|
|
206
|
+
.redirect(logoutUrl)
|
|
207
|
+
.unstate(getHubJwtCookieName(), getCookieOptions())
|
|
208
|
+
} finally {
|
|
209
|
+
clearHubAuthSession(request)
|
|
210
|
+
}
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
}
|
|
@@ -71,10 +71,9 @@ export function setHubAuthSession(request, authSession) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Fully resets the request's yar session (auth session and flow included).
|
|
75
75
|
* @param {object} request - The Hapi request object with yar session support.
|
|
76
76
|
*/
|
|
77
77
|
export function clearHubAuthSession(request) {
|
|
78
|
-
request?.yar?.
|
|
79
|
-
clearHubAuthFlow(request)
|
|
78
|
+
request?.yar?.reset?.()
|
|
80
79
|
}
|