From 1d5b29fb48aa6e42d6fe82ae74ff65955bcc2a76 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 8 Apr 2016 17:51:20 -0700 Subject: [PATCH] Update auth.rs --- webapp/src/router/auth.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/webapp/src/router/auth.rs b/webapp/src/router/auth.rs index 6122b9309..95c558bef 100644 --- a/webapp/src/router/auth.rs +++ b/webapp/src/router/auth.rs @@ -91,19 +91,11 @@ impl HttpBasicAuth { fn check_auth(&self, req: &server::Request) -> Access { match req.headers.get::>() { - Some(&header::Authorization(header::Basic { ref username, password: Some(ref password) })) => { - if self.is_authorized(username, password) { - Access::Granted - } else { - Access::Denied - } - }, - Some(&header::Authorization(header::Basic { username: _, password: None })) => { - Access::Denied - }, - None => { - Access::AuthRequired - }, + Some(&header::Authorization( + header::Basic { ref username, password: Some(ref password) } + )) if self.is_authorized(username, password) => Access::Granted, + Some(_) => Access::Denied, + None => Access::AuthRequired, } }