Class: Net::SASL::LoginAuthenticator
- Inherits:
-
Authenticator
- Object
- Authenticator
- Net::SASL::LoginAuthenticator
- Defined in:
- lib/net/sasl/login_authenticator.rb
Overview
Authenticator for the “LOGIN
” SASL mechanism. The authentication credentials are transmitted in cleartext so this mechanism should only be used over an encrypted link.
Deprecated
The SASL mechanisms registry marks “LOGIN” as obsoleted by “PLAIN”. It is included here for compatibility with existing servers. See draft-murchison-sasl-login for both specification and deprecation.
Constant Summary collapse
- STATE_DONE =
:DONE
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#done? ⇒ Boolean
Returns true after sending the username and password.
-
#initialize(username, password, **_options) ⇒ LoginAuthenticator
constructor
Provide the
username
andpassword
credentials for authentication. -
#process(data) ⇒ Object
returns the SASL response for
LOGIN
.
Methods inherited from Authenticator
Constructor Details
#initialize(username, password, **_options) ⇒ LoginAuthenticator
Provide the username
and password
credentials for authentication.
LOGIN doesn’t support authzid
, and an ArgumentError will be raised if a third positional parameter is passed.
This should generally be instantiated via Net::SASL.authenticator.
28 29 30 31 |
# File 'lib/net/sasl/login_authenticator.rb', line 28 def initialize(username, password, **) super @state = STATE_USER end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
20 21 22 |
# File 'lib/net/sasl/login_authenticator.rb', line 20 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
20 21 22 |
# File 'lib/net/sasl/login_authenticator.rb', line 20 def username @username end |
Instance Method Details
#done? ⇒ Boolean
Returns true after sending the username and password.
46 47 48 |
# File 'lib/net/sasl/login_authenticator.rb', line 46 def done? @state == STATE_DONE end |
#process(data) ⇒ Object
returns the SASL response for LOGIN
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/net/sasl/login_authenticator.rb', line 34 def process(data) case @state when STATE_USER @state = STATE_PASSWORD @username when STATE_PASSWORD @state = STATE_DONE @password end end |