Class: Vines::Stream::Http::Auth

Inherits:
Client::Auth show all
Defined in:
lib/vines/stream/http/auth.rb

Constant Summary

Constants inherited from Client::Auth

Client::Auth::AUTH, Client::Auth::EXTERNAL, Client::Auth::MAX_AUTH_ATTEMPTS, Client::Auth::MECHANISM, Client::Auth::NS, Client::Auth::PLAIN, Client::Auth::SUCCESS

Constants included from Node

Node::BODY, Node::STREAM

Instance Attribute Summary

Attributes inherited from State

#stream

Instance Method Summary collapse

Methods inherited from State

#==, #eql?, #hash

Methods included from Node

body?, namespace, stream?, to_stanza

Methods included from Log

#log, set_log_file

Constructor Details

#initialize(stream, success = BindRestart) ⇒ Auth

Returns a new instance of Auth.



7
8
9
# File 'lib/vines/stream/http/auth.rb', line 7

def initialize(stream, success=BindRestart)
  super
end

Instance Method Details

#node(node) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/vines/stream/http/auth.rb', line 11

def node(node)
  unless stream.valid_session?(node['sid']) && body?(node) && node['rid']
    raise StreamErrors::NotAuthorized
  end
  nodes = stream.parse_body(node)
  raise StreamErrors::NotAuthorized unless nodes.size == 1
  super(nodes.first)
end