Skip to content

Commit 28b43c1

Browse files
committed
♻️ SASL DIGEST-MD5: inherit, props, move, document
* 🚚 Move to sasl directory and SASL namespace. * 🗑️ Deprecate original constant name. * ♻️ Inherit from Authenticator base class. * ♻️ Refactor to the style used in the new ScramAuthenticator. Yes, DIGEST-MD5 is deprecated! But that also means that it is lower risk as a test-bed for refactoring a more complicated challenge/response SASL mechanism, and for developing a reasonable SASL::Authenticator base class. I improved it in several ways: * 🔒 Use SecureRandom for cnonce (not Time.now + insecure PRNG!) * ✨ Default qop=auth (as in RFC) * ✨ User can configure realm, host, service_name, service. * This allows a correct "digest-uri" for non-IMAP clients. * ✨ Enforce requirements for sparam keys (required and no-multiples). However... it's still deprecated, so maybe don't use unless you need to!
1 parent c099f50 commit 28b43c1

File tree

6 files changed

+415
-120
lines changed

6 files changed

+415
-120
lines changed

lib/net/imap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ def starttls(options = {}, verify = true)
996996
# *Deprecated:* <em>Obsolete mechanisms are available for backwards
997997
# compatibility.</em>
998998
#
999-
# For +DIGEST-MD5+ see DigestMD5Authenticator.
999+
# For +DIGEST-MD5+ see SASL::DigestMD5Authenticator.
10001000
#
10011001
# For +LOGIN+, see LoginAuthenticator.
10021002
#

lib/net/imap/authenticators.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ def authenticators
7373
# deprecated
7474
require_relative "authenticators/login"
7575
require_relative "authenticators/cram_md5"
76-
require_relative "authenticators/digest_md5"
76+
require_relative "sasl/digest_md5_authenticator"

lib/net/imap/authenticators/digest_md5.rb

Lines changed: 0 additions & 115 deletions
This file was deleted.

lib/net/imap/sasl/authenticator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module SASL
3131
# *Deprecated:* <em>Obsolete mechanisms are available for backwards
3232
# compatibility.</em>
3333
#
34-
# For +DIGEST-MD5+ see DigestMD5Authenticator.
34+
# For +DIGEST-MD5+ see SASL::DigestMD5Authenticator.
3535
#
3636
# For +LOGIN+, see LoginAuthenticator.
3737
#

0 commit comments

Comments
 (0)