File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,24 @@ def authenticators; @authenticators.dup end
20
20
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
21
21
# implemented by +authenticator+ (for instance, <tt>"PLAIN"</tt>).
22
22
#
23
+ # If +mechanism+ refers to an existing authenticator, a warning will be
24
+ # printed and the old authenticator will be replaced.
25
+ #
23
26
# The +authenticator+ must respond to +#new+ (or #call), receiving the
24
27
# authenticator configuration and return a configured authentication session.
25
28
# The authenticator session must respond to +#process+, receiving the server's
26
29
# challenge and returning the client's response.
27
30
#
28
31
# See PlainAuthenticator, XOauth2Authenticator, and DigestMD5Authenticator for
29
32
# examples.
30
- def add_authenticator ( mechanism , authenticator )
31
- @authenticators [ mechanism . upcase ] = authenticator
33
+ def add_authenticator ( mechanism , authenticator , warn_overwrite : true )
34
+ mechanism = mechanism . to_str
35
+ upcased = mechanism . upcase
36
+ if warn_overwrite && ( original = authenticators [ upcased ] )
37
+ warn ( "%p: replacing %p authenticator: %p" % [ self , upcased , original ] ,
38
+ uplevel : 1 )
39
+ end
40
+ @authenticators [ upcased ] = authenticator
32
41
end
33
42
34
43
# :call-seq:
You can’t perform that action at this time.
0 commit comments