Skip to content

Commit

Permalink
✨ Add registry option to #authenticate
Browse files Browse the repository at this point in the history
This allows authenticator lookup and creation to be overridden, rather
than be forced to depend on global defaults.
  • Loading branch information
nevans committed Oct 2, 2023
1 parent c9d4e5b commit ae754e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1247,9 +1247,12 @@ def starttls(**options)
# Previously cached #capabilities will be cleared when this method
# completes. If the TaggedResponse to #authenticate includes updated
# capabilities, they will be cached.
def authenticate(mechanism, *args, sasl_ir: true, **kwargs, &block)
def authenticate(mechanism, *args,
sasl_ir: true,
registry: SASL.authenticators,
**kwargs, &block)
mechanism = mechanism.to_s.tr("_", "-").upcase
authenticator = SASL.authenticator(mechanism, *args, **kwargs, &block)
authenticator = registry.new(mechanism, *args, **kwargs, &block)
SASL::IMAPAdapter.authenticate(self, mechanism, authenticator,
sasl_ir: sasl_ir,
&method(:send_command_with_continuations))
Expand Down

0 comments on commit ae754e4

Please sign in to comment.