MCPcopy Create free account
hub / github.com/actix/examples / login

Function login

auth/simple-auth-server/src/auth_handler.rs:48–59  ·  view source on GitHub ↗
(
    req: HttpRequest,
    auth_data: web::Json<AuthData>,
    pool: web::Data<Pool>,
)

Source from the content-addressed store, hash-verified

46
47pub async fn login(
48 req: HttpRequest,
49 auth_data: web::Json<AuthData>,
50 pool: web::Data<Pool>,
51) -> Result<HttpResponse, actix_web::Error> {
52 let user = web::block(move || query(auth_data.into_inner(), pool)).await??;
53
54 let user_string = serde_json::to_string(&user).unwrap();
55 Identity::login(&req.extensions(), user_string).unwrap();
56
57 Ok(HttpResponse::NoContent().finish())
58}
59
60pub async fn get_me(logged_user: LoggedUser) -> HttpResponse {
61 HttpResponse::Ok().json(logged_user)
62}

Callers

nothing calls this directly

Calls 1

queryFunction · 0.70

Tested by

no test coverage detected