Skip to content

Commit 092299f

Browse files
committed
♻️ Support keyword args for SASL DIGEST-MD5
1 parent e64dbc8 commit 092299f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/net/imap/sasl/digest_md5_authenticator.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class Net::IMAP::SASL::DigestMD5Authenticator
4141
attr_reader :authzid
4242

4343
# :call-seq:
44-
# new(username, password, authzid = nil) -> authenticator
44+
# new(username, password, authzid = nil, **options) -> authenticator
45+
# new(username:, password:, authzid: nil, **options) -> authenticator
4546
#
4647
# Creates an Authenticator for the "+DIGEST-MD5+" SASL mechanism.
4748
#
@@ -55,7 +56,12 @@ class Net::IMAP::SASL::DigestMD5Authenticator
5556
# * +warn_deprecation+ — Set to +false+ to silence the warning.
5657
#
5758
# See the documentation for each attribute for more details.
58-
def initialize(username, password, authzid = nil, warn_deprecation: true)
59+
def initialize(user = nil, pass = nil, authz = nil,
60+
username: nil, password: nil, authzid: nil,
61+
warn_deprecation: true, **)
62+
username ||= user or raise ArgumentError, "missing username"
63+
password ||= pass or raise ArgumentError, "missing password"
64+
authzid ||= authz
5965
if warn_deprecation
6066
warn "WARNING: DIGEST-MD5 SASL mechanism was deprecated by RFC6331."
6167
# TODO: recommend SCRAM instead.

0 commit comments

Comments
 (0)