Separate bearer ids from private tokens

This commit is contained in:
Eric Wendland 2026-05-20 13:10:34 +02:00
commit 460acab67b
9 changed files with 198 additions and 62 deletions

View file

@ -215,7 +215,7 @@ pub enum SecretBearerCommand {
capabilities: Vec<String>,
},
Prove {
secret: String,
token: String,
resource: String,
#[arg(long)]
nonce: String,
@ -223,7 +223,7 @@ pub enum SecretBearerCommand {
capabilities: Vec<String>,
},
Verify {
secret: String,
token: String,
resource: String,
#[arg(long)]
nonce: String,
@ -234,7 +234,7 @@ pub enum SecretBearerCommand {
},
Revoke {
resource: String,
secret: String,
bearer_id: String,
},
}
@ -673,32 +673,36 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
capabilities,
},
SecretBearerCommand::Prove {
secret,
token,
resource,
capabilities,
nonce,
} => ControlRequest::SecretBearerProve {
secret,
secret: token,
resource,
capabilities,
nonce,
},
SecretBearerCommand::Verify {
secret,
token,
resource,
capabilities,
nonce,
response,
} => ControlRequest::SecretBearerVerify {
secret,
secret: token,
resource,
capabilities,
nonce,
response,
},
SecretBearerCommand::Revoke { resource, secret } => {
ControlRequest::SecretBearerRevoke { resource, secret }
}
SecretBearerCommand::Revoke {
resource,
bearer_id,
} => ControlRequest::SecretBearerRevoke {
resource,
secret: bearer_id,
},
},
},
Command::Cas { command } => match command {
@ -1301,7 +1305,10 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
println!("epoch: {}", secret.epoch);
}
ControlResponse::SecretBearerCreated { access } => {
println!("bearer secret: {}", access.secret);
println!("bearer id: {}", access.secret);
if let Some(token) = access.token {
println!("bearer token: {token}");
}
println!("resource: {}", access.resource);
println!(
"capabilities: {}",