

def authenticate(self, request):
    api_key_header = self.header_canonical(self.API_KEY_HEADER)
    api_key = request.META.get(api_key_header)
    if (not api_key):
        return None
    authorization_header = self.header_canonical('Authorization')
    sent_string = request.META.get(authorization_header)
    if (not sent_string):
        raise exceptions.AuthenticationFailed('No signature provided')
    sent_signature = self.get_signature_from_signature_string(sent_string)
    try:
        (user, secret) = self.fetch_user_data(api_key)
    except TypeError:
        raise exceptions.AuthenticationFailed('Bad API key')
    computed_string = self.build_signature(api_key, secret, request)
    computed_signature = self.get_signature_from_signature_string(computed_string)
    if (computed_signature != sent_signature):
        raise exceptions.AuthenticationFailed('Bad signature')
    return (user, api_key)

dataset/ETHPy150Open etoccalino/django-rest-framework-httpsignature/rest_framework_httpsignature/authentication.py SignatureAuthentication.authenticate/original