Class: Net::SASL::CramMD5Authenticator
- Inherits:
-
Authenticator
- Object
- Authenticator
- Net::SASL::CramMD5Authenticator
- Defined in:
- lib/net/sasl/cram_md5_authenticator.rb
Overview
Authenticator for the “CRAM-MD5
” SASL mechanism, specified in RFC2195.
Deprecated
CRAM-MD5
is obsolete. It is included for compatibility with existing servers. draft-ietf-sasl-crammd5-to-historic recommends using SCRAM-*
or PLAIN
protected by TLS instead.
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(username, password, **_options) ⇒ CramMD5Authenticator
constructor
Provide the
username
andpassword
credentials for authentication. -
#process(challenge) ⇒ Object
responds to the server’s challenge using the HMAC-MD5 algorithm.
Methods inherited from Authenticator
Constructor Details
#initialize(username, password, **_options) ⇒ CramMD5Authenticator
Provide the username
and password
credentials for authentication.
CRAM-MD5 doesn’t support authzid
, and an ArgumentError will be raised if a third positional parameter is passed.
This should generally be instantiated via Net::SASL.authenticator.
31 32 33 34 35 36 |
# File 'lib/net/sasl/cram_md5_authenticator.rb', line 31 def initialize(username, password, **) super @username = username @password = password @done = false end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
20 21 22 |
# File 'lib/net/sasl/cram_md5_authenticator.rb', line 20 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
20 21 22 |
# File 'lib/net/sasl/cram_md5_authenticator.rb', line 20 def username @username end |
Instance Method Details
#process(challenge) ⇒ Object
responds to the server’s challenge using the HMAC-MD5 algorithm.
39 40 41 42 |
# File 'lib/net/sasl/cram_md5_authenticator.rb', line 39 def process(challenge) digest = hmac_md5(challenge, password) "#{username} #{digest}" end |