How to use the jwcrypto.jwk.JWKSet function in jwcrypto

To help you get started, we’ve selected a few jwcrypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Axtell / Axtell / app / jwkeys / __init__.py View on Github external
from jwcrypto.jwk import JWKSet
from os import path

jwkeys = JWKSet()
jwk_sets = [
    'google'
]

key_path = path.abspath(path.dirname(__file__))
for key in jwk_sets:
    key_name = key + '.jwk.json'
    with open(path.join(key_path, key_name), 'r') as keyfile:
        jwkeys.import_keyset(keyfile.read())
github Axtell / Axtell / app / jwkeys.py View on Github external
from urllib.request import urlopen

from jwcrypto.jwk import JWKSet

jwkeys = JWKSet()
jwk_sets = [
    'https://www.googleapis.com/oauth2/v3/certs'
]


def load_keys():
    for keyurl in jwk_sets:
        with urlopen(keyurl) as key:
            jwkeys.import_keyset(key.read().decode())