Class: Vines::Stream::Server::AuthRestart
- Inherits:
-
Vines::Stream::State
- Object
- Vines::Stream::State
- Vines::Stream::Server::AuthRestart
- Defined in:
- lib/vines/stream/server/auth_restart.rb
Constant Summary
Constants included from Node
Instance Attribute Summary
Attributes inherited from Vines::Stream::State
Instance Method Summary collapse
-
#initialize(stream, success = Auth) ⇒ AuthRestart
constructor
A new instance of AuthRestart.
- #node(node) ⇒ Object
Methods inherited from Vines::Stream::State
Methods included from Node
body?, namespace, stream?, to_stanza
Methods included from Log
Constructor Details
#initialize(stream, success = Auth) ⇒ AuthRestart
Returns a new instance of AuthRestart.
7 8 9 |
# File 'lib/vines/stream/server/auth_restart.rb', line 7 def initialize(stream, success=Auth) super end |
Instance Method Details
#node(node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vines/stream/server/auth_restart.rb', line 11 def node(node) raise StreamErrors::NotAuthorized unless stream?(node) stream.start(node) doc = Document.new features = doc.create_element('stream:features') if stream.dialback_retry? if stream.vhost.force_s2s_encryption? stream.close_connection return end @success = AuthMethod features << doc.create_element('dialback') do |db| db.default_namespace = NAMESPACES[:dialback] end else features << doc.create_element('mechanisms') do |parent| parent.default_namespace = NAMESPACES[:sasl] stream.authentication_mechanisms.each do |name| parent << doc.create_element('mechanism', name) end end end stream.write(features) advance end |