3 unstable releases
0.2.0 | Aug 5, 2021 |
---|---|
0.1.1 | Aug 2, 2021 |
0.1.0 | Jul 30, 2021 |
#22 in #amazon-iam
13KB
68 lines
Vault IAM Authentication
Tiny library for Vault authentication using the AWS IAM engine.
Example
The authenticate
function returns a serde_json::Value
of the standard Vault login API response body.
use std::error::Error;
use serde_json::Value;
use vault_iam_auth::{authenticate, Parameters};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let params = Parameters {
iam_server_id: None,
mount_path: String::from("aws"),
role: String::from("my-role"),
vault_address: String::from("https://vault.address.com:8200"),
};
let response: serde_json::Value = authenticate(¶ms).await?;
let token = response
.get("auth")
.unwrap()
.get("client_token")
.unwrap()
.as_str()
.unwrap();
println!("{}", token);
Ok(())
}
Dependencies
~12–24MB
~361K SLoC