Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ npmWorkDirectory=.node
# gradle.properties file to declare these version numbers. Naming
# convention is <library name>Version camel-cased, i.e. "jacksonVersion".

activationApiVersion=2.1.3
angusActivationVersion=2.0.2
angusMailVersion=2.0.3

annotationsVersion=15.0

Expand Down Expand Up @@ -200,7 +201,6 @@ jamaVersion=1.0.3

javassistVersion=3.20.0-GA

javaMailVersion=2.0.1
javaxAnnotationVersion=1.3.2

# cloud, pipeline, query, and tests (sardine) use the old JAXB API and runtime versions
Expand Down
2 changes: 0 additions & 2 deletions server/embedded/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ dependencies {
}

runtimeOnly "org.apache.tomcat.embed:tomcat-embed-jasper:${apacheTomcatVersion}"
runtimeOnly group: "com.sun.mail", name: "jakarta.mail", version: "${javaMailVersion}"
runtimeOnly group: "org.apache.tomcat", name: "tomcat-dbcp", version: "${apacheTomcatVersion}"
runtimeOnly "org.postgresql:postgresql:${postgresqlDriverVersion}"
runtimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl:${log4j2Version}"
implementation "commons-io:commons-io:${commonsIoVersion}"
implementation "org.apache.logging.log4j:log4j-core:${log4j2Version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected TomcatWebServer getTomcatWebServer(Tomcat tomcat)
addExtraContextResources(contextProperties, context);

// Add the SMTP config
context.getNamingResources().addResource(getMailResource());
addSmtpProperties(context);

// Add the encryption key(s)
context.addParameter("EncryptionKey", contextProperties.getEncryptionKey());
Expand Down Expand Up @@ -373,39 +373,34 @@ private String getPropValue(Map<Integer, String> propValues, Integer resourceKey
return val != null && !val.isBlank() ? val.trim() : defaultValue;
}

private ContextResource getMailResource()
private void addSmtpProperties(StandardContext context)
{
// Get session/mail properties
LabKeyServer.MailProperties mailProps = _server.smtpSource();
ContextResource mailResource = new ContextResource();
mailResource.setName("mail/Session");
mailResource.setAuth("Container");
mailResource.setType("jakarta.mail.Session");
mailResource.setProperty("mail.smtp.host", mailProps.getSmtpHost());
mailResource.setProperty("mail.smtp.user", mailProps.getSmtpUser());
mailResource.setProperty("mail.smtp.port", mailProps.getSmtpPort());

context.addParameter("mail.smtp.host", mailProps.getSmtpHost());
context.addParameter("mail.smtp.user", mailProps.getSmtpUser());
context.addParameter("mail.smtp.port", mailProps.getSmtpPort());

if (mailProps.getSmtpFrom() != null)
{
mailResource.setProperty("mail.smtp.from", mailProps.getSmtpFrom());
context.addParameter("mail.smtp.from", mailProps.getSmtpFrom());
}
if (mailProps.getSmtpPassword() != null)
{
mailResource.setProperty("mail.smtp.password", mailProps.getSmtpPassword());
context.addParameter("mail.smtp.password", mailProps.getSmtpPassword());
}
if (mailProps.getSmtpStartTlsEnable() != null)
{
mailResource.setProperty("mail.smtp.starttls.enable", mailProps.getSmtpStartTlsEnable());
context.addParameter("mail.smtp.starttls.enable", mailProps.getSmtpStartTlsEnable());
}
if (mailProps.getSmtpSocketFactoryClass() != null)
{
mailResource.setProperty("mail.smtp.socketFactory.class", mailProps.getSmtpSocketFactoryClass());
context.addParameter("mail.smtp.socketFactory.class", mailProps.getSmtpSocketFactoryClass());
}
if (mailProps.getSmtpAuth() != null)
{
mailResource.setProperty("mail.smtp.auth", mailProps.getSmtpAuth());
context.addParameter("mail.smtp.auth", mailProps.getSmtpAuth());
}

return mailResource;
}
}