|
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
|
@@ -263,12 +263,26 @@ function validateIdToken(r) {
|
263 | 263 | }
|
264 | 264 | }
|
265 | 265 |
|
| 266 | +// Default RP-Initiated or Custom Logout w/ OP as per: |
| 267 | +// https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout |
| 268 | +// https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RedirectionAfterLogout |
| 269 | +// An RP requests that the OP log out the end-user by redirecting the end-user's |
| 270 | +// User Agent to the OP's Logout endpoint. |
266 | 271 | function logout(r) {
|
267 | 272 | r.log("OIDC logout for " + r.variables.cookie_auth_token);
|
| 273 | + var queryParams = ''; |
| 274 | + if (r.variables.oidc_logout_query_params) { |
| 275 | + queryParams = '?' + r.variables.oidc_logout_query_params; |
| 276 | + } |
268 | 277 | r.variables.session_jwt = "-";
|
269 | 278 | r.variables.access_token = "-";
|
270 | 279 | r.variables.refresh_token = "-";
|
271 |
| - r.return(302, r.variables.oidc_logout_redirect); |
| 280 | + r.return(302, r.variables.oidc_end_session_endpoint + queryParams); |
| 281 | +} |
| 282 | + |
| 283 | +// Redirect URI after logged-out from the OP. |
| 284 | +function redirectPostLogout(r) { |
| 285 | + r.return(302, r.variables.oidc_logout_landing_page); |
272 | 286 | }
|
273 | 287 |
|
274 | 288 | function getAuthZArgs(r) {
|
|
0 commit comments