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