Skip to main content

Simple one time jwt - server and client bits

Project description

One Time JWT

Simple mechanism for cross service authorization. Usage:

Client side:

import onetimejwt

jwt = onetimejwt.generate('shared secret', 60) # shared secret, 60 second age

headers = {
"Authorization": "Bearer " + onetimejwt.generate('shared secret', 60)
}

Server side, create a single instance of Manager and use it for all threads:

import onetimejwt

# at startup, creates a cleanup thread
# note: you can include any number of secrets
JTM = onetimejwt.Manager('shared secret', maxage=60)

JTM.housekeeper()

# during processing -- throws JwtFailed exception if not authorized
JTM.valid(headers.get('Authorization'))

Manager will keep a list of recognized JWTS, and uses logging of a warning level
to report problems.

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

onetimejwt-1.0.2.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file onetimejwt-1.0.2.tar.gz.

File metadata

  • Download URL: onetimejwt-1.0.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for onetimejwt-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b6d4d381580409faa1fb755060abd4c6191bffa9bed54529fe13d3064c7d12cd
MD5 a542bf82eb6d1d1be3b60c7d9920119f
BLAKE2b-256 5b0514aa8e8c6aff4c66792e52b566b1b71d6deff553eee0c87f8a7877543b36

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