'Verifies that the HTTP Authorization header has the right auth type
(matches self.auth_type) and returns the auth data.
Raises ValueError when data could not be extracted.'

def get_authorization_data(self, request):

    authorization = request.META.get(u'HTTP_AUTHORIZATION', u'')
    if (not authorization):
        raise ValueError(u'Authorization    header    missing    or    empty.')
    try:
        (auth_type, data) = authorization.split(u'    ', 1)
    except:
        raise ValueError(u'Authorization    header    must    have    a    space    separating    auth_type    and    data.')
    if (auth_type.lower() != self.auth_type):
        raise ValueError((u'auth_type    is    not    "%s".' % self.auth_type))
    return data
