@@ -1157,6 +1157,8 @@ def starttls(**options)
1157
1157
# +sasl_ir+ allows or disallows sending an "initial response" (see the
1158
1158
# +SASL-IR+ capability, below).
1159
1159
#
1160
+ # Override +registry+ to use a custom SASL::Authenticators registry.
1161
+ #
1160
1162
# All other arguments are forwarded to the registered SASL authenticator for
1161
1163
# the requested mechanism. <em>The documentation for each individual
1162
1164
# mechanism must be consulted for its specific parameters.</em>
@@ -1251,27 +1253,9 @@ def starttls(**options)
1251
1253
# Previously cached #capabilities will be cleared when this method
1252
1254
# completes. If the TaggedResponse to #authenticate includes updated
1253
1255
# capabilities, they will be cached.
1254
- def authenticate ( mechanism , *creds , sasl_ir : true , **props , &callback )
1255
- mechanism = mechanism . to_s . tr ( "_" , "-" ) . upcase
1256
- authenticator = SASL . authenticator ( mechanism , *creds , **props , &callback )
1257
- cmdargs = [ "AUTHENTICATE" , mechanism ]
1258
- if sasl_ir && capable? ( "SASL-IR" ) && auth_capable? ( mechanism ) &&
1259
- authenticator . respond_to? ( :initial_response? ) &&
1260
- authenticator . initial_response?
1261
- response = authenticator . process ( nil )
1262
- cmdargs << ( response . empty? ? "=" : [ response ] . pack ( "m0" ) )
1263
- end
1264
- result = send_command_with_continuations ( *cmdargs ) { |data |
1265
- challenge = data . unpack1 ( "m" )
1266
- response = authenticator . process challenge
1267
- [ response ] . pack ( "m0" )
1268
- }
1269
- if authenticator . respond_to? ( :done? ) && !authenticator . done?
1270
- logout!
1271
- raise SASL ::AuthenticationIncomplete , result
1272
- end
1273
- @capabilities = capabilities_from_resp_code result
1274
- result
1256
+ def authenticate ( ...)
1257
+ sasl_adapter . authenticate ( ...)
1258
+ . tap { @capabilities = capabilities_from_resp_code _1 }
1275
1259
end
1276
1260
1277
1261
# Sends a {LOGIN command [IMAP4rev1 §6.2.3]}[https://www.rfc-editor.org/rfc/rfc3501#section-6.2.3]
0 commit comments