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.1.tar.gz (4.9 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.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: authese-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 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.1.tar.gz
Algorithm Hash digest
SHA256 9ab2835dfa59826380a501c8c52d7d3365481b5dc86c4d53298b15ee0565f5f7
MD5 f6811fc7aed507788b554b01392f2385
BLAKE2b-256 11d3e542698e36da35b7ce42f48aab47a521e12499b94e6a99894e6659632739

See more details on using hashes here.

File details

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

File metadata

  • Download URL: authese-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46eb9deed644999b4430b29d97e75af4996827808235af8f06c8e463956b4d72
MD5 87dd449f2bd66a3312f5931dea3f448b
BLAKE2b-256 a9f25fa2298d2efd38d16b79db60ad168dbf4eb9cb8d6c44857ea0d8cefb668b

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