@@ -1182,6 +1182,8 @@ def starttls(**options)
1182
1182
# +sasl_ir+ allows or disallows sending an "initial response" (see the
1183
1183
# +SASL-IR+ capability, below).
1184
1184
#
1185
+ # Override +registry+ to use a custom SASL::Authenticators registry.
1186
+ #
1185
1187
# All other arguments are forwarded to the registered SASL authenticator for
1186
1188
# the requested mechanism. <em>The documentation for each individual
1187
1189
# mechanism must be consulted for its specific parameters.</em>
@@ -1276,27 +1278,9 @@ def starttls(**options)
1276
1278
# Previously cached #capabilities will be cleared when this method
1277
1279
# completes. If the TaggedResponse to #authenticate includes updated
1278
1280
# capabilities, they will be cached.
1279
- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1280
- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1281
- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1282
- cmdargs = [ "AUTHENTICATE" , mechanism ]
1283
- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1284
- authenticator . respond_to? ( :initial_response? ) &&
1285
- authenticator . initial_response?
1286
- response = authenticator . process ( nil )
1287
- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1288
- end
1289
- result = send_command_with_continuations ( *cmdargs ) { |data |
1290
- challenge = data . unpack1 ( "m" )
1291
- response = authenticator . process challenge
1292
- [ response ] . pack ( "m0" )
1293
- }
1294
- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1295
- logout!
1296
- raise SASL ::AuthenticationIncomplete , result
1297
- end
1298
- @capabilities = capabilities_from_resp_code result
1299
- result
1281
+ def authenticate ( ...)
1282
+ sasl_adapter . authenticate ( ...)
1283
+ . tap { @capabilities = capabilities_from_resp_code _1 }
1300
1284
end
1301
1285
1302
1286
# Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments