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