Limited use registration token support
Co-authored-by: Ginger <ginger@gingershaped.computer> Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
36
src/admin/token/mod.rs
Normal file
36
src/admin/token/mod.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
mod commands;
|
||||
|
||||
use clap::Subcommand;
|
||||
use tuwunel_core::Result;
|
||||
|
||||
use crate::admin_command_dispatch;
|
||||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum TokenCommand {
|
||||
/// - Issue a new registration token
|
||||
Issue {
|
||||
/// The maximum number of times this token is allowed to be used before
|
||||
/// it expires.
|
||||
#[arg(long)]
|
||||
max_uses: Option<u64>,
|
||||
|
||||
/// The maximum age of this token (e.g. 30s, 5m, 7d). It will expire
|
||||
/// after this much time has passed.
|
||||
#[arg(long)]
|
||||
max_age: Option<String>,
|
||||
|
||||
/// A shortcut for `--max-uses 1`.
|
||||
#[arg(long)]
|
||||
once: bool,
|
||||
},
|
||||
|
||||
/// - Revoke a registration token
|
||||
Revoke {
|
||||
/// The token to revoke.
|
||||
token: String,
|
||||
},
|
||||
|
||||
/// - List all registration tokens
|
||||
List,
|
||||
}
|
||||
Reference in New Issue
Block a user