Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward-compatible SASL API #68

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Apr 9, 2024

  1. Configuration menu
    Copy the full SHA
    3e72a95 View commit details
    Browse the repository at this point in the history
  2. Add auth keyword arg to start methods

    This adds a new `auth` keyword param to `Net::SMTP.start` and `#start`
    that can be used to pass any arbitrary keyword parameters to
    `#authenticate`.  The pre-existing `username`, `secret`, etc keyword
    params will retain their existing behavior as positional arguments to
    `#authenticate`.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    7a6f2f1 View commit details
    Browse the repository at this point in the history
  3. Add username keyword param to start

    Although "user" is a reasonable abbreviation, the parameter is more
    accurately described as a "username" or an "authentication identity".
    They are synonomous here, with "username" winning when both are present.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    33395bc View commit details
    Browse the repository at this point in the history
  4. Add keyword parameters to authenticators

    Username can be set by args[0], authcid, username, or user.
    Secret can be set by args[1], secret, or password.
    
    Since all of the existing authenticators have the same API, it is
    sufficient to update `check_args` in the base class.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    f1fea49 View commit details
    Browse the repository at this point in the history
  5. Do not require positional args for #authenticate

    This API is a little bit confusing, IMO.  But it does preserve backward
    compatibility, while allowing authenticators that don't allow positional
    parameters to work without crashing.  But, authenticators that require
    only one parameter—or more than three—will still be inaccessible.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    54ae43d View commit details
    Browse the repository at this point in the history
  6. Add type keyword arg to #authenticate

    This is convenient for `smtp.start auth: {type:, **etc}`.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    a47a7c3 View commit details
    Browse the repository at this point in the history
  7. Add #auth method for SASL authentication

    Although `#authenticate` can be updated to make username and secret
    _both_ optional, by placing the mechanism last and making it optional,
    it's not possible to use an authenticator with a _single_ positional
    parameter or with more than two positional parameters.  By placing
    `type` first among positional parameters or as a keyword argument, we
    avoid this problem.
    nevans committed Apr 9, 2024
    Configuration menu
    Copy the full SHA
    d8cc256 View commit details
    Browse the repository at this point in the history