OpenID Connect JWT Token Snatcher
Project description
Authese
Authenticate through OpenID Connect and cache your JWT token in a file.
Example
from authese import get_token, EnvConfig, Environment
token = get_token(EnvConfig.from_env(Environment.STAGING))
Install
pip install authese
Info
There are 3 possible environments.
- LOCAL
- STAGING
- PROD
Assuming STAGING
Create an EnvConfig object. Call get_token() and provide it with the EnvConfig object.
EnvConfig
- Personal access token
grant_type: '' Identical to grant_type: 'authorization_code'
This is the default authorization flow.
This will open a browser window where you can authenticate to the requested keycloak_url.
- Server to server
Depending if you set the grant_type: 'client_credentials'.
This will authenticate to the requested keycloak_url using the client credentials.
Cache
Once authenticated, your token will be cached at /tmp/authese-cache.dat
Subsequent calls to get_token() will use the cached token.
When the token expires it will be deleted and you must authenticate again.
To force reauthentication just remove the /tmp/authese-cache.dat file.
Config
local:
staging:
keycloak_url: 'https://<openid-host>/realms/<realm>/protocol/openid-connect'
grant_type: '<authorization_code | client_credentials>'
client_id: '<client_id>'
client_secret: '<client_secret>'
redirect_host: 'http://127.0.0.1'
redirect_port: 9981
scopes:
- 'email'
- 'profile'
prod:
keycloak_url: 'https://<openid-host>/realms/<realm>/protocol/openid-connect'
grant_type: '<authorization_code | client_credentials>'
client_id: '<client_id>'
client_secret: '<client_secret>'
redirect_host: 'http://127.0.0.1'
redirect_port: 9981
scopes:
- 'email'
- 'profile'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file authese-0.1.3.tar.gz.
File metadata
- Download URL: authese-0.1.3.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4b8fe875c851ba71acb1edc52acd207a15bad11fd50a8a46ec76799b2d85c13
|
|
| MD5 |
607ca4289671ff8768ba0364d94ca62b
|
|
| BLAKE2b-256 |
27c7632853a35af9929e61163cb5b8b792f9c09ebdd4934cfd28e2b6ff0d955a
|
Provenance
The following attestation bundles were made for authese-0.1.3.tar.gz:
Publisher:
build-and-publish.yml on adhese/authese
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
authese-0.1.3.tar.gz -
Subject digest:
a4b8fe875c851ba71acb1edc52acd207a15bad11fd50a8a46ec76799b2d85c13 - Sigstore transparency entry: 153790152
- Sigstore integration time:
-
Permalink:
adhese/authese@72bf69b4e56c7da00eacf7fbd792dc4b2479ff52 -
Branch / Tag:
refs/heads/BLUE-152-fix-authese-deps - Owner: https://github.com/adhese
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@72bf69b4e56c7da00eacf7fbd792dc4b2479ff52 -
Trigger Event:
push
-
Statement type: