Skip to content

Commit 36af6b1

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 38f704d commit 36af6b1

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
@@ -985,7 +985,7 @@ def starttls(options = {}, verify = true)
985985
# *Deprecated:* <em>Obsolete mechanisms are available for backwards
986986
# compatibility.</em>
987987
#
988-
# For +DIGEST-MD5+ see DigestMD5Authenticator.
988+
# For +DIGEST-MD5+ see SASL::DigestMD5Authenticator.
989989
#
990990
# For +LOGIN+, see LoginAuthenticator.
991991
#

lib/net/imap/authenticators.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ def authenticators
6969
# deprecated
7070
require_relative "authenticators/login"
7171
require_relative "authenticators/cram_md5"
72-
require_relative "authenticators/digest_md5"
72+
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)