Class: Vines::Stream::Server::Outbound::Auth

Inherits:
Vines::Stream::State show all
Defined in:
lib/vines/stream/server/outbound/auth.rb

Constant Summary collapse

NS =
NAMESPACES[:sasl]

Constants inherited from Vines::Stream::State

Vines::Stream::State::BODY, Vines::Stream::State::STREAM

Instance Attribute Summary

Attributes inherited from Vines::Stream::State

#stream

Instance Method Summary collapse

Methods inherited from Vines::Stream::State

#==, #eql?, #hash

Methods included from Log

#log

Constructor Details

#initialize(stream, success = AuthResult) ⇒ Auth

Returns a new instance of Auth.



10
11
12
# File 'lib/vines/stream/server/outbound/auth.rb', line 10

def initialize(stream, success=AuthResult)
  super
end

Instance Method Details

#node(node) ⇒ Object



14
15
16
17
18
19
# File 'lib/vines/stream/server/outbound/auth.rb', line 14

def node(node)
  raise StreamErrors::NotAuthorized unless external?(node)
  authz = Base64.encode64(stream.domain).chomp
  stream.write(%Q{<auth xmlns="#{NS}" mechanism="EXTERNAL">#{authz}</auth>})
  advance
end