mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Add domain to the authentication cookie
This commit is contained in:
parent
ea2eb92a99
commit
09058914b0
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -165,7 +165,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"async-lock",
|
||||
"async-trait",
|
||||
"base64 0.13.1",
|
||||
"base64 0.13.0",
|
||||
"bincode",
|
||||
"blake3",
|
||||
"chrono",
|
||||
@ -292,7 +292,7 @@ checksum = "f9770f9a9147b2324066609acb5495538cb25f973129663fba2658ba7ed69407"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"base64 0.13.1",
|
||||
"base64 0.13.0",
|
||||
"http",
|
||||
]
|
||||
|
||||
@ -1064,7 +1064,7 @@ version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cff78e5788be1e0ab65b04d306b2ed5092c815ec97ec70f4ebd5aee158aa55d"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"base64 0.13.0",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"headers-core",
|
||||
@ -1831,7 +1831,7 @@ version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"base64 0.13.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2396,7 +2396,7 @@ version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"base64 0.13.0",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
|
@ -16,7 +16,7 @@ use std::sync::Arc;
|
||||
|
||||
use async_session::{Session, SessionStore};
|
||||
use axum::{
|
||||
extract::Extension,
|
||||
extract::{Extension, Host},
|
||||
http::{header, HeaderMap, StatusCode},
|
||||
};
|
||||
use axum_auth::AuthBasic;
|
||||
@ -38,6 +38,7 @@ impl From<UserCreds> for api::AccountResponse {
|
||||
#[instrument(skip_all, fields(user=%auth.0.0))]
|
||||
pub async fn handler(
|
||||
auth: AuthBasic,
|
||||
Host(domain): Host,
|
||||
Extension(session_store): Extension<Arc<storage::SqliteStore>>,
|
||||
) -> (StatusCode, HeaderMap, axum::Json<api::AccountResponse>) {
|
||||
// NOTE(jwall): It is very important that you do **not** log the password
|
||||
@ -93,6 +94,7 @@ pub async fn handler(
|
||||
// 3. Construct the Session Cookie.
|
||||
let cookie = Cookie::build(storage::AXUM_SESSION_COOKIE_NAME, cookie_value)
|
||||
.same_site(SameSite::Strict)
|
||||
.domain(domain)
|
||||
.secure(true)
|
||||
.path("/")
|
||||
.finish();
|
||||
|
Loading…
x
Reference in New Issue
Block a user