Skip to content

Conversation

sgoeschl
Copy link
Contributor

@sgoeschl sgoeschl commented May 27, 2025

Thanks for your contribution to Apache Commons! Your help is appreciated!

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

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

Please rebase on git master to pick up letting Checktyle catch these formatting issues when running a build.

@sgoeschl
Copy link
Contributor Author

@garydgregory Merged your changes and resolved all issues

@sgoeschl sgoeschl requested a review from garydgregory May 30, 2025 07:43
@mkomko
Copy link

mkomko commented Jul 4, 2025

@garydgregory Reminder, thank you 😅

@sgoeschl
Copy link
Contributor Author

@garydgregory Are you happy with the PR?

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

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

Hi @sgoeschl ,

Please accept my apologies for the delay in reviewing.

I've added some comments.

The biggest problem I see is: How do we know this works? It can't be "trust me".

In other Java projects, I've used KeyCloak (with and without Docker, but using Docker is best) to test OAUth2 support. Why not do this here?

See the libraries com.nimbusds:oauth2-oidc-sdk, org.testcontainers:testcontainers, org.testcontainers:junit-jupiter, com.github.dasniko:testcontainers-keycloak and the Maven plugin io.fabric8:docker-maven-plugin.

public static final String MAIL_SMTP_AUTH = "mail.smtp.auth";

/** If set to true, tries to authenticate the user using an OAuth2 token. */
public static final String MAIL_SMTP_AUTH_MECHANISMS = "mail.smtp.auth.mechanisms";
Copy link
Member

Choose a reason for hiding this comment

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

The Javadoc since tag is missing.


// tests
assertNotNull(mailSession);
assertEquals("XOAUTH2", mailSession.getProperties().getProperty("mail.smtp.auth.mechanisms"));
Copy link
Member

Choose a reason for hiding this comment

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

Reuse EmailConstants.


// tests
assertNotNull(mailSession);
assertEquals("XOAUTH2", mailSession.getProperties().getProperty("mail.smtp.auth.mechanisms"));
Copy link
Member

Choose a reason for hiding this comment

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

Reuse EmailConstants.

}

if (isOAuth2Required()) {
properties.put(EmailConstants.MAIL_SMTP_AUTH_MECHANISMS, "XOAUTH2");
Copy link
Member

Choose a reason for hiding this comment

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

Refactor "XOAUTH2" into a constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants