#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

#611 in Authentication

Download history 756/week @ 2024-07-29 676/week @ 2024-08-05 752/week @ 2024-08-12 1391/week @ 2024-08-19 1076/week @ 2024-08-26 1199/week @ 2024-09-02 1743/week @ 2024-09-09 1318/week @ 2024-09-16 1230/week @ 2024-09-23 1684/week @ 2024-09-30 658/week @ 2024-10-07 1157/week @ 2024-10-14 875/week @ 2024-10-21 1843/week @ 2024-10-28 1263/week @ 2024-11-04 2045/week @ 2024-11-11

6,028 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–24MB
~326K SLoC