Class: Jabber::SASL::Anonymous

Inherits:
Base
  • Object
show all
Defined in:
lib/xmpp4r/sasl.rb

Overview

SASL Anonymous authentication helper

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Jabber::SASL::Base

Instance Method Details

#auth(password) ⇒ Object

Authenticate by sending nothing with the ANONYMOUS token



78
79
80
81
82
83
84
85
86
87
88
89
# 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