Skip to main content

A tool for generating OIDC identities

Project description

id

CI PyPI version OpenSSF Scorecard SLSA

id is a Python tool for generating OIDC identities. It can automatically detect and produce OIDC credentials on a number of environments, including GitHub Actions, GitLab pipelines and Google Cloud.

Installation

id requires Python 3.8 or newer, and can be installed directly via pip:

python -m pip install id

Usage

You can run id as a Python module via python -m:

python -m id --help

Top-level:

usage: id [-h] [-V] [-v] [-d] audience

a tool for generating OIDC identities

positional arguments:
  audience       the OIDC audience to use

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit
  -v, --verbose  run with additional debug logging; supply multiple times to
                 increase verbosity (default: 0)
  -d, --decode   decode the OIDC token into JSON (default: False)

For Python API usage, there is a single importable function, detect_credential:

>>> from id import detect_credential
>>> detect_credential(audience='something')
'<OIDC token>'

This function requires an audience parameter, which is used when generating the OIDC token. This should be set to the intended audience for the token.

If no supported environment is found, detect_credential returns None. If a supported environment is found but detect_credential fails to retrieve a token, it raises AmbientCredentialError.

Supported environments

id currently supports ambient credential detection in the following environments:

Tokens in environment variables

GitLab provides OIDC tokens through environment variables. The variable name must be <AUD>_ID_TOKEN where <AUD> is the uppercased audience argument where all characters outside of ASCII letters and digits are replaced with "_". A leading digit must also be replaced with a "_".

Licensing

id is licensed under the Apache 2.0 License.

Contributing

See the contributing docs for details.

SLSA Provenance

This project emits a SLSA provenance on its release! This enables you to verify the integrity of the downloaded artifacts and ensured that the binary's code really comes from this source code.

To do so, please follow the instructions here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

id-1.3.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

id-1.3.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file id-1.3.0.tar.gz.

File metadata

  • Download URL: id-1.3.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for id-1.3.0.tar.gz
Algorithm Hash digest
SHA256 c5dbb6048a469466054f065e92dba9b202a57d718cf12a0f24a082d0df988e18
MD5 3005c89fbe1ed6f8a1fcba85e2d15318
BLAKE2b-256 4f24f5bb9deb79f6a7b761c075d1f5929ef3fda66f82f0376c5131fc6026a4d4

See more details on using hashes here.

File details

Details for the file id-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: id-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for id-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da320bc6d6e612a2c16364ca95bb905e87c74332d4fc9b34850a26c304790694
MD5 c8375ffcec0ee17903a6212a1c177c7d
BLAKE2b-256 79a41ee33543379d7c5a08476aea453a7aa14bc47a7c121ea1d36b7b112f00c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page