@@ -33,11 +33,11 @@ class Authenticators
33
33
def initialize ( use_defaults : false )
34
34
@authenticators = { }
35
35
if use_defaults
36
- add_authenticator "PLAIN " , PlainAuthenticator
37
- add_authenticator "XOAUTH2 " , XOAuth2Authenticator
38
- add_authenticator "LOGIN " , LoginAuthenticator # deprecated
39
- add_authenticator "CRAM -MD5" , CramMD5Authenticator # deprecated
40
- add_authenticator "DIGEST -MD5" , DigestMD5Authenticator # deprecated
36
+ add_authenticator "Plain " , PlainAuthenticator
37
+ add_authenticator "XOAuth2 " , XOAuth2Authenticator
38
+ add_authenticator "Login " , LoginAuthenticator # deprecated
39
+ add_authenticator "Cram -MD5" , CramMD5Authenticator # deprecated
40
+ add_authenticator "Digest -MD5" , DigestMD5Authenticator # deprecated
41
41
end
42
42
end
43
43
@@ -60,8 +60,9 @@ def names; @authenticators.keys end
60
60
# When only a single argument is given, the authenticator class will be
61
61
# lazily loaded from <tt>Net::IMAP::SASL::#{name}Authenticator</tt> (case is
62
62
# preserved and non-alphanumeric characters are removed..
63
- def add_authenticator ( auth_type , authenticator )
64
- @authenticators [ auth_type ] = authenticator
63
+ def add_authenticator ( name , authenticator )
64
+ key = name . upcase . to_sym
65
+ @authenticators [ key ] = authenticator
65
66
end
66
67
67
68
# :call-seq:
@@ -81,7 +82,7 @@ def add_authenticator(auth_type, authenticator)
81
82
# only. Protocol client users should see refer to their client's
82
83
# documentation, e.g. Net::IMAP#authenticate.
83
84
def authenticator ( mechanism , ...)
84
- auth = @authenticators . fetch ( mechanism . upcase ) do
85
+ auth = @authenticators . fetch ( mechanism . upcase . to_sym ) do
85
86
raise ArgumentError , 'unknown auth type - "%s"' % mechanism
86
87
end
87
88
auth . respond_to? ( :new ) ? auth . new ( ...) : auth . call ( ...)
0 commit comments