Skip to content

Commit d92d2c7

Browse files
committed
♻️ SASL: Add Authenticator base class w/📚docs
* Add many many docs * Add properties, events, and callbacks * Add initial_response? * Add AuthenticationFailure for failures detected by the SASL mechanism. This is different from failures detected by the application protocol, such as when the IMAP server responds with "NO" or "BAD". Currently unused, but existing authenticators will be refactored based on this, and new authenticators will be writte on it.
1 parent ed4786b commit d92d2c7

File tree

3 files changed

+390
-0
lines changed

3 files changed

+390
-0
lines changed

lib/net/imap.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,10 @@ def starttls(options = {}, verify = true)
984984
#
985985
# ==== Supported SASL Mechanisms
986986
#
987+
#--
988+
# n.b. the following table is copied from Net::IMAP::SASL::Authenticator.
989+
#++
990+
#
987991
# +PLAIN+:: See PlainAuthenticator.
988992
# Login using clear-text username and password.
989993
#

lib/net/imap/sasl.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ module SASL
3232
autoload :ProhibitedCodepoint, sasl_stringprep_rb
3333
autoload :BidiStringError, sasl_stringprep_rb
3434

35+
# Error raised when the client SASL::Authenticator determines that it
36+
# cannot complete successfully during a call to Authenticator#process.
37+
#
38+
# Note that most \SASL mechanisms cannot detect or report errors until the
39+
# protocol-specific outcome message, e.g. a tagged response in \IMAP.
40+
# Those authentication errors will be handled or raised by the protocol
41+
# client, e.g. a Net::IMAP::NoResponseError.
42+
class AuthenticationFailure < Error
43+
end
44+
3545
module_function
3646

3747
# See Net::IMAP::StringPrep::SASLprep#saslprep.

0 commit comments

Comments
 (0)