#vault #api #client #hashicorp #login

vaultrs-login

Adds login support for Vault clients from vaultrs

7 releases

0.1.6 May 13, 2022
0.1.5 Mar 15, 2022
0.1.4 Sep 22, 2021

#106 in Authentication

Download history 4/week @ 2022-03-01 5/week @ 2022-03-08 45/week @ 2022-03-15 22/week @ 2022-03-22 8/week @ 2022-03-29 11/week @ 2022-04-05 10/week @ 2022-04-12 5/week @ 2022-04-19 55/week @ 2022-04-26 59/week @ 2022-05-03 130/week @ 2022-05-10 268/week @ 2022-05-17 531/week @ 2022-05-24 1105/week @ 2022-05-31 1011/week @ 2022-06-07 1316/week @ 2022-06-14

4,088 downloads per month
Used in vaultssh

MIT license

260KB
5.5K 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.1.6"

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.1.5"

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 };

# tokio_test::block_on(async {
client.login("approle", &login).await; // Token is automatically set to client
# })

Testing

Run tests with cargo:

cargo test

Dependencies

~5–14MB
~303K SLoC