Class: Net::IMAP::SASL::CramMD5Authenticator
- Inherits:
-
Object
- Object
- Net::IMAP::SASL::CramMD5Authenticator
- Defined in:
- lib/net/imap/sasl/cram_md5_authenticator.rb
Overview
Authenticator for the “CRAM-MD5
” SASL mechanism, specified in RFC2195. See Net::IMAP#authenticate.
Deprecated
CRAM-MD5
is obsolete and insecure. It is included for compatibility with existing servers. draft-ietf-sasl-crammd5-to-historic recommends using SCRAM-*
or PLAIN
protected by TLS instead.
Additionally, RFC8314 discourage the use 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
Instance Method Summary collapse
- #done? ⇒ Boolean
- #initial_response? ⇒ Boolean
-
#initialize(user, password, warn_deprecation: true, **_ignored) ⇒ CramMD5Authenticator
constructor
A new instance of CramMD5Authenticator.
- #process(challenge) ⇒ Object
Constructor Details
#initialize(user, password, warn_deprecation: true, **_ignored) ⇒ CramMD5Authenticator
Returns a new instance of CramMD5Authenticator.
17 18 19 20 21 22 23 24 25 |
# File 'lib/net/imap/sasl/cram_md5_authenticator.rb', line 17 def initialize(user, password, warn_deprecation: true, **_ignored) if warn_deprecation warn "WARNING: CRAM-MD5 mechanism is deprecated." # TODO: recommend SCRAM end require "digest/md5" @user = user @password = password @done = false end |
Instance Method Details
#done? ⇒ Boolean
36 |
# File 'lib/net/imap/sasl/cram_md5_authenticator.rb', line 36 def done?; @done end |
#initial_response? ⇒ Boolean
27 |
# File 'lib/net/imap/sasl/cram_md5_authenticator.rb', line 27 def initial_response?; false end |
#process(challenge) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/net/imap/sasl/cram_md5_authenticator.rb', line 29 def process(challenge) digest = hmac_md5(challenge, @password) return @user + " " + digest ensure @done = true end |