Пример #1
0
    def start(self,
              response=None,
              mechanism=None,
              locale="en_US",
              tune_params=None,
              username=None,
              password=None,
              client_properties=None,
              connection_options=None,
              sasl_options=None):
        self.mechanism = mechanism
        self.response = response
        self.username = username
        self.password = password
        self.locale = locale
        self.tune_params = tune_params
        self.client_properties = get_client_properties_with_defaults(
            provided_client_properties=client_properties)
        self.sasl_options = sasl_options
        self.socket = connect(self.host, self.port, connection_options)
        self.conn = Connection(self.socket, self.spec)
        self.peer = Peer(self.conn, ClientDelegate(self), Session)

        self.conn.init()
        self.peer.start()
        self.wait()
        self.channel(0).connection_open(self.vhost)
Пример #2
0
  def __init__(self, connection, username=None, password=None,
               mechanism=None, heartbeat=None, **kwargs):
    Delegate.__init__(self, connection)
    provided_client_properties = kwargs.get("client_properties")
    self.client_properties=get_client_properties_with_defaults(provided_client_properties)

    ##
    ## self.acceptableMechanisms is the list of SASL mechanisms that the client is willing to
    ## use.  If it's None, then any mechanism is acceptable.
    ##
    self.acceptableMechanisms = None
    if mechanism:
      self.acceptableMechanisms = mechanism.split(" ")
    self.heartbeat = heartbeat
    self.username  = username
    self.password  = password

    self.sasl = sasl.Client()
    if username and len(username) > 0:
      self.sasl.setAttr("username", str(username))
    if password and len(password) > 0:
      self.sasl.setAttr("password", str(password))
    self.sasl.setAttr("service", str(kwargs.get("service", "qpidd")))
    if "host" in kwargs:
      self.sasl.setAttr("host", str(kwargs["host"]))
    if "min_ssf" in kwargs:
      self.sasl.setAttr("minssf", kwargs["min_ssf"])
    if "max_ssf" in kwargs:
      self.sasl.setAttr("maxssf", kwargs["max_ssf"])
    self.sasl.init()
Пример #3
0
  def start(self, response=None, mechanism=None, locale="en_US", tune_params=None,
            username=None, password=None,
            client_properties=None, connection_options=None, sasl_options = None,
            channel_options=None):
    if response is not None and (username is not None or password is not None):
      raise RuntimeError("client must not specify both response and (username, password).")
    if response is not None:
      self.response = response
      authzid, self.username, self.password = response.split("\0")
    else:
      self.username = username
      self.password = password
    self.mechanism = mechanism
    self.locale = locale
    self.tune_params = tune_params
    self.client_properties=get_client_properties_with_defaults(provided_client_properties=client_properties, version_property_key="version")
    self.sasl_options = sasl_options
    self.socket = connect(self.host, self.port, connection_options)
    self.conn = Connection(self.socket, self.spec)
    self.peer = Peer(self.conn, ClientDelegate(self), Session, channel_options)

    self.conn.init()
    self.peer.start()
    self.wait()
    self.channel(0).connection_open(self.vhost)
Пример #4
0
  def start(self, response=None, mechanism=None, locale="en_US", tune_params=None,
            username=None, password=None,
            client_properties=None, connection_options=None, sasl_options = None,
            channel_options=None):
    if response is not None and (username is not None or password is not None):
      raise RuntimeError("client must not specify both response and (username, password).")
    if response is not None:
      self.response = response
      authzid, self.username, self.password = response.split("\0")
    else:
      self.username = username
      self.password = password
    self.mechanism = mechanism
    self.locale = locale
    self.tune_params = tune_params
    self.client_properties=get_client_properties_with_defaults(provided_client_properties=client_properties, version_property_key="version")
    self.sasl_options = sasl_options
    self.socket = connect(self.host, self.port, connection_options)
    self.conn = Connection(self.socket, self.spec)
    self.peer = Peer(self.conn, ClientDelegate(self), Session, channel_options)

    self.conn.init()
    self.peer.start()
    self.wait()
    self.channel(0).connection_open(self.vhost)
Пример #5
0
    def start(self, response, mechanism="AMQPLAIN", locale="en_US", tune_params=None, client_properties=None):
        self.mechanism = mechanism
        self.response = response
        self.locale = locale
        self.tune_params = tune_params
        self.client_properties = get_client_properties_with_defaults(provided_client_properties=client_properties)
        self.socket = connect(self.host, self.port)
        self.conn = Connection(self.socket, self.spec)
        self.peer = Peer(self.conn, ClientDelegate(self), Session)

        self.conn.init()
        self.peer.start()
        self.wait()
        self.channel(0).connection_open(self.vhost)
Пример #6
0
    def start(self,
              response,
              mechanism="AMQPLAIN",
              locale="en_US",
              tune_params=None,
              client_properties=None):
        self.mechanism = mechanism
        self.response = response
        self.locale = locale
        self.tune_params = tune_params
        self.client_properties = get_client_properties_with_defaults(
            provided_client_properties=client_properties)
        self.socket = connect(self.host, self.port)
        self.conn = Connection(self.socket, self.spec)
        self.peer = Peer(self.conn, ClientDelegate(self), Session)

        self.conn.init()
        self.peer.start()
        self.wait()
        self.channel(0).connection_open(self.vhost)