# Path: atlassian_jwt_auth/algorithms.py
# def get_permitted_algorithm_names():
# 
# Path: atlassian_jwt_auth/key.py
# PEM_FILE_TYPE = 'application/x-pem-file'
# class KeyIdentifier(object):
# class BasePublicKeyRetriever(object):
# class HTTPSPublicKeyRetriever(BasePublicKeyRetriever):
# class HTTPSMultiRepositoryPublicKeyRetriever(BasePublicKeyRetriever):
# class BasePrivateKeyRetriever(object):
# class DataUriPrivateKeyRetriever(BasePrivateKeyRetriever):
# class StaticPrivateKeyRetriever(BasePrivateKeyRetriever):
# class FilePrivateKeyRetriever(BasePrivateKeyRetriever):
# class FilePrivateKeyRepository(object):
#     def __init__(self, identifier):
#     def key_id(self):
# def validate_key_identifier(identifier):
# def _get_key_id_from_jwt_header(a_jwt):
#     def retrieve(self, key_identifier, **kwargs):
#     def __init__(self, base_url):
#     def _get_session(self):
#     def retrieve(self, key_identifier, **requests_kwargs):
#     def _retrieve(self, url, requests_kwargs):
#     def _check_content_type(self, url, content_type):
#     def __init__(self, key_repository_urls):
#     def _create_retrievers(self, key_repository_urls):
#     def handle_retrieval_exception(self, retriever, exception):
#     def retrieve(self, key_identifier, **requests_kwargs):
#     def load(self, issuer):
#     def __init__(self, data_uri):
#     def load(self, issuer):
#     def __init__(self, key_identifier, private_key_pem):
#     def load(self, issuer):
#     def __init__(self, private_key_repository_path):
#     def load(self, issuer):
#     def _find_last_key_id(self, issuer):
#     def __init__(self, path):
#     def find_valid_key_ids(self, issuer):
#     def load_key(self, key_identifier):


import calendar
import datetime
import random
import jwt
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from atlassian_jwt_auth import algorithms
from atlassian_jwt_auth import key
        if calendar.timegm(self._now().utctimetuple()) > about_to_expire:
            return False
        if set(claims.keys()) != set(existing_claims.keys()):
            return False
        for dict_key, val in claims.items():
            if dict_key in ['exp', 'iat', 'jti', 'nbf']:
                continue
            if existing_claims[dict_key] != val:
                return False
        return True

    def generate_jwt(self, audience, **kwargs):
        existing_token = self.get_cached_token(audience, **kwargs)
        claims = self._generate_claims(audience, **kwargs)
        if existing_token and self.can_reuse_token(existing_token, claims):
            return existing_token
        token = super(TokenReusingJWTAuthSigner, self).generate_jwt(
            audience, **kwargs)
        self.set_cached_token(token)
        return token


def _create_signer(issuer, private_key_retriever, **kwargs):
    signer_cls = JWTAuthSigner
    if kwargs.get('reuse_jwts', None):
        signer_cls = TokenReusingJWTAuthSigner
    return signer_cls(issuer, private_key_retriever, **kwargs)


def create_signer(issuer, key_identifier, private_key_pem, **kwargs):

# Path: atlassian_jwt_auth/algorithms.py
# def get_permitted_algorithm_names():
# 
# Path: atlassian_jwt_auth/key.py
# PEM_FILE_TYPE = 'application/x-pem-file'
# class KeyIdentifier(object):
# class BasePublicKeyRetriever(object):
# class HTTPSPublicKeyRetriever(BasePublicKeyRetriever):
# class HTTPSMultiRepositoryPublicKeyRetriever(BasePublicKeyRetriever):
# class BasePrivateKeyRetriever(object):
# class DataUriPrivateKeyRetriever(BasePrivateKeyRetriever):
# class StaticPrivateKeyRetriever(BasePrivateKeyRetriever):
# class FilePrivateKeyRetriever(BasePrivateKeyRetriever):
# class FilePrivateKeyRepository(object):
#     def __init__(self, identifier):
#     def key_id(self):
# def validate_key_identifier(identifier):
# def _get_key_id_from_jwt_header(a_jwt):
#     def retrieve(self, key_identifier, **kwargs):
#     def __init__(self, base_url):
#     def _get_session(self):
#     def retrieve(self, key_identifier, **requests_kwargs):
#     def _retrieve(self, url, requests_kwargs):
#     def _check_content_type(self, url, content_type):
#     def __init__(self, key_repository_urls):
#     def _create_retrievers(self, key_repository_urls):
#     def handle_retrieval_exception(self, retriever, exception):
#     def retrieve(self, key_identifier, **requests_kwargs):
#     def load(self, issuer):
#     def __init__(self, data_uri):
#     def load(self, issuer):
#     def __init__(self, key_identifier, private_key_pem):
#     def load(self, issuer):
#     def __init__(self, private_key_repository_path):
#     def load(self, issuer):
#     def _find_last_key_id(self, issuer):
#     def __init__(self, path):
#     def find_valid_key_ids(self, issuer):
#     def load_key(self, key_identifier):


# Path: atlassian_jwt_auth/signer.py
import calendar
import datetime
import random
import jwt
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from atlassian_jwt_auth import algorithms
from atlassian_jwt_auth import key

        if calendar.timegm(self._now().utctimetuple()) > about_to_expire:
            return False
        if set(claims.keys()) != set(existing_claims.keys()):
            return False
        for dict_key, val in claims.items():
            if dict_key in ['exp', 'iat', 'jti', 'nbf']:
                continue
            if existing_claims[dict_key] != val:
                return False
        return True

    def generate_jwt(self, audience, **kwargs):
        existing_token = self.get_cached_token(audience, **kwargs)
        claims = self._generate_claims(audience, **kwargs)
        if existing_token and self.can_reuse_token(existing_token, claims):
            return existing_token
        token = super(TokenReusingJWTAuthSigner, self).generate_jwt(
            audience, **kwargs)
        self.set_cached_token(token)
        return token


def _create_signer(issuer, private_key_retriever, **kwargs):
    signer_cls = JWTAuthSigner
    if kwargs.get('reuse_jwts', None):
        signer_cls = TokenReusingJWTAuthSigner
    return signer_cls(issuer, private_key_retriever, **kwargs)


def create_signer(issuer, key_identifier, private_key_pem, **kwargs):

    private_key_retriever = key.StaticPrivateKeyRetriever(