Skip to content

Commit b9be8aa

Browse files
cursoragentlovasoa
andcommitted
Refactor OIDC logout cookie removal
Co-authored-by: contact <[email protected]>
1 parent 9aa89fe commit b9be8aa

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/webserver/oidc.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,15 @@ async fn process_oidc_logout(
474474
build_redirect_response(logout_state.redirect_uri)
475475
};
476476

477-
let auth_cookie = Cookie::build(SQLPAGE_AUTH_COOKIE_NAME, "")
478-
.secure(true)
479-
.http_only(true)
480-
.max_age(actix_web::cookie::time::Duration::ZERO)
481-
.path("/")
482-
.finish();
483-
response.add_removal_cookie(&auth_cookie)?;
484-
485-
let nonce_cookie = Cookie::build(SQLPAGE_NONCE_COOKIE_NAME, "")
486-
.secure(true)
487-
.http_only(true)
488-
.max_age(actix_web::cookie::time::Duration::ZERO)
489-
.path("/")
490-
.finish();
491-
response.add_removal_cookie(&nonce_cookie)?;
477+
let mut auth_cookie = Cookie::named(SQLPAGE_AUTH_COOKIE_NAME);
478+
auth_cookie.set_path("/");
479+
auth_cookie.make_removal();
480+
response.add_cookie(&auth_cookie)?;
481+
482+
let mut nonce_cookie = Cookie::named(SQLPAGE_NONCE_COOKIE_NAME);
483+
nonce_cookie.set_path("/");
484+
nonce_cookie.make_removal();
485+
response.add_cookie(&nonce_cookie)?;
492486

493487
log::debug!("User logged out successfully");
494488
Ok(response)

0 commit comments

Comments
 (0)