Skip to content

Commit

Permalink
Add phylum auth revoke-token subcommand
Browse files Browse the repository at this point in the history
This adds a new subcommand to the `auth` subcommand which allows
revoking Locksmith API tokens.

It is possible to either specify one or more tokens as CLI arguments, or
alternatively interactively select which tokens should be revoked.

Closes #1176.
  • Loading branch information
cd-work committed Aug 9, 2023
1 parent 8bc7337 commit 178bdec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ pub fn add_subcommands(command: Command) -> Command {
.long("json")
.help("Produce output in json format (default: false)"),
),
)
.subcommand(
Command::new("revoke-token").about("Revoke an API token").arg(
Arg::new("token-name")
.long("token-name")
.help("Unique token name which identifies the token")
.required(true),
),
),
)
.subcommand(Command::new("ping").about("Ping the remote system to verify it is available"))
Expand Down
9 changes: 9 additions & 0 deletions cli/src/commands/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ pub async fn handle_auth_list_tokens(
Ok(ExitCode::Ok)
}

/// Revoke the specified authentication token.
pub async fn handle_auth_set_token(
mut config: Config,
matches: &clap::ArgMatches,
timeout: Option<u64>,
) -> CommandResult {
todo!()
}

/// Handle the subcommands for the `auth` subcommand.
pub async fn handle_auth(
config: Config,
Expand Down

0 comments on commit 178bdec

Please sign in to comment.