Enhance mailer to support XOAuth2 authentication #42709
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the most earliest prototype, and it will have to be reworked. It is only for us with Clement to start playing with various setups.
Particularly, with Microsoft, the system message, if it will work, will most likely require a token acquisition request with the system username and password - it is not clear right now if we want to reuse the username and password properties for it or create new ones.
With Google, if it will work, a JWT bearer token grant will be required.
In both cases, for now, a Map of properties is expected to be filled in with the OAuth2/OIDC provider specific properties.
The token url property for this case may be set up later as that Map property or it will be discovered with another webClient call.
For
TokenCredential
(user login driving the token acquisition) to work,Mailer
would need be refactored to accept Paulo'sAuthOperation
dynamically. It will also be required for the refresh token to work cleanly.I'll play around with this code for the next few weeks with Google, Microsoft, specifically trying to see if the system email case can be sorted out.
CC @cescoffier