Crate vaultrs_login
source ·Expand description
§vaultrs-login
Adds login support for Vault clients from [vaultrs][1].
§Installation
Add vaultrs-login
as a dependency to your cargo.toml:
[dependencies]
vaultrs-login = "0.2.0"
§Usage
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
use vaultrs_login::LoginClient;
use vaultrs_login::engines::approle::AppRoleLogin;
// Create a client
let mut client = VaultClient::new(
VaultClientSettingsBuilder::default()
.address("https://127.0.0.1:8200")
.build()
.unwrap()
).unwrap();
// Use one of the login flows to obtain a token for the client
let role_id = String::from("my-role-id");
let secret_id = String::from("secret");
let login = AppRoleLogin { role_id, secret_id };
client.login("approle", &login).await; // Token is automatically set to client
§Testing
Run tests with cargo:
ⓘ
cargo test
Modules§
Traits§
- Adds login behavior to Clients.
- Represents a method for logging into Vault which returns a new token.
- Represents the second step of a multi-step login method that returns the authentication info.
- Represents a method for logging into Vault which returns a new token but requires two separate steps to complete.