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

🔒⚗️ Add experimental SASL::ClientAdapter #183

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Sep 26, 2023

This adds some complexity over the IMAP implementation, but it simplifies sharing the implementation between net-imap, net-smtp, and hopefully many others in the future.

SASL.initial_response? and SASL.done? have been removed without deprecation (they haven't been in any release yet). The logic has been moved into SASL::ClientAdapter. Done in #184.

#initial_response? was added to the deprecated authenticators. It isn't required that authenticators implement this method, but it simplifies the tests, now that SASL.initial_response? is gone. Done in #184.

This PR has been updated to only create the SASL::ClientAdapter. Actually using it has been pushed off until a later PR: #194.

@nevans nevans added the SASL 🔒 Authentication and authentication mechanisms label Sep 26, 2023
@nevans nevans requested review from hsbt and shugo September 26, 2023 15:25
@nevans nevans force-pushed the sasl/abstract-protocol branch 9 times, most recently from 4af88b3 to 5a72913 Compare October 4, 2023 13:53
@nevans nevans force-pushed the sasl/abstract-protocol branch 2 times, most recently from 6fc2d1e to 60651db Compare October 9, 2023 20:31
_The API is **experimental.**_

TODO: catch exceptions in #process and send #cancel_string.
TODO: raise an error if the command succeeds after being canceled.
TODO: use with more clients, to verify the API can accommodate them.

An abstract base class for executing a SASL authentication exchange for
a client.  Subclasses works as an adapter for a protocol and a client
implementation of that protocol.

Call `#authenticate` to execute an authentication exchange for `#client`
using `#authenticator`.  Authentication failures will raise an
exception.  Any exceptions other than those in RESPONSE_ERRORs will also
drop the connection.

Methods for subclasses to override are all documented as `protected`.
At the very least, subclasses must provide an override (or a block) for
`#send_command_with_continuations`.  Client-specific overrides may also
be needed for `RESPONSE_ERRORS`, `#supports_initial_response?`,
`#supports_mechanism?`, `#handle_incomplete`, or `#drop_connection`.
@nevans nevans force-pushed the sasl/abstract-protocol branch 2 times, most recently from 2a55ec3 to 51b12d6 Compare October 9, 2023 20:42
@nevans nevans marked this pull request as ready for review October 9, 2023 20:44
@nevans
Copy link
Collaborator Author

nevans commented Oct 9, 2023

This PR has been updated to only create the SASL::ClientAdapter. Actually using it has been pushed off until later (#194). So I see this PR as very low risk.

On the other hand, I have been using this code from other projects and I would like to submit PRs to some of them. And that will be greatly simplified once it is in a released gem.

@nevans nevans merged commit ba08aa9 into ruby:master Oct 9, 2023
11 checks passed
@nevans nevans deleted the sasl/abstract-protocol branch October 10, 2023 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SASL 🔒 Authentication and authentication mechanisms
Development

Successfully merging this pull request may close these issues.

1 participant