Add protected peer auth check
This commit is contained in:
parent
679eeb48a3
commit
b0f208b05a
7 changed files with 347 additions and 9 deletions
|
|
@ -140,6 +140,11 @@ pub enum PeerCommand {
|
|||
Ping {
|
||||
node: String,
|
||||
},
|
||||
AuthCheck {
|
||||
node: String,
|
||||
resource: String,
|
||||
capability: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
|
|
@ -464,6 +469,15 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
PeerCommand::Import { path } => ControlRequest::PeerCardImport { path },
|
||||
PeerCommand::List => ControlRequest::PeerCardList,
|
||||
PeerCommand::Ping { node } => ControlRequest::PeerPing { node },
|
||||
PeerCommand::AuthCheck {
|
||||
node,
|
||||
resource,
|
||||
capability,
|
||||
} => ControlRequest::PeerAuthCheck {
|
||||
node,
|
||||
resource,
|
||||
capability,
|
||||
},
|
||||
},
|
||||
Command::Resource {
|
||||
command: ResourceCommand::List,
|
||||
|
|
@ -819,6 +833,27 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("alpn: {alpn}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::PeerAuthChecked {
|
||||
peer_node_id,
|
||||
peer_agent_id,
|
||||
endpoint_id,
|
||||
resource,
|
||||
capability,
|
||||
allowed,
|
||||
reason,
|
||||
evaluated_ops,
|
||||
note,
|
||||
} => {
|
||||
println!("peer auth: {peer_node_id}");
|
||||
println!("agent: {peer_agent_id}");
|
||||
println!("endpoint: {endpoint_id}");
|
||||
println!("resource: {resource}");
|
||||
println!("capability: {capability}");
|
||||
println!("allowed: {allowed}");
|
||||
println!("reason: {reason}");
|
||||
println!("evaluated_ops: {evaluated_ops}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::ResourceList { resources } => {
|
||||
if resources.is_empty() {
|
||||
println!("no resources");
|
||||
|
|
|
|||
Loading…
Reference in a new issue