Class: Net::IMAP::SASL::LoginAuthenticator
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/net/imap/sasl/login_authenticator.rb |
Overview
Authenticator for the “LOGIN
” ::Net::IMAP::SASL
mechanism. See Net::IMAP#authenticate.
LOGIN
authentication sends the password in cleartext. RFC3501 encourages servers to disable cleartext authentication until after TLS has been negotiated. RFC8314 recommends TLS version 1.2 or greater be used for all traffic, and deprecate cleartext access ASAP. LOGIN
can be secured by TLS encryption.
Deprecated
The SASL mechanisms registry marks “LOGIN” as obsoleted in favor of “PLAIN”. It is included here for compatibility with existing servers. See draft-murchison-sasl-login for both specification and deprecation.
Constant Summary
-
STATE_DONE =
private
# File 'lib/net/imap/sasl/login_authenticator.rb', line 23:DONE
-
STATE_PASSWORD =
private
# File 'lib/net/imap/sasl/login_authenticator.rb', line 22:PASSWORD
-
STATE_USER =
private
# File 'lib/net/imap/sasl/login_authenticator.rb', line 21:USER
Class Method Summary
Instance Attribute Summary
- #done? ⇒ Boolean readonly
- #initial_response? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(user = nil, pass = nil, authcid: nil, username: nil, password: nil, secret: nil, warn_deprecation: true) ⇒ LoginAuthenticator
# File 'lib/net/imap/sasl/login_authenticator.rb', line 26
def initialize(user = nil, pass = nil, authcid: nil, username: nil, password: nil, secret: nil, warn_deprecation: true, **) if warn_deprecation warn "WARNING: LOGIN SASL mechanism is deprecated. Use PLAIN instead.", category: :deprecated end @user = authcid || username || user @password = password || secret || pass @state = STATE_USER end
Instance Attribute Details
#done? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/net/imap/sasl/login_authenticator.rb', line 55
def done?; @state == STATE_DONE end
#initial_response? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/net/imap/sasl/login_authenticator.rb', line 40
def initial_response?; false end
Instance Method Details
#process(data)
[ GitHub ]# File 'lib/net/imap/sasl/login_authenticator.rb', line 42
def process(data) case @state when STATE_USER @state = STATE_PASSWORD return @user when STATE_PASSWORD @state = STATE_DONE return @password when STATE_DONE raise ResponseParseError, data end end