Skip to content

Commit 15c885b

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 d3044c6 commit 15c885b

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
@@ -980,6 +980,10 @@ def starttls(options = {}, verify = true)
980980
#
981981
# ==== Supported SASL Mechanisms
982982
#
983+
#--
984+
# n.b. the following table is copied from Net::IMAP::SASL::Authenticator.
985+
#++
986+
#
983987
# +PLAIN+:: See PlainAuthenticator.
984988
# Login using clear-text username and password.
985989
#

lib/net/imap/sasl.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ module SASL
2828
autoload :StringPrep, File.expand_path("sasl/stringprep", __dir__)
2929
autoload :SASLprep, File.expand_path("#{__dir__}/sasl/saslprep", __dir__)
3030

31+
# Error raised when the client SASL::Authenticator determines that it
32+
# cannot complete successfully during a call to Authenticator#process.
33+
#
34+
# Note that most \SASL mechanisms cannot detect or report errors until the
35+
# protocol-specific outcome message, e.g. a tagged response in \IMAP.
36+
# Those authentication errors will be handled or raised by the protocol
37+
# client, e.g. a Net::IMAP::NoResponseError.
38+
class AuthenticationFailure < Error
39+
end
40+
3141
# ArgumentError raised when +string+ is invalid for the stringprep
3242
# +profile+.
3343
class StringPrepError < ArgumentError

0 commit comments

Comments
 (0)