From f47f75f5a5ffdb606db54b7bce7a6217fd5750df Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 30 Nov 2023 17:16:56 -0800 Subject: cli: configurable auth --- adenosine-cli/src/bin/adenosine.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, + /// 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))? } } -- cgit v1.2.3