-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent timed side-channel attacks. Add get user endpoint
- Loading branch information
1 parent
8c20769
commit d967012
Showing
7 changed files
with
106 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub use models::*; | ||
|
||
mod models; | ||
mod routes; | ||
pub mod selectors; | ||
pub mod services; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use axum::extract::State; | ||
use axum::routing::get; | ||
use axum::{Json, Router}; | ||
use sqlx::PgPool; | ||
|
||
use crate::startup::AppState; | ||
use crate::users::selectors::get_user; | ||
use crate::users::User; | ||
|
||
async fn get_user_handler( | ||
State(pool): State<PgPool>, | ||
Json(user_id): Json<uuid::Uuid>, | ||
) -> crate::Result<Json<Option<User>>> { | ||
Ok(Json(get_user(pool, user_id).await?)) | ||
} | ||
|
||
pub fn routes() -> Router<AppState> { | ||
Router::new().route("/user", get(get_user_handler)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use sqlx::{Acquire, PgPool}; | ||
use sqlx::types::uuid; | ||
use sqlx::{Acquire, PgPool}; | ||
|
||
use crate::users::User; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters