Skip to content

Commit

Permalink
feat(platform): add API to retrieve curretly authenticated user
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Mar 10, 2024
1 parent dbc400b commit a3a4471
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pub async fn run(
.service(
web::scope("/users")
.route("/remove", web::post().to(handlers::security_users_remove))
.route("/self", web::get().to(handlers::security_users_get_self))
.route("/{user_id}", web::get().to(handlers::security_users_get)),
)
.service(
Expand Down
2 changes: 2 additions & 0 deletions src/server/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod security_signup;
mod security_subscription_update;
mod security_users_get;
mod security_users_get_by_email;
mod security_users_get_self;
mod security_users_remove;
mod security_webauthn_signin;
mod security_webauthn_signup;
Expand Down Expand Up @@ -40,6 +41,7 @@ pub use self::{
security_subscription_update::security_subscription_update,
security_users_get::security_users_get,
security_users_get_by_email::security_users_get_by_email,
security_users_get_self::security_users_get_self,
security_users_remove::security_users_remove,
security_webauthn_signin::{security_webauthn_signin_finish, security_webauthn_signin_start},
security_webauthn_signup::{security_webauthn_signup_finish, security_webauthn_signup_start},
Expand Down
6 changes: 6 additions & 0 deletions src/server/handlers/security_users_get_self.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use crate::users::User;
use actix_web::{HttpResponse, Responder};

pub async fn security_users_get_self(user: User) -> impl Responder {
HttpResponse::Ok().json(user)
}

0 comments on commit a3a4471

Please sign in to comment.