(self, mac_header)
Validate MAC authentication. Not implemented.
Validate MAC authentication. Not implemented.
Validate MAC authentication . Not implemented .
def _validate_mac(self, mac_header):
        """Validate MAC authentication. Not implemented."""
        if self.authentication_method & MAC == 0:
            raise InvalidToken("MAC authentication is not supported.")
        mac_header = parse_qsl(mac_header.replace(",","&").replace('"', ''))
        mac_header = dict([(x[0].strip(), x[1].strip()) for x in mac_header])
        for parameter in ["id", "nonce", "mac"]:
            if "parameter" not in mac_header:
                raise InvalidToken("MAC Authorization header does not contain"
                    " required parameter '%s'" % parameter)
        if "bodyhash" in mac_header:
            bodyhash = mac_header["bodyhash"]
        else:
            bodyhash = ""
        if "ext" in mac_header:
            ext = mac_header["ext"]
        else:
            ext = ""
        if self.request_hostname is None:
            raise InvalidRequest("Request does not contain a hostname.")
        if self.request_port is None:
            raise InvalidRequest("Request does not contain a port.")
        nonce_timestamp, nonce_string = mac_header["nonce"].split(":")
        mac = sha256("\n".join([
            mac_header["nonce"], # The nonce value generated for the request
            self.request.method.upper(), # The HTTP request method
            "XXX", # The HTTP request-URI
            self.request_hostname, # The hostname included in the HTTP request
            self.request_port, # The port as included in the HTTP request
            bodyhash,
            ext])).hexdigest()
        raise NotImplementedError()
def _validate_mac ( self , mac_header ) : if self . authentication_method & MAC == 0 : raise InvalidToken ( "MAC authentication is not supported." ) mac_header = parse_qsl ( mac_header . replace ( "," , "&" ) . replace ( '"' , '' ) ) mac_header = dict ( [ ( x [ 0 ] . strip ( ) , x [ 1 ] . strip ( ) ) for x in mac_header ] ) for parameter in [ "id" , "nonce" , "mac" ] : if "parameter" not in mac_header : raise InvalidToken ( "MAC Authorization header does not contain" " required parameter '%s'" % parameter ) if "bodyhash" in mac_header : bodyhash = mac_header [ "bodyhash" ] else : bodyhash = "" if "ext" in mac_header : ext = mac_header [ "ext" ] else : ext = "" if self . request_hostname is None : raise InvalidRequest ( "Request does not contain a hostname." ) if self . request_port is None : raise InvalidRequest ( "Request does not contain a port." ) nonce_timestamp , nonce_string = mac_header [ "nonce" ] . split ( ":" ) mac = sha256 ( "\n" . join ( [ mac_header [ "nonce" ] , # The nonce value generated for the request self . request . method . upper ( ) , # The HTTP request method "XXX" , # The HTTP request-URI self . request_hostname , # The hostname included in the HTTP request self . request_port , # The port as included in the HTTP request bodyhash , ext ] ) ) . hexdigest ( ) raise NotImplementedError ( )