Ejemplo n.º 1
0
 def _auth(self):
     """
     Perform an authorization request against Riak
     returns True upon success, False otherwise
     Note: Riak will sleep for a short period of time upon a failed
           auth request/response to prevent denial of service attacks
     """
     codec = PbufCodec()
     username = self._client._credentials.username
     password = self._client._credentials.password
     if not password:
         password = ''
     msg = codec.encode_auth(username, password)
     resp_code, _ = self._non_connect_send_recv_msg(msg)
     if resp_code == riak.pb.messages.MSG_CODE_AUTH_RESP:
         return True
     else:
         return False
Ejemplo n.º 2
0
 def _auth(self):
     """
     Perform an authorization request against Riak
     returns True upon success, False otherwise
     Note: Riak will sleep for a short period of time upon a failed
           auth request/response to prevent denial of service attacks
     """
     codec = PbufCodec()
     username = self._client._credentials.username
     password = self._client._credentials.password
     if not password:
         password = ''
     msg = codec.encode_auth(username, password)
     resp_code, _ = self._non_connect_send_recv_msg(msg)
     if resp_code == riak.pb.messages.MSG_CODE_AUTH_RESP:
         return True
     else:
         return False