# Path: atlassian_jwt_auth/tests/utils.py
# def get_new_rsa_private_key_in_pem_format():
# def get_public_key_pem_for_private_key_pem(private_key_pem):
# def get_example_jwt_auth_signer(**kwargs):
# def create_token(issuer, audience, key_id, private_key, subject=None):
#     def get_new_private_key_in_pem_format(self):
#     def algorithm(self):
#     def get_new_private_key_in_pem_format(self):
#     def algorithm(self):
#     def get_new_private_key_in_pem_format(self):
# class BaseJWTAlgorithmTestMixin(object):
# class RS256KeyTestMixin(object):
# class ES256KeyTestMixin(object):
# 
# Path: atlassian_jwt_auth/contrib/requests.py
# class JWTAuth(AuthBase, BaseJWTAuth):
#     """Adds a JWT bearer token to the request per the ASAP specification"""
# 
#     def __call__(self, r):
#         r.headers['Authorization'] = self._get_header_value()
#         return r
# 
# def create_jwt_auth(
#         issuer, key_identifier, private_key_pem, audience, **kwargs):
#     """Instantiate a JWTAuth while creating the signer inline"""
#     return JWTAuth.create(
#         issuer, key_identifier, private_key_pem, audience, **kwargs)


import unittest
import jwt
import atlassian_jwt_auth
from datetime import timedelta
from requests import Request
from atlassian_jwt_auth.tests import utils
from atlassian_jwt_auth.contrib.requests import JWTAuth, create_jwt_auth

    def test_create_jwt_auth(self):
        """Verify a valid Authorization header is added by JWTAuth"""
        auth = self.create_jwt_auth('issuer', 'issuer/key',
                                    self._private_key_pem.decode(), 'audience',
                                    algorithm=self.algorithm)
        self.assert_authorization_header_is_valid(auth)

    def test_create_jwt_auth_with_additional_claims(self):
        """ Verify a Valid Authorization header is added by JWTAuth and
            contains the additional claims when provided.
        """
        jwt_auth_signer = atlassian_jwt_auth.create_signer(
            'issuer',
            'issuer/key',
            self._private_key_pem.decode(),
            algorithm=self.algorithm)
        auth = self.auth_cls(jwt_auth_signer, 'audience',
                             additional_claims={'example': 'claim'})
        token = self.assert_authorization_header_is_valid(auth)
        self.assertEqual(token.get('example'), 'claim')

    def test_do_not_reuse_jwts(self):
        auth = self.create_jwt_auth('issuer', 'issuer/key',
                                    self._private_key_pem.decode(), 'audience',
                                    algorithm=self.algorithm)
        auth_header = self._get_auth_header(auth)
        self.assertNotEqual(auth_header, self._get_auth_header(auth))

    def test_reuse_jwts(self):

# Path: atlassian_jwt_auth/tests/utils.py
# def get_new_rsa_private_key_in_pem_format():
# def get_public_key_pem_for_private_key_pem(private_key_pem):
# def get_example_jwt_auth_signer(**kwargs):
# def create_token(issuer, audience, key_id, private_key, subject=None):
#     def get_new_private_key_in_pem_format(self):
#     def algorithm(self):
#     def get_new_private_key_in_pem_format(self):
#     def algorithm(self):
#     def get_new_private_key_in_pem_format(self):
# class BaseJWTAlgorithmTestMixin(object):
# class RS256KeyTestMixin(object):
# class ES256KeyTestMixin(object):
# 
# Path: atlassian_jwt_auth/contrib/requests.py
# class JWTAuth(AuthBase, BaseJWTAuth):
#     """Adds a JWT bearer token to the request per the ASAP specification"""
# 
#     def __call__(self, r):
#         r.headers['Authorization'] = self._get_header_value()
#         return r
# 
# def create_jwt_auth(
#         issuer, key_identifier, private_key_pem, audience, **kwargs):
#     """Instantiate a JWTAuth while creating the signer inline"""
#     return JWTAuth.create(
#         issuer, key_identifier, private_key_pem, audience, **kwargs)


# Path: atlassian_jwt_auth/contrib/tests/test_requests.py
import unittest
import jwt
import atlassian_jwt_auth
from datetime import timedelta
from requests import Request
from atlassian_jwt_auth.tests import utils
from atlassian_jwt_auth.contrib.requests import JWTAuth, create_jwt_auth


    def test_create_jwt_auth(self):
        """Verify a valid Authorization header is added by JWTAuth"""
        auth = self.create_jwt_auth('issuer', 'issuer/key',
                                    self._private_key_pem.decode(), 'audience',
                                    algorithm=self.algorithm)
        self.assert_authorization_header_is_valid(auth)

    def test_create_jwt_auth_with_additional_claims(self):
        """ Verify a Valid Authorization header is added by JWTAuth and
            contains the additional claims when provided.
        """
        jwt_auth_signer = atlassian_jwt_auth.create_signer(
            'issuer',
            'issuer/key',
            self._private_key_pem.decode(),
            algorithm=self.algorithm)
        auth = self.auth_cls(jwt_auth_signer, 'audience',
                             additional_claims={'example': 'claim'})
        token = self.assert_authorization_header_is_valid(auth)
        self.assertEqual(token.get('example'), 'claim')

    def test_do_not_reuse_jwts(self):
        auth = self.create_jwt_auth('issuer', 'issuer/key',
                                    self._private_key_pem.decode(), 'audience',
                                    algorithm=self.algorithm)
        auth_header = self._get_auth_header(auth)
        self.assertNotEqual(auth_header, self._get_auth_header(auth))

    def test_reuse_jwts(self):

        auth = self.create_jwt_auth('issuer', 'issuer/key',