@@ -1209,6 +1209,8 @@ def starttls(**options)
1209
1209
# +sasl_ir+ allows or disallows sending an "initial response" (see the
1210
1210
# +SASL-IR+ capability, below).
1211
1211
#
1212
+ # Override +registry+ to use a custom SASL::Authenticators registry.
1213
+ #
1212
1214
# All other arguments are forwarded to the registered SASL authenticator for
1213
1215
# the requested mechanism. <em>The documentation for each individual
1214
1216
# mechanism must be consulted for its specific parameters.</em>
@@ -1303,27 +1305,9 @@ def starttls(**options)
1303
1305
# Previously cached #capabilities will be cleared when this method
1304
1306
# completes. If the TaggedResponse to #authenticate includes updated
1305
1307
# capabilities, they will be cached.
1306
- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1307
- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1308
- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1309
- cmdargs = [ "AUTHENTICATE" , mechanism ]
1310
- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1311
- authenticator . respond_to? ( :initial_response? ) &&
1312
- authenticator . initial_response?
1313
- response = authenticator . process ( nil )
1314
- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1315
- end
1316
- result = send_command_with_continuations ( *cmdargs ) { |data |
1317
- challenge = data . unpack1 ( "m" )
1318
- response = authenticator . process challenge
1319
- [ response ] . pack ( "m0" )
1320
- }
1321
- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1322
- logout!
1323
- raise SASL ::AuthenticationIncomplete , result
1324
- end
1325
- @capabilities = capabilities_from_resp_code result
1326
- result
1308
+ def authenticate ( ...)
1309
+ sasl_adapter . authenticate ( ...)
1310
+ . tap { @capabilities = capabilities_from_resp_code _1 }
1327
1311
end
1328
1312
1329
1313
# Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments