-
Notifications
You must be signed in to change notification settings - Fork 121
EMAIL-163 Support for OAuth2 authentication #354
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
base: master
Are you sure you want to change the base?
Conversation
…s/EMAIL-163 # Conflicts: # src/changes/changes.xml
commons-email2-jakarta/src/main/java/org/apache/commons/mail2/jakarta/Email.java
Outdated
Show resolved
Hide resolved
commons-email2-jakarta/src/main/java/org/apache/commons/mail2/jakarta/Email.java
Outdated
Show resolved
Hide resolved
commons-email2-javax/src/main/java/org/apache/commons/mail2/javax/Email.java
Outdated
Show resolved
Hide resolved
commons-email2-javax/src/main/java/org/apache/commons/mail2/javax/Email.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
@garydgregory Merged your changes and resolved all issues |
@garydgregory Reminder, thank you 😅 |
@garydgregory Are you happy with the PR? |
There was a problem hiding this 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"; |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
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")); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
mvn
; that'smvn
on the command line by itself.