Skip to main content

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.
This will open a browser window where you can authenticate to the requested keycloak_url.
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'
  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'
  client_id: '<client_id>'
  client_secret: '<client_secret>'
  redirect_host: 'http://127.0.0.1'
  redirect_port: 9981
  scopes:
    - 'email'
    - 'profile'

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

authese-0.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authese-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file authese-0.0.2.tar.gz.

File metadata

  • Download URL: authese-0.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for authese-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5ad2ea8b6510756a0355ef6df1cf186f9b8e6cff5b117eb59da30a5da8b81436
MD5 f618cde3688f985f94bf6aeea4b0b45f
BLAKE2b-256 a22d5ff5790a395f845434ba104b1fa1d8fa1b9d7d312aee9f46782360109569

See more details on using hashes here.

File details

Details for the file authese-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: authese-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for authese-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c66e945c296aa03702b772ea6e62d93b1edc48919fbd5c55567c03f69a221f4a
MD5 1a394cbccb6ac75752399631aa4c8756
BLAKE2b-256 394bace4e460b35ac5d5820d45ce442dca878c2d2ec7b924f7c4ac0369de7169

See more details on using hashes here.

Supported by

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