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

Method from_request

auth/simple-auth-server/src/auth_handler.rs:30–40  ·  view source on GitHub ↗
(req: &HttpRequest, pl: &mut Payload)

Source from the content-addressed store, hash-verified

28 type Future = Ready<Result<LoggedUser, Error>>;
29
30 fn from_request(req: &HttpRequest, pl: &mut Payload) -> Self::Future {
31 if let Ok(identity) = Identity::from_request(req, pl).into_inner()
32 && let Ok(user_json) = identity.id()
33 && let Ok(user) = serde_json::from_str(&user_json)
34 {
35 return ready(Ok(user));
36 }
37
38 ready(Err(ServiceError::Unauthorized.into()))
39 }
40}
41
42pub async fn logout(id: Identity) -> HttpResponse {
43 id.logout();

Callers

nothing calls this directly

Calls 1

idMethod · 0.45

Tested by

no test coverage detected