All Projects → GehirnInc → Python Jwt

GehirnInc / Python Jwt

Licence: apache-2.0
JSON Web Token library for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Jwt

Jose2go
Golang (GO) implementation of Javascript Object Signing and Encryption specification
Stars: ✭ 150 (+85.19%)
Mutual labels:  jwt, jws, jose
Jose
🔐 JSON Object Signing and Encryption Framework (JWT, JWS, JWE, JWA, JWK, JWKSet and more)
Stars: ✭ 479 (+491.36%)
Mutual labels:  jwt, jws, jose
Hs Jose
Haskell JOSE and JWT library
Stars: ✭ 100 (+23.46%)
Mutual labels:  jwt, jws, jose
Jwt
Safe, simple and fast JSON Web Tokens for Go
Stars: ✭ 231 (+185.19%)
Mutual labels:  jwt, jws, jose
Jwt Framework
JWT Framework
Stars: ✭ 577 (+612.35%)
Mutual labels:  jwt, jws, jose
Authlib
The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.
Stars: ✭ 2,854 (+3423.46%)
Mutual labels:  jwt, jws, jose
Json Jwt
JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby
Stars: ✭ 262 (+223.46%)
Mutual labels:  jwt, jws, jose
Cli
🧰 A zero trust swiss army knife for working with X509, OAuth, JWT, OATH OTP, etc.
Stars: ✭ 2,151 (+2555.56%)
Mutual labels:  jwt, jws, jose
Jose Jwt
Ultimate Javascript Object Signing and Encryption (JOSE) and JSON Web Token (JWT) Implementation for .NET and .NET Core
Stars: ✭ 692 (+754.32%)
Mutual labels:  jwt, jws, jose
Go Jose
An implementation of JOSE standards (JWE, JWS, JWT) in Go
Stars: ✭ 1,849 (+2182.72%)
Mutual labels:  jwt, jws, jose
Jose
A JOSE implementation
Stars: ✭ 20 (-75.31%)
Mutual labels:  jwt, jws, jose
Jose
JSON Object Signing and Encryption for Node.js and the browser
Stars: ✭ 25 (-69.14%)
Mutual labels:  jwt, jws, jose
Jose
Universal "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK with no dependencies
Stars: ✭ 1,029 (+1170.37%)
Mutual labels:  jwt, jws, jose
Erlang Jose
JSON Object Signing and Encryption (JOSE) for Erlang and Elixir
Stars: ✭ 232 (+186.42%)
Mutual labels:  jwt, jose
node-jose-tools
Command line tools for node-jose's features
Stars: ✭ 29 (-64.2%)
Mutual labels:  jose, jws
jwt-core
[READ-ONLY] Core component of the JWT Framework
Stars: ✭ 46 (-43.21%)
Mutual labels:  jose, jws
jwx
JSON/JWK/JWS/JWT/Base64 library in SPARK
Stars: ✭ 15 (-81.48%)
Mutual labels:  jose, jws
lexik-jose-bridge
An Encoder for the LexikJWTAuthenticationBundle that uses web-token/jwt-framework
Stars: ✭ 27 (-66.67%)
Mutual labels:  jose, jws
jwt-signature
[READ ONLY] Signature component of the JWT Framework
Stars: ✭ 32 (-60.49%)
Mutual labels:  jose, jws
Jwt
Go JWT signing, verifying and validating
Stars: ✭ 394 (+386.42%)
Mutual labels:  jwt, jws

.. image:: https://travis-ci.org/GehirnInc/python-jwt.svg?branch=master :target: https://travis-ci.org/GehirnInc/python-jwt .. image:: https://coveralls.io/repos/GehirnInc/python-jwt/badge.png?branch=master :target: https://coveralls.io/r/GehirnInc/python-jwt?branch=master .. image:: https://badge.fury.io/py/jwt.svg?dummy :target: http://badge.fury.io/py/jwt

python-jwt

python-jwt is a JSON Web Token (JWT) implementation in Python developed by Gehirn Inc_.

Examples

.. code-block:: python

import json from datetime import datetime, timedelta, timezone

from jwt import ( JWT, jwk_from_dict, jwk_from_pem, ) from jwt.utils import get_int_from_datetime

instance = JWT()

message = { 'iss': 'https://example.com/', 'sub': 'yosida95', 'iat': get_int_from_datetime(datetime.now(timezone.utc)), 'exp': get_int_from_datetime( datetime.now(timezone.utc) + timedelta(hours=1)), }

""" Encode the message to JWT(JWS). """

Load a RSA key from a JWK dict.

signing_key = jwk_from_dict({ 'kty': 'RSA', 'e': 'AQAB', 'n': '...', 'd': '...'})

Or load a RSA key from a PEM file.

with open('rsa_private_key.pem', 'rb') as fh: signing_key = jwk_from_pem(fh.read())

You can also load an octet key in the same manner as the RSA.

signing_key = jwk_from_dict({'kty': 'oct', 'k': '...'})

compact_jws = instance.encode(message, signing_key, alg='RS256')

""" Decode the JWT with verifying the signature. """

Load a public key from PEM file corresponding to the signing private key.

with open('rsa_public_key.json', 'r') as fh: verifying_key = jwk_from_dict(json.load(fh))

message_received = instance.decode( compact_jws, verifying_key, do_time_check=True)

""" Successfuly retrieved the message from the compact_jws """ assert message == message_received

Installation

You can install python-jwt with pip.

.. code-block:: shell

$ pip install jwt

Implementation Details

Supported Algorithms


- Unsecured

  - none (disabled by default for security)

- Symmetric

  - HS256
  - HS384
  - HS512

- Asymmetric

  - PS256
  - PS384
  - PS512
  - RS256
  - RS384
  - RS512

Supported Python Versions
  • Python 3.6+

License

python-jwt is licensed under the Apache License version 2. See ./LICENSE.rst.

.. _Gehirn Inc: http://www.gehirn.co.jp/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].