'Helper function that logs proper HTTP Authorization header for a given request
Used only in debug situations, this logs the correct Authorization header based on
the request header and body according to OAuth 1 Body signing
Arguments:
request (xblock.django.request.DjangoWebobRequest):  Request object to log Authorization header for
Returns:
nothing'

def _log_correct_authorization_header(self, request):

    sha1 = hashlib.sha1()
    sha1.update(request.body)
    oauth_body_hash = unicode(base64.b64encode(sha1.digest()))
    log.debug('[LTI]    oauth_body_hash    =    {}'.format(oauth_body_hash))
    (client_key, client_secret) = self.get_client_key_secret()
    client = Client(client_key, client_secret)
    mock_request = mock.Mock(uri=unicode(urllib.unquote(request.url)), headers=request.headers, body=u'', decoded_body=u'', http_method=unicode(request.method))
    params = client.get_oauth_params(mock_request)
    mock_request.oauth_params = params
    mock_request.oauth_params.append((u'oauth_body_hash', oauth_body_hash))
    sig = client.get_oauth_signature(mock_request)
    mock_request.oauth_params.append((u'oauth_signature', sig))
    (_, headers, _) = client._render(mock_request)
    log.debug('\n\n####    COPY    AND    PASTE    AUTHORIZATION    HEADER    ####\n{}\n####################################\n\n'.format(headers['Authorization']))
