Skip to content

Commit 40e571b

Browse files
committed
✨ Add registry option to #authenticate
This allows authenticator lookup and creation to be overridden, rather than be forced to depend on global defaults.
1 parent c10518b commit 40e571b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/net/imap.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,9 +1247,12 @@ def starttls(**options)
12471247
# Previously cached #capabilities will be cleared when this method
12481248
# completes. If the TaggedResponse to #authenticate includes updated
12491249
# capabilities, they will be cached.
1250-
def authenticate(mechanism, *args, sasl_ir: true, **kwargs, &block)
1250+
def authenticate(mechanism, *args,
1251+
sasl_ir: true,
1252+
registry: SASL.authenticators,
1253+
**kwargs, &block)
12511254
mechanism = mechanism.to_s.tr("_", "-").upcase
1252-
authenticator = SASL.authenticator(mechanism, *args, **kwargs, &block)
1255+
authenticator = registry.new(mechanism, *args, **kwargs, &block)
12531256
SASL::IMAPAdapter.authenticate(self, mechanism, authenticator,
12541257
sasl_ir: sasl_ir,
12551258
&method(:send_command_with_continuations))

0 commit comments

Comments
 (0)