aboutsummaryrefslogtreecommitdiffstats
path: root/adenosine-cli/src
diff options
context:
space:
mode:
authorbryan newbold <bnewbold@robocracy.org>2023-11-30 17:16:56 -0800
committerbryan newbold <bnewbold@robocracy.org>2023-11-30 17:16:56 -0800
commitf47f75f5a5ffdb606db54b7bce7a6217fd5750df (patch)
tree1c1bdb774ca56289e5571f5190ab1c325d201194 /adenosine-cli/src
parent2f53a284c011bd49fcaa7d1e46c5f0557a936efa (diff)
downloadadenosine-f47f75f5a5ffdb606db54b7bce7a6217fd5750df.tar.gz
adenosine-f47f75f5a5ffdb606db54b7bce7a6217fd5750df.zip
cli: configurable auth
Diffstat (limited to 'adenosine-cli/src')
-rw-r--r--adenosine-cli/src/bin/adenosine.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/adenosine-cli/src/bin/adenosine.rs b/adenosine-cli/src/bin/adenosine.rs
index e5537df..e2f6994 100644
--- a/adenosine-cli/src/bin/adenosine.rs
+++ b/adenosine-cli/src/bin/adenosine.rs
@@ -239,6 +239,9 @@ enum Command {
nsid: Nsid,
/// Set of query parameters and body fields for the request
fields: Vec<ArgField>,
+ /// Whether to authenticate
+ #[structopt(long)]
+ auth: bool
},
/// Manage user account and sessions
@@ -506,13 +509,16 @@ fn run(opt: Opt) -> Result<()> {
ref method,
ref nsid,
ref fields,
+ auth,
} => {
+ if auth == true {
+ require_auth_did(&opt, &mut xrpc_client)?;
+ }
update_params_from_fields(fields, &mut params);
let body = value_from_fields(fields.clone());
match method {
XrpcMethod::Get => xrpc_client.get(nsid, Some(params))?,
XrpcMethod::Post => {
- require_auth_did(&opt, &mut xrpc_client)?;
xrpc_client.post(nsid, Some(params), Some(body))?
}
}