class Net::IMAP::SASL::CramMD5Authenticator
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
Public Class Methods
new(user = nil, pass = nil, authcid: nil, username: nil, password: nil, secret: nil, warn_deprecation: true, **)
click to toggle source
# File lib/net/imap/sasl/cram_md5_authenticator.rb, line 17 def initialize(user = nil, pass = nil, authcid: nil, username: nil, password: nil, secret: nil, warn_deprecation: true, **) if warn_deprecation warn "WARNING: CRAM-MD5 mechanism is deprecated.", category: :deprecated end require "digest/md5" @user = authcid || username || user @password = password || secret || pass @done = false end
Public Instance Methods
done?
click to toggle source
# File lib/net/imap/sasl/cram_md5_authenticator.rb, line 40 def done?; @done end
initial_response?
click to toggle source
# File lib/net/imap/sasl/cram_md5_authenticator.rb, line 31 def initial_response?; false end
process(challenge)
click to toggle source
# File lib/net/imap/sasl/cram_md5_authenticator.rb, line 33 def process(challenge) digest = hmac_md5(challenge, @password) return @user + " " + digest ensure @done = true end