|
5 | 5 | */
|
6 | 6 | var newSession = false; // Used by oidcAuth() and validateIdToken()
|
7 | 7 |
|
8 |
| -export default {auth, codeExchange, validateIdToken, logout}; |
| 8 | +export default {auth, codeExchange, validateIdToken, logout, redirectPostLogout}; |
9 | 9 |
|
10 | 10 | function retryOriginalRequest(r) {
|
11 | 11 | delete r.headersOut["WWW-Authenticate"]; // Remove evidence of original failed auth_jwt
|
@@ -253,11 +253,27 @@ function validateIdToken(r) {
|
253 | 253 | }
|
254 | 254 | }
|
255 | 255 |
|
| 256 | +// Default RP-Initiated or Custom Logout w/ OP as per: |
| 257 | +// https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout |
| 258 | +// https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RedirectionAfterLogout |
| 259 | +// An RP requests that the OP log out the end-user by redirecting the end-user's |
| 260 | +// User Agent to the OP's Logout endpoint. |
256 | 261 | function logout(r) {
|
257 | 262 | r.log("OIDC logout for " + r.variables.cookie_auth_token);
|
258 |
| - r.variables.session_jwt = "-"; |
259 |
| - r.variables.refresh_token = "-"; |
260 |
| - r.return(302, r.variables.oidc_logout_redirect); |
| 263 | + var queryParams = ''; |
| 264 | + if (r.variables.oidc_logout_query_params) { |
| 265 | + queryParams = '?' + r.variables.oidc_logout_query_params; |
| 266 | + } |
| 267 | + r.variables.request_id = '-'; |
| 268 | + r.variables.session_jwt = '-'; |
| 269 | + r.variables.access_token = '-'; |
| 270 | + r.variables.refresh_token = '-'; |
| 271 | + r.return(302, r.variables.oidc_logout_endpoint + queryParams); |
| 272 | +} |
| 273 | + |
| 274 | +// Redirect URI after logged-out from the OP. |
| 275 | +function redirectPostLogout(r) { |
| 276 | + r.return(302, r.variables.oidc_logout_landing_page); |
261 | 277 | }
|
262 | 278 |
|
263 | 279 | function getAuthZArgs(r) {
|
|
0 commit comments