# Path: atlassian_jwt_auth/exceptions.py
# class KeyIdentifierException(ASAPAuthenticationException):
#     """Raise when there are issues validating the key identifier"""
# 
# class PublicKeyRetrieverException(_WithStatus, ASAPAuthenticationException):
#     """Raise when there are issues retrieving the public key"""
# 
# class PrivateKeyRetrieverException(_WithStatus, ASAPAuthenticationException):
#     """Raise when there are issues retrieving the private key"""


import base64
import cgi
import logging
import os
import re
import cachecontrol
import cryptography.hazmat.backends
import jwt
import requests
import requests.utils
from urllib.parse import unquote_plus
from cryptography.hazmat.primitives import serialization
from requests.exceptions import RequestException, ConnectionError
from atlassian_jwt_auth.exceptions import (KeyIdentifierException,
                                           PublicKeyRetrieverException,
                                           PrivateKeyRetrieverException)
class HTTPSMultiRepositoryPublicKeyRetriever(BasePublicKeyRetriever):
    """ This class retrieves public key from the supplied https key
        repository locations based upon key ids.
    """

    def __init__(self, key_repository_urls):
        if not isinstance(key_repository_urls, list):
            raise TypeError('keystore_urls must be a list of urls.')
        self._retrievers = self._create_retrievers(key_repository_urls)

    def _create_retrievers(self, key_repository_urls):
        return [HTTPSPublicKeyRetriever(url) for url
                in key_repository_urls]

    def handle_retrieval_exception(self, retriever, exception):
        """ Handles working with exceptions encountered during key
            retrieval.
        """
        if isinstance(exception, PublicKeyRetrieverException):
            original_exception = getattr(
                exception, 'original_exception', None)
            if isinstance(original_exception, ConnectionError):
                return
            if exception.status_code is None or exception.status_code < 500:
                raise

    def retrieve(self, key_identifier, **requests_kwargs):
        for retriever in self._retrievers:
            try:
                return retriever.retrieve(key_identifier, **requests_kwargs)

# Path: atlassian_jwt_auth/exceptions.py
# class KeyIdentifierException(ASAPAuthenticationException):
#     """Raise when there are issues validating the key identifier"""
# 
# class PublicKeyRetrieverException(_WithStatus, ASAPAuthenticationException):
#     """Raise when there are issues retrieving the public key"""
# 
# class PrivateKeyRetrieverException(_WithStatus, ASAPAuthenticationException):
#     """Raise when there are issues retrieving the private key"""


# Path: atlassian_jwt_auth/key.py
import base64
import cgi
import logging
import os
import re
import cachecontrol
import cryptography.hazmat.backends
import jwt
import requests
import requests.utils
from urllib.parse import unquote_plus
from cryptography.hazmat.primitives import serialization
from requests.exceptions import RequestException, ConnectionError
from atlassian_jwt_auth.exceptions import (KeyIdentifierException,
                                           PublicKeyRetrieverException,
                                           PrivateKeyRetrieverException)

class HTTPSMultiRepositoryPublicKeyRetriever(BasePublicKeyRetriever):
    """ This class retrieves public key from the supplied https key
        repository locations based upon key ids.
    """

    def __init__(self, key_repository_urls):
        if not isinstance(key_repository_urls, list):
            raise TypeError('keystore_urls must be a list of urls.')
        self._retrievers = self._create_retrievers(key_repository_urls)

    def _create_retrievers(self, key_repository_urls):
        return [HTTPSPublicKeyRetriever(url) for url
                in key_repository_urls]

    def handle_retrieval_exception(self, retriever, exception):
        """ Handles working with exceptions encountered during key
            retrieval.
        """
        if isinstance(exception, PublicKeyRetrieverException):
            original_exception = getattr(
                exception, 'original_exception', None)
            if isinstance(original_exception, ConnectionError):
                return
            if exception.status_code is None or exception.status_code < 500:
                raise

    def retrieve(self, key_identifier, **requests_kwargs):
        for retriever in self._retrievers:
            try:
                return retriever.retrieve(key_identifier, **requests_kwargs)

            except (RequestException, PublicKeyRetrieverException) as e: