MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / auth

Function auth

ch_09/src/routes/authentication.rs:118–132  ·  view source on GitHub ↗
(
)

Source from the content-addressed store, hash-verified

116}
117
118pub fn auth(
119) -> impl Filter<Extract = (Session,), Error = warp::Rejection> + Clone {
120 warp::header::<String>("Authorization").and_then(|token: String| {
121 let token = match verify_token(token) {
122 Ok(t) => t,
123 Err(_) => {
124 return future::ready(Err(warp::reject::custom(
125 handle_errors::Error::Unauthorized,
126 )))
127 }
128 };
129
130 future::ready(Ok(token))
131 })
132}

Callers 1

mainFunction · 0.50

Calls 1

verify_tokenFunction · 0.70

Tested by

no test coverage detected