MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / auth

Function auth

ch_10/src/routes/authentication.rs:121–135  ·  view source on GitHub ↗
(
)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.50

Calls 1

verify_tokenFunction · 0.70

Tested by

no test coverage detected