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

Function auth

ch_11/src/routes/authentication.rs:103–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101}
102
103pub fn auth() -> impl Filter<Extract = (Session,), Error = warp::Rejection> + Clone {
104 warp::header::<String>("Authorization").and_then(|token: String| {
105 let token = match verify_token(token) {
106 Ok(t) => t,
107 Err(_) => {
108 return future::ready(Err(warp::reject::custom(
109 handle_errors::Error::Unauthorized,
110 )))
111 }
112 };
113
114 future::ready(Ok(token))
115 })
116}
117
118#[cfg(test)]
119mod authentication_tests {

Callers 2

post_questions_authFunction · 0.70
build_routesFunction · 0.50

Calls 1

verify_tokenFunction · 0.70

Tested by

no test coverage detected