@@ -1182,6 +1182,8 @@ def starttls(**options)
11821182 # +sasl_ir+ allows or disallows sending an "initial response" (see the
11831183 # +SASL-IR+ capability, below).
11841184 #
1185+ # Override +registry+ to use a custom SASL::Authenticators registry.
1186+ #
11851187 # All other arguments are forwarded to the registered SASL authenticator for
11861188 # the requested mechanism. <em>The documentation for each individual
11871189 # mechanism must be consulted for its specific parameters.</em>
@@ -1276,27 +1278,9 @@ def starttls(**options)
12761278 # Previously cached #capabilities will be cleared when this method
12771279 # completes. If the TaggedResponse to #authenticate includes updated
12781280 # capabilities, they will be cached.
1279- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1280- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1281- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1282- cmdargs = [ "AUTHENTICATE" , mechanism ]
1283- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1284- authenticator . respond_to? ( :initial_response? ) &&
1285- authenticator . initial_response?
1286- response = authenticator . process ( nil )
1287- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1288- end
1289- result = send_command_with_continuations ( *cmdargs ) { |data |
1290- challenge = data . unpack1 ( "m" )
1291- response = authenticator . process challenge
1292- [ response ] . pack ( "m0" )
1293- }
1294- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1295- logout!
1296- raise SASL ::AuthenticationIncomplete , result
1297- end
1298- @capabilities = capabilities_from_resp_code result
1299- result
1281+ def authenticate ( ...)
1282+ sasl_adapter . authenticate ( ...)
1283+ . tap { @capabilities = capabilities_from_resp_code _1 }
13001284 end
13011285
13021286 # Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments