Class: Vines::Stream::Client::Auth
- Defined in:
- lib/vines/stream/client/auth.rb
Direct Known Subclasses
Constant Summary collapse
- NS =
NAMESPACES[:sasl]
- AUTH =
'auth'.freeze
- SUCCESS =
%Q{<success xmlns="#{NS}"/>}.freeze
- MAX_AUTH_ATTEMPTS =
3
- AUTH_MECHANISMS =
{'PLAIN' => :plain_auth, 'EXTERNAL' => :external_auth}.freeze
Constants inherited from State
Instance Attribute Summary
Attributes inherited from State
Instance Method Summary collapse
-
#initialize(stream, success = BindRestart) ⇒ Auth
constructor
A new instance of Auth.
- #node(node) ⇒ Object
Methods inherited from State
Methods included from Log
Constructor Details
#initialize(stream, success = BindRestart) ⇒ Auth
Returns a new instance of Auth.
13 14 15 16 |
# File 'lib/vines/stream/client/auth.rb', line 13 def initialize(stream, success=BindRestart) super @attempts, @outstanding = 0, false end |
Instance Method Details
#node(node) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vines/stream/client/auth.rb', line 18 def node(node) raise StreamErrors::NotAuthorized unless auth?(node) unless node.text.empty? (name = AUTH_MECHANISMS[node['mechanism']]) ? method(name).call(node) : send_auth_fail(SaslErrors::InvalidMechanism.new) else send_auth_fail(SaslErrors::MalformedRequest.new) end end |