@@ -1333,29 +1333,9 @@ def starttls(**options)
13331333 # Previously cached #capabilities will be cleared when this method
13341334 # completes. If the TaggedResponse to #authenticate includes updated
13351335 # capabilities, they will be cached.
1336- def authenticate ( mechanism , *creds ,
1337- sasl_ir : config . sasl_ir ,
1338- **props , &callback )
1339- mechanism = SASL ::Authenticators . normalize_name ( mechanism )
1340- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1341- cmdargs = [ "AUTHENTICATE" , mechanism ]
1342- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1343- authenticator . respond_to? ( :initial_response? ) &&
1344- authenticator . initial_response?
1345- response = authenticator . process ( nil )
1346- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1347- end
1348- result = send_command_with_continuations ( *cmdargs ) { |data |
1349- challenge = data . unpack1 ( "m" )
1350- response = authenticator . process challenge
1351- [ response ] . pack ( "m0" )
1352- }
1353- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1354- logout!
1355- raise SASL ::AuthenticationIncomplete , result
1356- end
1357- @capabilities = capabilities_from_resp_code result
1358- result
1336+ def authenticate ( *args , sasl_ir : config . sasl_ir , **props , &callback )
1337+ sasl_adapter . authenticate ( *args , sasl_ir : sasl_ir , **props , &callback )
1338+ . tap { @capabilities = capabilities_from_resp_code _1 }
13591339 end
13601340
13611341 # Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments