ibmcloud-iam-python-client
This project is a collection of Python modules used for interacting with IBMCloud IAM API services.
Currently it includes support for:
- Requesting IAM tokens using an intelligent caching mechanism (
TokenManager) - Parsing IAM tokens and verifying their cryptographic signatures
- Checking user action authorizations for a service, given a Subject, Action and Resource set (
PDPClient)
It is meant to be a lightweight client library that can be used in other projects, such as a service or other client.
Some things that will be added soon in the future:
- Caching authorization decisions from PDP
- Support for list a users Roles assigned from IAM policies
Usage
Install
pip install ibmcloud_iam
Getting tokens with TokenManager
import os
from ibmcloud_iam.token import TokenManager
tm = TokenManager(api_key=os.environ["IBMCLOUD_API_KEY"])
# whenever you need a token, just use 'tm.get_token()'
# get_token() will return a cached token if the token is not expired,
# or if expired or otherwise invalid, retrieve a new token for you
# gets a new token
print(tm.get_token())
# will return the same token as above, because of caching
print(tm.get_token())
Parsing and Validating Tokens
import os
import ibmcloud_iam.token
from ibmcloud_iam.token import TokenManager
tm = TokenManager(api_key=os.environ["IBMCLOUD_API_KEY"])
# validate_token will check the signature and parse and return the token claims
claims = ibmcloud_iam.token.validate_token(tm.get_token())
print(claims)
PDP Authorizations
Please see example.py for an example on how to use the PDPClient
Contributing
Feedback is appreciated in the form of bug reports, enhancement suggestions, testing, or pull requests/patches.
Pull requests and patches will be subject to review and will have to meet the standards of the project to be merged. We are willing to help with fixing issues and polishing if you are willing to be patient and understanding.
For bug reports, feature requests, or other support, please open a Github Issue in this repo.
If you are an IBMer and have access to the IBM Slack group, feel free to direct message me with questions at @mrodden.
Metadata
Release files for ibmcloud-iam 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ibmcloud-iam-0.1.7.tar.gz | 8.4 kB | Without provenance | Details for ibmcloud-iam-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ibmcloud_iam-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for ibmcloud_iam-0.1.7-py3-none-any.whl |
Total release size: 18.7 kB
Release files / ibmcloud-iam-0.1.7.tar.gz
| Download URL | ibmcloud-iam-0.1.7.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8af82811e5d70cbd4b8745e7862d9fb68fb3dce3a0ed957be97cc3ea1272d961
|
|
BLAKE2b-256 checksum How to use checksums |
156935672b32d339e13a19c985790b2329168f862b4e7d8ec63809333870877d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.2.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.9
|
Release files / ibmcloud_iam-0.1.7-py3-none-any.whl
| Download URL | ibmcloud_iam-0.1.7-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b62aac1cc4a6cac0be1a20b2918cc48e4fffff5b5b0d5c07e71d31b8eeae75b
|
|
BLAKE2b-256 checksum How to use checksums |
e9593a3863d9839a032e0c718a4b7d7dfbaa38bb4bf89abbb3d0fd99506e7252
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.2.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.9
|
Security for ibmcloud-iam 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.