@@ -1154,6 +1154,8 @@ def starttls(**options)
11541154 # +sasl_ir+ allows or disallows sending an "initial response" (see the
11551155 # +SASL-IR+ capability, below).
11561156 #
1157+ # Override +registry+ to use a custom SASL::Authenticators registry.
1158+ #
11571159 # All other arguments are forwarded to the registered SASL authenticator for
11581160 # the requested mechanism. <em>The documentation for each individual
11591161 # mechanism must be consulted for its specific parameters.</em>
@@ -1248,27 +1250,9 @@ def starttls(**options)
12481250 # Previously cached #capabilities will be cleared when this method
12491251 # completes. If the TaggedResponse to #authenticate includes updated
12501252 # capabilities, they will be cached.
1251- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1252- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1253- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1254- cmdargs = [ "AUTHENTICATE" , mechanism ]
1255- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1256- authenticator . respond_to? ( :initial_response? ) &&
1257- authenticator . initial_response?
1258- response = authenticator . process ( nil )
1259- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1260- end
1261- result = send_command_with_continuations ( *cmdargs ) { |data |
1262- challenge = data . unpack1 ( "m" )
1263- response = authenticator . process challenge
1264- [ response ] . pack ( "m0" )
1265- }
1266- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1267- logout!
1268- raise SASL ::AuthenticationIncomplete , result
1269- end
1270- @capabilities = capabilities_from_resp_code result
1271- result
1253+ def authenticate ( ...)
1254+ sasl_adapter . authenticate ( ...)
1255+ . tap { @capabilities = capabilities_from_resp_code _1 }
12721256 end
12731257
12741258 # Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments