Skip to content

Commit 8ac9200

Browse files
committed
refactor: Streamline cookie removal in OIDC logout process
This commit simplifies the removal of authentication and nonce cookies during the OIDC logout process by consolidating the cookie removal logic into a single method call for each cookie, enhancing code clarity and maintainability.
1 parent 864ca9d commit 8ac9200

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/webserver/oidc.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,8 @@ async fn process_oidc_logout(
489489
build_redirect_response(params.redirect_uri)
490490
};
491491

492-
let mut auth_cookie = Cookie::named(SQLPAGE_AUTH_COOKIE_NAME);
493-
auth_cookie.set_path("/");
494-
auth_cookie.make_removal();
495-
response.add_cookie(&auth_cookie)?;
496-
497-
let mut nonce_cookie = Cookie::named(SQLPAGE_NONCE_COOKIE_NAME);
498-
nonce_cookie.set_path("/");
499-
nonce_cookie.make_removal();
500-
response.add_cookie(&nonce_cookie)?;
492+
response.add_removal_cookie(&Cookie::named(SQLPAGE_AUTH_COOKIE_NAME))?;
493+
response.add_removal_cookie(&Cookie::named(SQLPAGE_NONCE_COOKIE_NAME))?;
501494

502495
log::debug!("User logged out successfully");
503496
Ok(response)

0 commit comments

Comments
 (0)