'Validate the signature and ensure the provider is setup properly.'

def validate_signature(self, value):

    provider_id = self.provider.provider_id
    secret_key = get_shared_secret_key(provider_id)
    if (secret_key is None):
        msg = u'Could    not    retrieve    secret    key    for    credit    provider    [{}].    Unable    to    validate    requests    from    provider.'.format(provider_id)
        log.error(msg)
        raise PermissionDenied(msg)
    data = self.initial_data
    actual_signature = data[u'signature']
    if (signature(data, secret_key) != actual_signature):
        msg = u'Request    from    credit    provider    [{}]    had    an    invalid    signature.'.format(provider_id)
        raise PermissionDenied(msg)
    return value
