class Jabber::SASL::Anonymous

SASL Anonymous authentication helper

Public Instance Methods

auth(password) click to toggle source

Authenticate by sending nothing with the ANONYMOUS token

# File lib/xmpp4r/sasl.rb, line 78
def auth(password)
  auth_text = "#{@stream.jid.node}"
  error = nil
  @stream.send(generate_auth('ANONYMOUS', Base64::encode64(auth_text).gsub(/\s/, ''))) { |reply|
    if reply.name != 'success'
      error = reply.first_element(nil).name
    end
    true
  }

  raise error if error
end