Skip to content

Commit 91f3256

Browse files
committed
fix(oidc) :: pin auth cookie attributes in test
1 parent 109b20d commit 91f3256

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

tests/oidc/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use actix_web::{
22
App, HttpResponse, HttpServer, Responder,
3-
cookie::Cookie,
3+
cookie::{Cookie, SameSite},
44
http::{StatusCode, header},
55
test,
66
web::{self, Data},
@@ -430,6 +430,20 @@ async fn test_oidc_happy_path() {
430430
"the post-login redirect must not re-enter a cached authorization redirect"
431431
);
432432

433+
let auth_cookie = extract_set_cookies(callback_resp.headers())
434+
.into_iter()
435+
.find(|c| c.name() == "sqlpage_auth")
436+
.expect("a successful login must set the auth cookie");
437+
assert_eq!(
438+
(
439+
auth_cookie.http_only(),
440+
auth_cookie.secure(),
441+
auth_cookie.same_site(),
442+
auth_cookie.path()
443+
),
444+
(Some(true), Some(true), Some(SameSite::Lax), Some("/"))
445+
);
446+
433447
let final_resp = request_with_cookies!(app, test::TestRequest::get().uri("/"), cookies);
434448
assert_eq!(final_resp.status(), StatusCode::OK);
435449
}

0 commit comments

Comments
 (0)