Crates.io | iam_token_manager |
lib.rs | iam_token_manager |
version | 0.1.1 |
source | src |
created_at | 2021-12-04 11:52:22.800584 |
updated_at | 2021-12-16 10:07:41.260071 |
description | An IAM token manager for IBM Cloud tokens |
homepage | |
repository | https://github.com/apotry/iam_token_manager |
max_upload_size | |
id | 492227 |
size | 82,441 |
The IAM Token Manager manages IAM access tokens and refreshes them before they expire. Currently only IBM IAM tokens are supported.
Install the current stable release of Rust by using rustup. On Linux & OS X this can be done by running:
curl https://sh.rustup.rs -sSf | sh
Compile the ibmtest
example binary by executing the following in the repo root:
cargo build --example ibmtest
The compiled binary ibmtest
can be found in target/debug/examples/
.
The binary has the following command line flags
--ibm
: pass in an API key for cloud.ibm.com
(can be passed multiple times)--ibm-test
: pass in an API key for test.cloud.ibm.com
(can be passed multiple times)--web.listen-port
: port for web server (optional)--token-refresh-seconds
: how frequently a new access token for each API key is requested (optional, default=1800)At least one of --ibm
or --ibm-test
needs to be specified. If web.listen-port
is specified, a web server is
started that exposes the following routes:
/v1/tokens
: list of all current access tokens mapped by BSS account. Sample response:{
tokens": [
{
"id": "274a00...",
"access_token": "eyJraW...",
"refresh_token": "eyJraW..."
}
]
}
/v1/tokens/<id>
: access token for account with ID <id>
. Sample response:{
"id": "247a00...",
"access_token": "eyJraW...",
"refresh_token": "eyJraW..."
}
The environment variable RUST_LOG
controls the logging output detail. Not setting this environment variable means that
only errors will be logged:
RUST_LOG=info ./target/debug/examples/ibmtest --ibm <key1> --ibm <key2> --ibm-test <key3> --web.listen.port=5050