diff --git a/lib/net/imap/sasl/cram_md5_authenticator.rb b/lib/net/imap/sasl/cram_md5_authenticator.rb index 3aac7b35..d5648515 100644 --- a/lib/net/imap/sasl/cram_md5_authenticator.rb +++ b/lib/net/imap/sasl/cram_md5_authenticator.rb @@ -14,13 +14,17 @@ # of cleartext and recommends TLS version 1.2 or greater be used for all # traffic. With TLS +CRAM-MD5+ is okay, but so is +PLAIN+ class Net::IMAP::SASL::CramMD5Authenticator - def initialize(user, password, warn_deprecation: true, **_ignored) + def initialize(user = nil, pass = nil, + authcid: nil, username: nil, + password: nil, + warn_deprecation: true, + **) if warn_deprecation warn "WARNING: CRAM-MD5 mechanism is deprecated." # TODO: recommend SCRAM end require "digest/md5" - @user = user - @password = password + @user = authcid || username || user + @password = password || pass @done = false end diff --git a/lib/net/imap/sasl/login_authenticator.rb b/lib/net/imap/sasl/login_authenticator.rb index 5132a09e..81201f66 100644 --- a/lib/net/imap/sasl/login_authenticator.rb +++ b/lib/net/imap/sasl/login_authenticator.rb @@ -23,12 +23,16 @@ class Net::IMAP::SASL::LoginAuthenticator STATE_DONE = :DONE private_constant :STATE_USER, :STATE_PASSWORD, :STATE_DONE - def initialize(user, password, warn_deprecation: true, **_ignored) + def initialize(user = nil, pass = nil, + authcid: nil, username: nil, + password: nil, + warn_deprecation: true, + **) if warn_deprecation warn "WARNING: LOGIN SASL mechanism is deprecated. Use PLAIN instead." end - @user = user - @password = password + @user = authcid || username || user + @password = password || pass @state = STATE_USER end