#vault #login #api-client #client #hashi-corp

vaultrs-login

Adds login support for Vault clients from vaultrs

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

Download history 1307/week @ 2024-08-17 1157/week @ 2024-08-24 1178/week @ 2024-08-31 1777/week @ 2024-09-07 1283/week @ 2024-09-14 1258/week @ 2024-09-21 1629/week @ 2024-09-28 721/week @ 2024-10-05 1157/week @ 2024-10-12 607/week @ 2024-10-19 1738/week @ 2024-10-26 1628/week @ 2024-11-02 1516/week @ 2024-11-09 2096/week @ 2024-11-16 7895/week @ 2024-11-23 1439/week @ 2024-11-30

13,126 downloads per month
Used in 2 crates

MIT license

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