diff --git a/server/.sqlx/query-458c87cbcf275d5b6f05abb9e5bec0633eff66b73beed646069ad4db7450fd33.json b/server/.sqlx/query-755b789df9d3d7f92243481e8fc8b724cae757c55579da8f86adb778eefdbc48.json similarity index 68% rename from server/.sqlx/query-458c87cbcf275d5b6f05abb9e5bec0633eff66b73beed646069ad4db7450fd33.json rename to server/.sqlx/query-755b789df9d3d7f92243481e8fc8b724cae757c55579da8f86adb778eefdbc48.json index 47a3e77..450d122 100644 --- a/server/.sqlx/query-458c87cbcf275d5b6f05abb9e5bec0633eff66b73beed646069ad4db7450fd33.json +++ b/server/.sqlx/query-755b789df9d3d7f92243481e8fc8b724cae757c55579da8f86adb778eefdbc48.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT *\n FROM tokens\n WHERE access_token_hash = $1\n AND access_expires_at > now()\n AND revoked_at IS NULL\n ", + "query": "\n SELECT\n id,\n user_id,\n user_app_id,\n access_token_hash,\n refresh_token_hash,\n access_expires_at,\n refresh_expires_at,\n refreshed_at,\n revoked_at,\n created_at\n FROM tokens\n WHERE access_token_hash = $1\n AND access_expires_at > now()\n AND revoked_at IS NULL\n ", "describe": { "columns": [ { @@ -16,6 +16,28 @@ }, { "ordinal": 1, + "name": "user_id", + "type_info": "Uuid", + "origin": { + "Table": { + "table": "tokens", + "name": "user_id" + } + } + }, + { + "ordinal": 2, + "name": "user_app_id", + "type_info": "Uuid", + "origin": { + "Table": { + "table": "tokens", + "name": "user_app_id" + } + } + }, + { + "ordinal": 3, "name": "access_token_hash", "type_info": "Bytea", "origin": { @@ -26,7 +48,7 @@ } }, { - "ordinal": 2, + "ordinal": 4, "name": "refresh_token_hash", "type_info": "Bytea", "origin": { @@ -37,7 +59,7 @@ } }, { - "ordinal": 3, + "ordinal": 5, "name": "access_expires_at", "type_info": "Timestamptz", "origin": { @@ -48,7 +70,7 @@ } }, { - "ordinal": 4, + "ordinal": 6, "name": "refresh_expires_at", "type_info": "Timestamptz", "origin": { @@ -59,7 +81,7 @@ } }, { - "ordinal": 5, + "ordinal": 7, "name": "refreshed_at", "type_info": "Timestamptz", "origin": { @@ -70,7 +92,7 @@ } }, { - "ordinal": 6, + "ordinal": 8, "name": "revoked_at", "type_info": "Timestamptz", "origin": { @@ -81,7 +103,7 @@ } }, { - "ordinal": 7, + "ordinal": 9, "name": "created_at", "type_info": "Timestamptz", "origin": { @@ -100,6 +122,8 @@ "nullable": [ false, false, + true, + false, false, false, false, @@ -108,5 +132,5 @@ false ] }, - "hash": "458c87cbcf275d5b6f05abb9e5bec0633eff66b73beed646069ad4db7450fd33" + "hash": "755b789df9d3d7f92243481e8fc8b724cae757c55579da8f86adb778eefdbc48" } diff --git a/server/.sqlx/query-8f11aa4a2d8b3208181f12fc5b6f87f80fbc7eade88f4ceaf17f9716622ad12a.json b/server/.sqlx/query-8f11aa4a2d8b3208181f12fc5b6f87f80fbc7eade88f4ceaf17f9716622ad12a.json deleted file mode 100644 index 0d10a5d..0000000 --- a/server/.sqlx/query-8f11aa4a2d8b3208181f12fc5b6f87f80fbc7eade88f4ceaf17f9716622ad12a.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO tokens (\n id, access_token_hash, refresh_token_hash,\n access_expires_at, refresh_expires_at, refreshed_at, revoked_at, created_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Bytea", - "Bytea", - "Timestamptz", - "Timestamptz", - "Timestamptz", - "Timestamptz", - "Timestamptz" - ] - }, - "nullable": [] - }, - "hash": "8f11aa4a2d8b3208181f12fc5b6f87f80fbc7eade88f4ceaf17f9716622ad12a" -} diff --git a/server/.sqlx/query-f448274b39bb13ec500a7634fab177916a194192f3ea14f8439bd42c467844a0.json b/server/.sqlx/query-f448274b39bb13ec500a7634fab177916a194192f3ea14f8439bd42c467844a0.json new file mode 100644 index 0000000..6c77589 --- /dev/null +++ b/server/.sqlx/query-f448274b39bb13ec500a7634fab177916a194192f3ea14f8439bd42c467844a0.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO tokens (\n id, user_id, user_app_id, access_token_hash, refresh_token_hash,\n access_expires_at, refresh_expires_at, refreshed_at, revoked_at, created_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Bytea", + "Bytea", + "Timestamptz", + "Timestamptz", + "Timestamptz", + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "f448274b39bb13ec500a7634fab177916a194192f3ea14f8439bd42c467844a0" +} diff --git a/server/migrations/20261007000002_create_tokens.sql b/server/migrations/20261007000002_create_tokens.sql index f18b52d..39cbb5f 100644 --- a/server/migrations/20261007000002_create_tokens.sql +++ b/server/migrations/20261007000002_create_tokens.sql @@ -1,5 +1,7 @@ CREATE TABLE tokens ( id UUID PRIMARY KEY DEFAULT gen_random_uuid (), + user_id UUID NOT NULL CONSTRAINT fk_tokens_user REFERENCES users (id) ON DELETE CASCADE, + user_app_id UUID CONSTRAINT fk_tokens_app REFERENCES user_apps (id) ON DELETE CASCADE, access_token_hash BYTEA NOT NULL UNIQUE CHECK ( octet_length(access_token_hash) = 32 ), diff --git a/server/src/database/dtos/token.rs b/server/src/database/dtos/token.rs index 77e65c4..fc3460c 100644 --- a/server/src/database/dtos/token.rs +++ b/server/src/database/dtos/token.rs @@ -3,6 +3,8 @@ use uuid::Uuid; pub struct TokenRow { pub id: Uuid, + pub user_id: Uuid, + pub user_app_id: Option, pub access_token_hash: Vec, pub refresh_token_hash: Vec, pub access_expires_at: DateTime, diff --git a/server/src/database/tokens.rs b/server/src/database/tokens.rs index e98456d..b178e0c 100644 --- a/server/src/database/tokens.rs +++ b/server/src/database/tokens.rs @@ -12,7 +12,17 @@ where let row = sqlx::query_as!( TokenRow, r#" - SELECT * + SELECT + id, + user_id, + user_app_id, + access_token_hash, + refresh_token_hash, + access_expires_at, + refresh_expires_at, + refreshed_at, + revoked_at, + created_at FROM tokens WHERE access_token_hash = $1 AND access_expires_at > now() @@ -34,12 +44,14 @@ where sqlx::query!( r#" INSERT INTO tokens ( - id, access_token_hash, refresh_token_hash, + id, user_id, user_app_id, access_token_hash, refresh_token_hash, access_expires_at, refresh_expires_at, refreshed_at, revoked_at, created_at ) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) "#, token.id, + token.user_id, + token.user_app_id, token.access_token_hash, token.refresh_token_hash, token.access_expires_at, diff --git a/server/src/domain/token.rs b/server/src/domain/token.rs index 618afd2..72d69ce 100644 --- a/server/src/domain/token.rs +++ b/server/src/domain/token.rs @@ -4,6 +4,8 @@ use uuid::Uuid; #[derive(Clone, PartialEq, Eq)] pub struct Token { pub id: Uuid, + pub user_id: Uuid, + pub user_app_id: Option, pub access_token_hash: Vec, pub refresh_token_hash: Vec, pub access_expires_at: DateTime, diff --git a/server/src/repository/tokens.rs b/server/src/repository/tokens.rs index b111a6f..af5ad67 100644 --- a/server/src/repository/tokens.rs +++ b/server/src/repository/tokens.rs @@ -60,6 +60,8 @@ where fn decode(token: TokenRow) -> Result { Ok(Token { id: token.id, + user_id: token.user_id, + user_app_id: token.user_app_id, access_token_hash: token.access_token_hash, refresh_token_hash: token.refresh_token_hash, access_expires_at: token.access_expires_at, @@ -73,6 +75,8 @@ fn decode(token: TokenRow) -> Result { fn encode(token: Token) -> TokenRow { TokenRow { id: token.id, + user_id: token.user_id, + user_app_id: token.user_app_id, access_token_hash: token.access_token_hash, refresh_token_hash: token.refresh_token_hash, access_expires_at: token.access_expires_at, diff --git a/server/src/routes/accounts.rs b/server/src/routes/accounts.rs index c210383..85b4115 100644 --- a/server/src/routes/accounts.rs +++ b/server/src/routes/accounts.rs @@ -7,10 +7,7 @@ use super::{ dtos::account::{AccountRequest, AccountResponse}, extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; -use crate::{ - error::AppError, - repository::{self}, -}; +use crate::{error::AppError, repository}; pub fn create_router() -> axum::Router { axum::Router::new() @@ -37,24 +34,34 @@ async fn list_accounts( State(pool): State, Query(query): Query, ) -> Result>, AppError> { + let mut tx = pool + .begin() + .await + .map_err(repository::RepositoryError::from)?; + let query = repository::accounts::Query { name: query.name, limit: Some(query.limit.unwrap_or(20)), offset: query.offset, }; - let accounts = repository::accounts::list(&pool, query) + let accounts = repository::accounts::list(&mut *tx, query) .await? .into_iter() .map(AccountResponse::from) .collect(); + tx.commit() + .await + .map_err(repository::RepositoryError::from)?; + Ok(Json(accounts)) } #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_account( + Auth(auth): Auth, State(pool): State, Path(id): Path, ) -> Result, AppError> { @@ -68,6 +75,7 @@ async fn get_account( #[axum::debug_handler] #[tracing::instrument(skip(pool, account))] async fn upsert_account( + Auth(auth): Auth, State(pool): State, Path(id): Path, Json(account): Json, @@ -87,6 +95,7 @@ async fn upsert_account( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_account( + Auth(auth): Auth, Path(id): Path, State(pool): State, ) -> Result { diff --git a/server/src/routes/auth_token.rs b/server/src/routes/auth_token.rs index 8e6c2d7..d128381 100644 --- a/server/src/routes/auth_token.rs +++ b/server/src/routes/auth_token.rs @@ -35,12 +35,30 @@ async fn issue_token( client_secret, } => { let secret_hash = hash_secret(&client_secret); - if !repository::user_app_secrets::verify(&pool, client_id, &secret_hash).await? { + let generated = generate_token_pair()?; + + let mut tx = pool + .begin() + .await + .map_err(repository::RepositoryError::from)?; + + if !repository::user_app_secrets::verify(&mut *tx, client_id, &secret_hash).await? { return Err(AppError::Unauthorized); } - let generated = generate_token_pair()?; - repository::tokens::issue(&pool, token(&generated)).await?; + let user_app = repository::user_apps::get_by_id(&mut *tx, client_id) + .await? + .ok_or(AppError::Unauthorized)?; + + repository::tokens::issue( + &mut *tx, + token(user_app.user_id, Some(user_app.id), &generated), + ) + .await?; + + tx.commit() + .await + .map_err(repository::RepositoryError::from)?; Ok(Json(token_response( generated.access_token, @@ -87,7 +105,7 @@ async fn revoke_token( Ok(repository::tokens::revoke(&pool, &hash_secret(&request.token)).await?) } -struct GeneratedTokenPair { +struct TokenPair { access_token: String, refresh_token: String, access_token_hash: Vec, @@ -96,11 +114,11 @@ struct GeneratedTokenPair { refresh_expires_at: chrono::DateTime, } -fn generate_token_pair() -> Result { +fn generate_token_pair() -> Result { let access_token = generate_secret().map_err(|_| AppError::Internal)?; let refresh_token = generate_secret().map_err(|_| AppError::Internal)?; let now = Utc::now(); - Ok(GeneratedTokenPair { + Ok(TokenPair { access_token_hash: hash_secret(&access_token), refresh_token_hash: hash_secret(&refresh_token), access_expires_at: now + Duration::seconds(ACCESS_TOKEN_LIFETIME_SECONDS), @@ -110,13 +128,15 @@ fn generate_token_pair() -> Result { }) } -fn token(generated: &GeneratedTokenPair) -> Token { +fn token(user_id: Uuid, app_id: Option, token_pair: &TokenPair) -> Token { Token { id: Uuid::new_v4(), - access_token_hash: generated.access_token_hash.clone(), - refresh_token_hash: generated.refresh_token_hash.clone(), - access_expires_at: generated.access_expires_at, - refresh_expires_at: generated.refresh_expires_at, + user_id, + user_app_id: app_id, + access_token_hash: token_pair.access_token_hash.clone(), + refresh_token_hash: token_pair.refresh_token_hash.clone(), + access_expires_at: token_pair.access_expires_at, + refresh_expires_at: token_pair.refresh_expires_at, refreshed_at: None, revoked_at: None, created_at: Utc::now(), diff --git a/server/src/routes/extractors/auth.rs b/server/src/routes/extractors/auth.rs index aa819f8..ecafd40 100644 --- a/server/src/routes/extractors/auth.rs +++ b/server/src/routes/extractors/auth.rs @@ -45,8 +45,7 @@ where .ok_or(AppError::Unauthorized)?; Ok(Auth(Authorization { - user_id: token.id, - app_id: None, + user_id: token.user_id, })) } } @@ -54,15 +53,10 @@ where #[derive(Debug)] pub struct Authorization { user_id: Uuid, - app_id: Option, } impl Authorization { pub fn user_id(&self) -> Uuid { self.user_id } - - pub fn app_id(&self) -> Option { - self.app_id - } } diff --git a/server/src/routes/scheduled_transactions.rs b/server/src/routes/scheduled_transactions.rs index 9af1eb1..6fcca69 100644 --- a/server/src/routes/scheduled_transactions.rs +++ b/server/src/routes/scheduled_transactions.rs @@ -10,7 +10,7 @@ use super::{ dtos::scheduled_transaction::{ RecurringTransactionResponse, ScheduledTransactionRequest, ScheduledTransactionResponse, }, - extractors::{json::Json, path::Path, query::Query}, + extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; use crate::{ domain, @@ -38,6 +38,7 @@ pub struct QueryParams { #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn list_scheduled_transactions( + Auth(auth): Auth, State(pool): State, Query(query): Query, ) -> Result>, AppError> { @@ -63,6 +64,7 @@ async fn list_scheduled_transactions( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_scheduled_transaction( + Auth(auth): Auth, State(pool): State, Path(id): Path, ) -> Result, AppError> { @@ -80,6 +82,7 @@ async fn get_scheduled_transaction( #[axum::debug_handler] #[tracing::instrument(skip(pool, transaction))] async fn upsert_scheduled_transaction( + Auth(auth): Auth, State(pool): State, Path(id): Path, Json(transaction): Json, @@ -108,6 +111,7 @@ async fn upsert_scheduled_transaction( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_scheduled_transaction( + Auth(auth): Auth, State(pool): State, Path(id): Path, ) -> Result { diff --git a/server/src/routes/transactions.rs b/server/src/routes/transactions.rs index c770bec..613a6af 100644 --- a/server/src/routes/transactions.rs +++ b/server/src/routes/transactions.rs @@ -7,7 +7,7 @@ use uuid::Uuid; use super::{ dtos::transaction::{TransactionRequest, TransactionResponse}, - extractors::{json::Json, path::Path, query::Query}, + extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; use crate::{ domain, @@ -35,6 +35,7 @@ pub struct QueryParams { #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn list_transactions( + Auth(auth): Auth, State(pool): State, Query(query): Query, ) -> Result>, AppError> { @@ -59,6 +60,7 @@ async fn list_transactions( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_transaction( + Auth(auth): Auth, State(pool): State, Path(id): Path, ) -> Result, AppError> { @@ -76,6 +78,7 @@ async fn get_transaction( #[axum::debug_handler] #[tracing::instrument(skip(pool, transaction))] async fn upsert_transaction( + Auth(auth): Auth, State(pool): State, Path(id): Path, Json(transaction): Json, @@ -100,6 +103,7 @@ async fn upsert_transaction( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_transaction( + Auth(auth): Auth, Path(id): Path, State(pool): State, ) -> Result { diff --git a/server/src/routes/user_app_secrets.rs b/server/src/routes/user_app_secrets.rs index 5187207..f6bc7f4 100644 --- a/server/src/routes/user_app_secrets.rs +++ b/server/src/routes/user_app_secrets.rs @@ -7,7 +7,7 @@ use super::{ dtos::user_app_secret::{ CreatedUserAppSecretResponse, UserAppSecretRequest, UserAppSecretResponse, }, - extractors::{json::Json, path::Path, query::Query}, + extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; use crate::{ crypto::{generate_secret, hash_secret}, @@ -36,10 +36,15 @@ pub struct QueryParams { #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn list_user_app_secrets( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id)): Path<(Uuid, Uuid)>, Query(query): Query, ) -> Result>, AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let query = repository::user_app_secrets::Query { app_id, limit: Some(query.limit.unwrap_or(20)), @@ -61,9 +66,14 @@ async fn list_user_app_secrets( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_user_app_secret( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id, secret_id)): Path<(Uuid, Uuid, Uuid)>, ) -> Result, AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let mut tx = pool.begin().await.map_err(RepositoryError::from)?; ensure_app_ownership(&mut tx, user_id, app_id).await?; let secret = repository::user_app_secrets::get_by_id(&mut *tx, app_id, secret_id) @@ -77,10 +87,15 @@ async fn get_user_app_secret( #[axum::debug_handler] #[tracing::instrument(skip(pool, request))] async fn upsert_user_app_secret( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id, secret_id)): Path<(Uuid, Uuid, Uuid)>, Json(request): Json, ) -> Result<(StatusCode, Json), AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let now = chrono::Utc::now(); if request.expires_at <= now { return Err(AppError::BadRequest( @@ -121,9 +136,14 @@ async fn upsert_user_app_secret( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_user_app_secret( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id, secret_id)): Path<(Uuid, Uuid, Uuid)>, ) -> Result { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let mut tx = pool.begin().await.map_err(RepositoryError::from)?; ensure_app_ownership(&mut tx, user_id, app_id).await?; let deleted = repository::user_app_secrets::delete_by_id(&mut *tx, app_id, secret_id).await?; diff --git a/server/src/routes/user_apps.rs b/server/src/routes/user_apps.rs index 8b1e3c3..fba5cf3 100644 --- a/server/src/routes/user_apps.rs +++ b/server/src/routes/user_apps.rs @@ -5,7 +5,7 @@ use uuid::Uuid; use super::{ dtos::user_app::{UserAppRequest, UserAppResponse}, - extractors::{json::Json, path::Path, query::Query}, + extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; use crate::{ error::AppError, @@ -32,10 +32,15 @@ pub struct QueryParams { #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn list_user_apps( + Auth(auth): Auth, State(pool): State, Path(user_id): Path, Query(query): Query, ) -> Result>, AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let query = repository::user_apps::Query { user_id, limit: Some(query.limit.unwrap_or(20)), @@ -54,9 +59,14 @@ async fn list_user_apps( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_user_app( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id)): Path<(Uuid, Uuid)>, ) -> Result, AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let app = repository::user_apps::get_by_id(&pool, app_id) .await? .filter(|app| app.user_id == user_id) @@ -68,10 +78,15 @@ async fn get_user_app( #[axum::debug_handler] #[tracing::instrument(skip(pool, request))] async fn upsert_user_app( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id)): Path<(Uuid, Uuid)>, Json(request): Json, ) -> Result<(StatusCode, Json), AppError> { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let app = request.into_domain(user_id, app_id); let mut tx = pool.begin().await.map_err(RepositoryError::from)?; @@ -97,9 +112,14 @@ async fn upsert_user_app( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_user_app( + Auth(auth): Auth, State(pool): State, Path((user_id, app_id)): Path<(Uuid, Uuid)>, ) -> Result { + if auth.user_id() != user_id { + return Err(AppError::NotFound); + } + let mut tx = pool.begin().await.map_err(RepositoryError::from)?; if repository::user_apps::delete_by_id(&mut *tx, app_id) .await? diff --git a/server/src/routes/users.rs b/server/src/routes/users.rs index 7acfe17..faf19e0 100644 --- a/server/src/routes/users.rs +++ b/server/src/routes/users.rs @@ -5,12 +5,9 @@ use uuid::Uuid; use super::{ dtos::user::{UserRequest, UserResponse}, - extractors::{json::Json, path::Path, query::Query}, -}; -use crate::{ - error::AppError, - repository::{self}, + extractors::{auth::Auth, json::Json, path::Path, query::Query}, }; +use crate::{error::AppError, repository}; pub fn create_router() -> axum::Router { axum::Router::new() @@ -32,6 +29,7 @@ pub struct QueryParams { #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn list_users( + Auth(auth): Auth, State(pool): State, Query(query): Query, ) -> Result>, AppError> { @@ -52,6 +50,7 @@ async fn list_users( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn get_user( + Auth(auth): Auth, State(pool): State, Path(id): Path, ) -> Result, AppError> { @@ -65,6 +64,7 @@ async fn get_user( #[axum::debug_handler] #[tracing::instrument(skip(pool, user))] async fn upsert_user( + Auth(auth): Auth, State(pool): State, Path(id): Path, Json(user): Json, @@ -84,6 +84,7 @@ async fn upsert_user( #[axum::debug_handler] #[tracing::instrument(skip(pool))] async fn delete_user( + Auth(auth): Auth, Path(id): Path, State(pool): State, ) -> Result {