File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,22 @@ module Net::IMAP::Authenticators
77 # {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
88 # implemented by +authenticator+ (for instance, <tt>"PLAIN"</tt>).
99 #
10+ # If +mechanism+ refers to an existing authenticator, a warning will be
11+ # printed and the old authenticator will be replaced.
12+ #
1013 # The +authenticator+ must respond to +#new+ (or #call), receiving the
1114 # authenticator configuration and return a configured authentication session.
1215 # The authenticator session must respond to +#process+, receiving the server's
1316 # challenge and returning the client's response.
1417 #
1518 # See PlainAuthenticator, XOauth2Authenticator, and DigestMD5Authenticator for
1619 # examples.
17- def add_authenticator ( auth_type , authenticator )
18- authenticators [ auth_type ] = authenticator
20+ def add_authenticator ( mechanism , authenticator , warn_overwrite : true )
21+ if warn_overwrite && ( original = authenticators [ mechanism ] )
22+ warn ( "%p: replacing %p authenticator: %p" % [ self , mechanism , original ] ,
23+ uplevel : 1 )
24+ end
25+ authenticators [ mechanism ] = authenticator
1926 end
2027
2128 # :call-seq:
You can’t perform that action at this time.
0 commit comments