Merge pull request #907 from ethcore/gavofyork-patch-1

Update auth.rs
This commit is contained in:
Tomasz Drwięga 2016-04-09 11:25:05 +02:00
commit e839404bd2

View File

@ -91,19 +91,11 @@ impl HttpBasicAuth {
fn check_auth(&self, req: &server::Request) -> Access { fn check_auth(&self, req: &server::Request) -> Access {
match req.headers.get::<header::Authorization<header::Basic>>() { match req.headers.get::<header::Authorization<header::Basic>>() {
Some(&header::Authorization(header::Basic { ref username, password: Some(ref password) })) => { Some(&header::Authorization(
if self.is_authorized(username, password) { header::Basic { ref username, password: Some(ref password) }
Access::Granted )) if self.is_authorized(username, password) => Access::Granted,
} else { Some(_) => Access::Denied,
Access::Denied None => Access::AuthRequired,
}
},
Some(&header::Authorization(header::Basic { username: _, password: None })) => {
Access::Denied
},
None => {
Access::AuthRequired
},
} }
} }