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