@@ -1209,6 +1209,8 @@ def starttls(**options)
12091209 # +sasl_ir+ allows or disallows sending an "initial response" (see the
12101210 # +SASL-IR+ capability, below).
12111211 #
1212+ # Override +registry+ to use a custom SASL::Authenticators registry.
1213+ #
12121214 # All other arguments are forwarded to the registered SASL authenticator for
12131215 # the requested mechanism. <em>The documentation for each individual
12141216 # mechanism must be consulted for its specific parameters.</em>
@@ -1303,27 +1305,9 @@ def starttls(**options)
13031305 # Previously cached #capabilities will be cleared when this method
13041306 # completes. If the TaggedResponse to #authenticate includes updated
13051307 # capabilities, they will be cached.
1306- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1307- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1308- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1309- cmdargs = [ "AUTHENTICATE" , mechanism ]
1310- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1311- authenticator . respond_to? ( :initial_response? ) &&
1312- authenticator . initial_response?
1313- response = authenticator . process ( nil )
1314- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1315- end
1316- result = send_command_with_continuations ( *cmdargs ) { |data |
1317- challenge = data . unpack1 ( "m" )
1318- response = authenticator . process challenge
1319- [ response ] . pack ( "m0" )
1320- }
1321- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1322- logout!
1323- raise SASL ::AuthenticationIncomplete , result
1324- end
1325- @capabilities = capabilities_from_resp_code result
1326- result
1308+ def authenticate ( ...)
1309+ sasl_adapter . authenticate ( ...)
1310+ . tap { @capabilities = capabilities_from_resp_code _1 }
13271311 end
13281312
13291313 # Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments