11 releases
0.2.2 | Nov 11, 2024 |
---|---|
0.2.1 | Mar 20, 2024 |
0.1.7 | Mar 25, 2023 |
0.1.6 | May 13, 2022 |
0.1.4 | Sep 22, 2021 |
#622 in Authentication
13,126 downloads per month
Used in 2 crates
465KB
9K
SLoC
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.2"
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
lib.rs
:
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
Dependencies
~7–23MB
~327K SLoC