Class: Vines::Stream::Client::Auth
- Defined in:
- lib/vines/stream/client/auth.rb
Direct Known Subclasses
Constant Summary collapse
- NS =
NAMESPACES[:sasl]
- MECHANISM =
'mechanism'.freeze
- AUTH =
'auth'.freeze
- PLAIN =
'PLAIN'.freeze
- EXTERNAL =
'EXTERNAL'.freeze
- SUCCESS =
%Q{<success xmlns="#{NS}"/>}.freeze
- MAX_AUTH_ATTEMPTS =
3
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
Instance Method Details
#node(node) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vines/stream/client/auth.rb', line 21 def node(node) raise StreamErrors::NotAuthorized unless auth?(node) if node.text.empty? send_auth_fail(SaslErrors::MalformedRequest.new) elsif stream.authentication_mechanisms.include?(node[MECHANISM]) case node[MECHANISM] when PLAIN then plain_auth(node) when EXTERNAL then external_auth(node) end else send_auth_fail(SaslErrors::InvalidMechanism.new) end end |