Sha256: 6b131b479c02b9afa85246069b48dfcb982836c6cbd8d41942bc2bdad78eeb3a

Contents?: true

Size: 799 Bytes

Versions: 10

Compression:

Stored size: 799 Bytes

Contents

# encoding: UTF-8

module Vines
  class Stream
    class Client
      class AuthRestart < State
        def initialize(stream, success=Auth)
          super
        end

        def node(node)
          raise StreamErrors::NotAuthorized unless stream?(node)
          stream.start(node)
          doc = Document.new
          features = doc.create_element('stream:features') do |el|
            el << doc.create_element('mechanisms') do |parent|
              parent.default_namespace = NAMESPACES[:sasl]
              mechanisms.each {|name| parent << doc.create_element('mechanism', name) }
            end
          end
          stream.write(features)
          advance
        end

        private

        def mechanisms
          ['EXTERNAL', 'PLAIN']
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vines-0.4.2 lib/vines/stream/client/auth_restart.rb
vines-0.4.1 lib/vines/stream/client/auth_restart.rb
vines-0.4.0 lib/vines/stream/client/auth_restart.rb
vines-0.3.2 lib/vines/stream/client/auth_restart.rb
vines-0.3.1 lib/vines/stream/client/auth_restart.rb
vines-0.3.0 lib/vines/stream/client/auth_restart.rb
vines-0.2.1 lib/vines/stream/client/auth_restart.rb
vines-0.2.0 lib/vines/stream/client/auth_restart.rb
vines-0.1.1 lib/vines/stream/client/auth_restart.rb
vines-0.1.0 lib/vines/stream/client/auth_restart.rb