Skip to main content
Help us improve Python packaging – donate today!

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.

Release history Release notifications

This version
History Node

1.0.2

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
onetimejwt-1.0.2.tar.gz (2.8 kB) Copy SHA256 hash SHA256 Source None Jul 3, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page