Skip to content
This repository has been archived by the owner on Feb 11, 2025. It is now read-only.

Commit

Permalink
Merge pull request #237 from adamreese/feat/insecure
Browse files Browse the repository at this point in the history
Add unauthenticated flag to bindle-server
  • Loading branch information
adamreese authored Sep 16, 2021
2 parents 7f458e6 + 22f7764 commit 4359d54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ struct Opts {
about = "The URL of the OIDC issuer your tokens should be issued by. This is used for verification of the token and for OIDC discovery"
)]
oidc_issuer_url: Option<String>,

#[clap(
name = "unauthenticated",
long = "unauthenticated",
about = "Run server in develepment mode"
)]
#[serde(default)]
unauthenticated: bool,
}

#[tokio::main]
Expand Down Expand Up @@ -273,8 +281,12 @@ async fn main() -> anyhow::Result<()> {
)
} else if let Some(htpasswd) = opts.htpasswd_file {
AuthType::HttpBasic(htpasswd)
} else {
} else if opts.unauthenticated || config.unauthenticated {
AuthType::None
} else {
anyhow::bail!(
"An authentication method must be specified. Use --unauthenticated to run server without authentication"
);
};

// TODO: This is really gnarly, but the associated type on `Authenticator` makes turning it into
Expand Down
1 change: 1 addition & 0 deletions tests/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ async fn test_push() {
"--bin",
"bindle-server",
"--",
"--unauthenticated",
"-i",
address,
"-d",
Expand Down
1 change: 1 addition & 0 deletions tests/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl TestController {
.join(server_binary_name),
)
.args(&[
"--unauthenticated",
"-d",
tempdir.path().to_string_lossy().to_string().as_str(),
"-i",
Expand Down

0 comments on commit 4359d54

Please sign in to comment.