@@ -1242,6 +1242,8 @@ def starttls(**options)
1242
1242
# +SASL-IR+ capability, below). Defaults to the #config value for
1243
1243
# {sasl_ir}[rdoc-ref:Config#sasl_ir], which defaults to +true+.
1244
1244
#
1245
+ # Override +registry+ to use a custom SASL::Authenticators registry.
1246
+ #
1245
1247
# All other arguments are forwarded to the registered SASL authenticator for
1246
1248
# the requested mechanism. <em>The documentation for each individual
1247
1249
# mechanism must be consulted for its specific parameters.</em>
@@ -1336,29 +1338,9 @@ def starttls(**options)
1336
1338
# Previously cached #capabilities will be cleared when this method
1337
1339
# completes. If the TaggedResponse to #authenticate includes updated
1338
1340
# capabilities, they will be cached.
1339
- def authenticate ( mechanism , *creds ,
1340
- sasl_ir : config . sasl_ir ,
1341
- **props , &callback )
1342
- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1343
- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1344
- cmdargs = [ "AUTHENTICATE" , mechanism ]
1345
- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1346
- authenticator . respond_to? ( :initial_response? ) &&
1347
- authenticator . initial_response?
1348
- response = authenticator . process ( nil )
1349
- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1350
- end
1351
- result = send_command_with_continuations ( *cmdargs ) { |data |
1352
- challenge = data . unpack1 ( "m" )
1353
- response = authenticator . process challenge
1354
- [ response ] . pack ( "m0" )
1355
- }
1356
- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1357
- logout!
1358
- raise SASL ::AuthenticationIncomplete , result
1359
- end
1360
- @capabilities = capabilities_from_resp_code result
1361
- result
1341
+ def authenticate ( *args , sasl_ir : config . sasl_ir , **props , &callback )
1342
+ sasl_adapter . authenticate ( *args , sasl_ir : sasl_ir , **props , &callback )
1343
+ . tap { @capabilities = capabilities_from_resp_code _1 }
1362
1344
end
1363
1345
1364
1346
# Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments