8000 Sending Mails via SMTP and XOAUTH2 authentication mechanism by srose · Pull Request #36665 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Sending Mails via SMTP and XOAUTH2 authentication mechanism - #36665

Merged
mposolda merged 1 commit into
keycloak:mainfrom
srose:feat/17432-smtp-oauth
Mar 21, 2025
Merged

mposolda merged 1 commit into
keycloak:mainfrom
srose:feat/17432-smtp-oauth

Conversation

@srose
@srose srose commented Jan 21, 2025
Copy link
Copy Markdown
Contributor

Closes #17432

First draft, gathering tokens from additional settings, make existing tests work.

Find a way for testing looks compilcated after some hours.

@srose
srose force-pushed the feat/17432-smtp-oauth branch 2 times, most recently from 2c30746 to 765ca32 Compare January 24, 2025 07:39
@srose
srose force-pushed the feat/17432-smtp-oauth branch 2 times, most recently from bc00a5f to 4d73f47 Compare January 31, 2025 17:13
@srose
srose commented Jan 31, 2025
Copy link
Copy Markdown
Contributor Author

Added a test that waits for a merge of greenmail-mail-test/greenmail#838.

Testing with a real SMTP service providing token based auth follows.

@srose
srose force-pushed the feat/17432-smtp-oauth branch 5 times, most recently from fe0b22e to b1171b6 Compare February 5, 2025 18:07
@srose
srose force-pushed the feat/17432-smtp-oauth branch 2 times, most recently from 7c8b16d to 17abcd7 Compare February 9, 2025 20:15
@srose
srose force-pushed the feat/17432-smtp-oauth branch 3 times, most recently from e399184 to c9fd818 Compare February 17, 2025 07:29
@ahus1
ahus1 commented Feb 17, 2025
Copy link
Copy Markdown
Member

This PR is IMHO already in a good shape: The functionality looks good, the are tests, the tests are green (the one failure is the external link check that is unrelated).

After talking to @srose, may someone from the @keycloak/core-iam teams have a look? If this should be a @keycloak/core-clients issue instead, please let me know.

@jonkoops
Copy link
Copy Markdown
Contributor

+1 considering the upvotes from the community on the issue we should consider this for review with a higher priority. I am going to triage the original issue as such and assign it to a milestone so it is handled before release of the next minor.

@jonkoops
jonkoops force-pushed the feat/17432-smtp-oauth branch from c9fd818 to cb9b2de Compare February 17, 2025 11:46
@jonkoops
Copy link
Copy Markdown
Contributor

@srose mind if we mark this one as ready for review, or do you believe more work is needed?

@srose
srose commented Feb 17, 2025
Copy link
Copy Markdown
Contributor Author

@jonkoops thank you and @ahus1 for looking into it, feedback would be great! Despite having a GreenMail way of testing I was not able to find a working SMTP + XOAUTH2 service to have a real world test. Thats the reason for leaving it at the draft-state. Please proceed, Review feedback would be great and we can go back to draft if necessary?

@jonkoops
jonkoops marked this pull request as ready for review February 18, 2025 11:13
@jonkoops
jonkoops requested review from a team as code owners February 18, 2025 11:13
@srose
srose force-pushed the feat/17432-smtp-oauth branch 2 times, most recently from f507752 to be671d3 Compare March 14, 2025 12:55
jonkoops
jonkoops previously approved these changes Mar 17, 2025
@jonkoops jonkoops left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

edewit
edewit previously approved these changes Mar 17, 2025
@jonkoops
Copy link
Copy Markdown
Contributor

@srose could you do another rebase? It seems some conflicts have popped up.

@srose
srose dismissed stale reviews from edewit and jonkoops via d7642df March 17, 2025 12:33
@srose
srose force-pushed the feat/17432-smtp-oauth branch from be671d3 to d7642df Compare March 17, 2025 12:33
@srose
srose commented Mar 17, 2025
Copy link
Copy Markdown
Contributor Author

Rebase done 👍

jonkoops
jonkoops previously approved these changes Mar 17, 2025
@ahus1
ahus1 commented Mar 17, 2025
Copy link
Copy Markdown
Member

TimeOffsetTest might be unstable, I created issue #38180 for that.

@jonkoops
jonkoops force-pushed the feat/17432-smtp-oauth branch from d7642df to 95bf84e Compare March 18, 2025 15:28
@srose
srose force-pushed the feat/17432-smtp-oauth branch from 95bf84e to 15b2a91 Compare March 19, 2025 11:41
@srose
srose commented Mar 19, 2025 •
Copy link
Copy Markdown
Contributor Author

Improved the documentation to help configuration of existing providers and rebased with conflicts once more.

jonkoops
jonkoops previously approved these changes Mar 20, 2025
@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srose Nice! Sorry it took longer to review, but I hope we can manage to make it for Keycloak 26.2.0 (preliminary planned for end of March).

I've added few minor comments inline (no big deals). Besides that, it can be needed to rebase as there is conflict in release notes (Hint: Better to add your release notes somewhere in the middle rather than to the bottom as it decrease the probability of conflict :-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constructor public DefaultEmailSenderProvider(KeycloakSession session) { can be removed entirely in this PR. We don't need to keep backwards compatibility for the code inside keycloak-services module as those are internal classes. There are some subclasses of DefaultEmailSenderPRovider in the testsuite, but I see you already updated them, so this constructor could be simply deleted as it is not used anywhere AFAIK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK not so preferred to use var in the Keycloak Java codebase (my vote is to update this var in here as in other places in this PR, but not strictly needed as we don't have policy yet for Keycloak to not using var, so if you strongly prefer to keep it, feel free to keep...).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I think consistency is a good thing I tried to remove all 'var' introduced by me. Thanks for the hint.

@ahus1
ahus1 commented Mar 20, 2025 •
Copy link
Copy Markdown
Member

(Hint: Better to add your release notes somewhere in the middle rather than to the bottom as it decrease the probability of conflict :-)

@srose / @mposolda - Stian updated the release notes by priority as a preparation for the release. That being said, add your release note updates rather to the end of the file when you rebase the PR (at least this time).

Closes keycloak#17432

Signed-off-by: Sebastian Rose <sebastian.rose@gmail.com>
@srose
srose commented Mar 20, 2025
Copy link
Copy Markdown
Contributor Author

@mposolda Thank you for taking the time to give it a detailed look. Feedback is very welcome and worked on both comments.
@ahus1 Releasnotes moved to the end, thank you.

@mposolda
Copy link
Copy Markdown
Contributor

@srose Thanks for the updates!
@ahus1 Thanks for the point regarding the release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for SMTP OAuth 2.0 authentication for outgoing email

5 participants

0