Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c778ac9
Implement email transport using the Microsoft Graph API and introduce…
labkey-bpatel Jan 20, 2026
f054865
Merge remote-tracking branch 'origin/develop' into fb_mail_transport_…
labkey-bpatel Jan 26, 2026
e855f46
Add dependencies. Updates for testing.
labkey-bpatel Jan 26, 2026
0e69360
Create getters for the URLs.
labkey-bpatel Jan 27, 2026
f10f466
Remove unused dependencies.
labkey-bpatel Jan 28, 2026
2aa8590
Merge remote-tracking branch 'origin/fb_mail_transport_via_graph' int…
labkey-bpatel Jan 28, 2026
34ef547
Add confirmation that an email was sent successfully.
labkey-bpatel Jan 30, 2026
8400794
Merge remote-tracking branch 'origin/develop' into fb_mail_transport_…
labkey-bpatel Feb 2, 2026
e481448
Dependencies and versions
labkey-bpatel Feb 3, 2026
69bec71
Add a helper for adding a file attachment
labkey-bpatel Feb 3, 2026
565d551
Use Microsoft SDK to send messages and upload attachments, add junit …
labkey-bpatel Feb 3, 2026
f075819
add comments
labkey-bpatel Feb 3, 2026
1459fe2
add comment
labkey-bpatel Feb 3, 2026
35bbddc
Handle data URIs in HTML to comply with Graph's 4MB request limit. Up…
labkey-bpatel Feb 4, 2026
a697223
Merge remote-tracking branch 'origin/develop' into fb_mail_transport_…
labkey-bpatel Feb 5, 2026
ce46a1a
Remove mockito
labkey-bpatel Feb 5, 2026
9606396
Updates with JMock
labkey-bpatel Feb 5, 2026
5757b1b
Use DataHandler to get the correct content type. Update test with bot…
labkey-bpatel Feb 8, 2026
4998a7b
Exclude dependency on msal4j-persistence-extension
labkey-bpatel Feb 9, 2026
0351964
Merge remote-tracking branch 'origin/develop' into fb_mail_transport_…
labkey-bpatel Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,40 @@ dependencies {
)
)

// Microsoft Graph SDK for sending OAuth2-authenticated notification emails
BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"com.microsoft.graph:microsoft-graph:${microsoftGraphVersion}",
"Microsoft Graph SDK",
"Microsoft",
"https://github.com/microsoftgraph/msgraph-sdk-java",
"MIT License",
"https://opensource.org/licenses/MIT",
"Library to interact with Microsoft Graph API including sending emails",
)
)

// Azure Identity library for OAuth2 token authentication and built-in token management capabilities
BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"com.azure:azure-identity:${azureIdentityVersion}",
"Azure Identity Library",
"Microsoft",
"https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity",
"MIT License",
"https://opensource.org/licenses/MIT",
"Library to handle OAuth2 authentication with Microsoft’s identity platform",
),
{
// This module pulls in JNA for native OS credential store access; but its not needed for
// client credentials flow as it uses in-memory token caching. The version of JNA that gets
// pulled in here conflicts with the JNA version used by the docker module.
exclude group: "com.microsoft.azure", module: "msal4j-persistence-extension"
}
)

BuildUtils.addExternalDependency(
project,
new ExternalDependency(
Expand Down
2 changes: 2 additions & 0 deletions api/src/org/labkey/api/ApiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
import org.labkey.api.util.FileStream;
import org.labkey.api.util.FileType;
import org.labkey.api.util.FileUtil;
import org.labkey.api.util.GraphTransportProvider;
import org.labkey.api.util.HelpTopic;
import org.labkey.api.util.JSoupUtil;
import org.labkey.api.util.JobRunner;
Expand Down Expand Up @@ -397,6 +398,7 @@ public void registerServlets(ServletContext servletCtx)
FileType.TestCase.class,
FileUtil.TestCase.class,
GenerateUniqueDataIterator.TestCase.class,
GraphTransportProvider.TestCase.class,
HelpTopic.TestCase.class,
InlineInClauseGenerator.TestCase.class,
JSONDataLoader.HeaderMatchTest.class,
Expand Down
57 changes: 57 additions & 0 deletions api/src/org/labkey/api/util/EmailTransportProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2026 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.labkey.api.util;

import jakarta.mail.Message;
import jakarta.mail.MessagingException;

import java.util.Properties;

/**
* Interface for email transport providers (SMTP, Microsoft Graph, etc.).
* Implementations handle configuration loading and message sending.
*/
public interface EmailTransportProvider
{
/**
* @return the display name of this provider for logging purposes
*/
String getName();

/**
* Load configuration from startup properties and/or ServletContext.
* Called once during initialization.
*/
void loadConfiguration();

/**
* @return true if this provider is fully configured and ready to send email
*/
boolean isConfigured();

/**
* Send an email message using this transport.
*
* @param message the message to send
* @throws MessagingException if sending fails
*/
void send(Message message) throws MessagingException;

/**
* @return the configuration properties for this provider
*/
Properties getProperties();
}
Loading