mirror of
https://github.com/shred/acme4j.git
synced 2025-12-13 11:14:02 +08:00
Move from JavaMail to Jakarta Mail
This commit is contained in:
@@ -54,17 +54,10 @@
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>javax.mail-api</artifactId>
|
||||
<version>${javax.mail.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>${javax.mail.version}</version>
|
||||
<scope>test</scope>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>${jakarta.mail.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ module org.shredzone.acme4j.smime {
|
||||
requires org.shredzone.acme4j;
|
||||
requires org.shredzone.acme4j.utils;
|
||||
|
||||
requires static javax.mail.api;
|
||||
requires transitive jakarta.mail;
|
||||
requires com.github.spotbugs.annotations;
|
||||
requires org.bouncycastle.pkix;
|
||||
requires org.bouncycastle.provider;
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.smime;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.shredzone.acme4j.Identifier;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
|
||||
|
||||
@@ -16,9 +16,8 @@ package org.shredzone.acme4j.smime.challenge;
|
||||
import static org.shredzone.acme4j.toolbox.AcmeUtils.base64UrlEncode;
|
||||
import static org.shredzone.acme4j.toolbox.AcmeUtils.sha256hash;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.shredzone.acme4j.Login;
|
||||
import org.shredzone.acme4j.challenge.TokenChallenge;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
|
||||
@@ -29,10 +29,9 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.Nullable;
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.asn1.x500.X500NameBuilder;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
package org.shredzone.acme4j.smime.email;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static javax.mail.Message.RecipientType.TO;
|
||||
import static jakarta.mail.Message.RecipientType.TO;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
@@ -26,11 +26,10 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.mail.Address;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.Address;
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.shredzone.acme4j.Identifier;
|
||||
import org.shredzone.acme4j.Login;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.smime.email;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
|
||||
/**
|
||||
* A generator for the response body to be set to the {@link Message}.
|
||||
|
||||
@@ -14,17 +14,16 @@
|
||||
package org.shredzone.acme4j.smime.email;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static javax.mail.Message.RecipientType.TO;
|
||||
import static jakarta.mail.Message.RecipientType.TO;
|
||||
import static org.shredzone.acme4j.smime.email.ResponseBodyGenerator.RESPONSE_BODY_TYPE;
|
||||
|
||||
import javax.mail.Address;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.Nullable;
|
||||
import jakarta.mail.Address;
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.Session;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
|
||||
/**
|
||||
* A helper for creating an email response to the "challenge" email.
|
||||
|
||||
@@ -16,9 +16,8 @@ package org.shredzone.acme4j.smime;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,12 +25,11 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyPair;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.Session;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import org.shredzone.acme4j.Login;
|
||||
import org.shredzone.acme4j.smime.challenge.EmailReply00Challenge;
|
||||
import org.shredzone.acme4j.toolbox.JSON;
|
||||
@@ -48,7 +47,7 @@ public abstract class SMIMETests {
|
||||
+ KEY_AUTHORIZATION + "\r\n"
|
||||
+ "-----END ACME RESPONSE-----\r\n";
|
||||
|
||||
protected final Session mailSession = Session.getInstance(new Properties());
|
||||
protected final Session mailSession = Session.getDefaultInstance(new Properties());
|
||||
|
||||
/**
|
||||
* Safely generates an {@link InternetAddress} from the given email address.
|
||||
|
||||
@@ -25,9 +25,8 @@ import java.security.KeyPair;
|
||||
import java.security.Security;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.mail.internet.AddressException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.internet.AddressException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.bouncycastle.asn1.ASN1Encodable;
|
||||
import org.bouncycastle.asn1.DERBitString;
|
||||
import org.bouncycastle.asn1.DERIA5String;
|
||||
|
||||
@@ -13,17 +13,16 @@
|
||||
*/
|
||||
package org.shredzone.acme4j.smime.email;
|
||||
|
||||
import static javax.mail.Message.RecipientType.TO;
|
||||
import static jakarta.mail.Message.RecipientType.TO;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.MessagingException;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import org.junit.Test;
|
||||
import org.shredzone.acme4j.Identifier;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
|
||||
Reference in New Issue
Block a user