forked from ruby/net-smtp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add forward-compatible API for SASL mechanisms
The current #start and #authenticate API can't fully support every SASL mechanism. Some SASL mechanisms do not require a +username+ (OAUTHBEARER, EXTERNAL, ANONYMOUS) or a +secret+ (EXTERNAL, ANONYMOUS). Many SASL mechanisms will need to take extra arguments (e.g: `authzid` for many mechanisms, `warn_deprecations` for deprecated mechanisms, `min_iterations` for SCRAM-*, `anonymous_message` for ANONYMOUS), and so on. And, although it is convenient to use +username+ as an alias for +authcid+ or +authzid+ and +secret+ as an alias for +password+ or +oauth2_token+, it can also be useful to have keyword parameters that keep stable semantics across many different mechanisms. A SASL-compatible API must first find the authenticator for the mechanism and then delegate any arbitrary parameters to that authenticator. Practically, that means that the mechanism name must either be the first positional parameter or a keyword parameter, and then every other parameter can be forwarded. `Net::SMTP#auth` does this. Also, an `auth` keyword parameter has been added to `Net::SMTP#start`, allowing `start` to pass any arbitrary keyword parameters into `#auth`. For backward compatibility, when one of the existing Authenticator classes is selected, it converts keyword args to positional args. Also for backward compatibility, `Net::SMTP#authenticate` keeps its v0.4.0 implementation.
- Loading branch information
Showing
2 changed files
with
136 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters