Merge pull request #497 from sigoden/fix
This commit is contained in:
commit
ac15ae4e8e
2 changed files with 13 additions and 0 deletions
|
@ -102,6 +102,9 @@ impl AccessControl {
|
|||
authorization: Option<&HeaderValue>,
|
||||
guard_options: bool,
|
||||
) -> (Option<String>, Option<AccessPaths>) {
|
||||
if self.users.is_empty() {
|
||||
return (None, Some(AccessPaths::new(AccessPerm::ReadWrite)));
|
||||
}
|
||||
if let Some(authorization) = authorization {
|
||||
if let Some(user) = get_auth_user(authorization) {
|
||||
if let Some((pass, paths)) = self.users.get(&user) {
|
||||
|
|
|
@ -115,6 +115,16 @@ fn auth_skip_on_options_method(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn auth_skip_if_no_auth_user(server: TestServer) -> Result<(), Error> {
|
||||
let url = format!("{}index.html", server.url());
|
||||
let resp = fetch!(b"GET", &url)
|
||||
.basic_auth("user", Some("pass"))
|
||||
.send()?;
|
||||
assert_eq!(resp.status(), 200);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn auth_check(
|
||||
#[with(&["--auth", "user:pass@/:rw", "--auth", "user2:pass2@/", "-A"])] server: TestServer,
|
||||
|
|
Loading…
Reference in a new issue