Issue 53534: Support Microsoft's Graph Protocol API for authentication via OAuth2 token#7381
Issue 53534: Support Microsoft's Graph Protocol API for authentication via OAuth2 token#7381labkey-bpatel wants to merge 23 commits intodevelopfrom
Conversation
… a provider-based abstraction for email transport. Refactor the existing SMTP logic into its own provider. Manage OAuth2 token caching. Enforce that only one transport method can be configured.
…o fb_mail_transport_via_graph
…test, update emailTest.jsp to manually test Graph credentials, add an action to test uploads >= 4MB.
|
WARNING: This PR appears to have the default title generated by GitHub. Please use something more descriptive. |
…date testing. Add comments.
| */ | ||
| @AdminConsoleAction | ||
| @RequiresPermission(AdminOperationsPermission.class) | ||
| public class EmailTestWithAttachmentAction extends FormHandlerAction<EmailTestForm> |
There was a problem hiding this comment.
I created this test action to test HTML content, attachments, and data URI images - scenarios that could hit Graph's size constraints. Should this remain separate for clarity, or would it be better to repurpose/extend EmailTestAction to test HTML/attachments for both transports?
| import static org.mockito.ArgumentMatchers.any; | ||
| import static org.mockito.ArgumentMatchers.anyString; | ||
| import static org.mockito.Mockito.doNothing; | ||
| import static org.mockito.Mockito.mock; | ||
| import static org.mockito.Mockito.never; | ||
| import static org.mockito.Mockito.verify; | ||
| import static org.mockito.Mockito.when; |
There was a problem hiding this comment.
How much trouble would it be to switch these to use JMock. We shouldn't pull in a new mocking library unless necessary.
There was a problem hiding this comment.
Converted to JMock
…h external URL images and data URI images.
| private void setUpBasicExpectations() | ||
| { | ||
| mockery.checking(new Expectations() {{ |
There was a problem hiding this comment.
Why isn't setUpBasicExpectations part of setUp? It looks like all of the @Test methods are calling it at or near their starts.
Rationale
Microsoft plans to retire SMTP Basic Authentication in March 2026. In response, one of our clients’ IT department has requested a shift to OAuth-based authentication
Since SMTP Oauth 2.0 client credential flow with non-interactive sign-in (for email notifications) is not supported we’ll need to use Microsoft’s Graph API instead of SMTP protocol
This PR adds a Graph transport method as an alternative to SMTP, which enables mail delivery via OAuth2 authentication method.
Spec
Related Pull Requests
Changes
Tasks 📍