This is an automated email from the ASF dual-hosted git repository. elecharny pushed a commit to branch 1.2.X in repository https://gitbox.apache.org/repos/asf/mina-ftpserver.git
commit 460a6d12b1145ffd136b056e0be0e7fd96f50eb9 Author: emmanuel lecharny <elecha...@apache.org> AuthorDate: Sun Mar 6 09:04:24 2022 +0100 Bumped up to 1.2.0 to reflect the API change --- core/pom.xml | 3 +-- .../org/apache/ftpserver/ssl/SslConfiguration.java | 12 ++++++++- .../ssl/impl/DefaultSslConfiguration.java | 30 ++++++++++++++++++++++ distribution/pom.xml | 2 +- examples/pom.xml | 4 +-- ftplet-api/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 46 insertions(+), 9 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 5c31901..2aa9c63 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -13,12 +13,11 @@ <parent> <artifactId>ftpserver-parent</artifactId> <groupId>org.apache.ftpserver</groupId> - <version>1.1.4-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>ftpserver-core</artifactId> <name>Apache FtpServer Core</name> - <version>1.1.4-SNAPSHOT</version> <packaging>bundle</packaging> <properties> diff --git a/core/src/main/java/org/apache/ftpserver/ssl/SslConfiguration.java b/core/src/main/java/org/apache/ftpserver/ssl/SslConfiguration.java index 1a338ea..1c646c3 100644 --- a/core/src/main/java/org/apache/ftpserver/ssl/SslConfiguration.java +++ b/core/src/main/java/org/apache/ftpserver/ssl/SslConfiguration.java @@ -30,7 +30,8 @@ import javax.net.ssl.SSLSocketFactory; * @author <a href="http://mina.apache.org">Apache MINA Project</a> */ public interface SslConfiguration { - + public static final String DEFAULT_ENABLED_PROTOCOL = "TLSv1.2"; + /** * Returns the socket factory that can be used to create sockets using this <code>SslConfiguration</code>. * @@ -72,6 +73,15 @@ public interface SslConfiguration { * * @return The name of the protocol as a String */ + default String getEnabledProtocol() { + return DEFAULT_ENABLED_PROTOCOL; + } + + /** + * Returns the list of ssl protocols + * + * @return The list of enabled protocols as a String + */ String[] getEnabledProtocols(); /** diff --git a/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java b/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java index 9f17e9d..019170c 100644 --- a/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java +++ b/core/src/main/java/org/apache/ftpserver/ssl/impl/DefaultSslConfiguration.java @@ -78,6 +78,24 @@ public class DefaultSslConfiguration implements SslConfiguration { this.socketFactory = sslContext.getSocketFactory(); } + /** + * Internal constructor, do not use directly. Instead, use {@link SslConfigurationFactory} + * + * @throws GeneralSecurityException + */ + public DefaultSslConfiguration(KeyManagerFactory keyManagerFactory, TrustManagerFactory trustManagerFactory, + ClientAuth clientAuthReqd, String sslProtocol, String[] enabledCipherSuites, String keyAlias) throws GeneralSecurityException { + super(); + this.clientAuth = clientAuthReqd; + this.enabledCipherSuites = enabledCipherSuites; + this.keyAlias = keyAlias; + this.keyManagerFactory = keyManagerFactory; + this.enabledProtocols = new String[] {sslProtocol}; + this.trustManagerFactory = trustManagerFactory; + this.sslContext = initContext(); + this.socketFactory = sslContext.getSocketFactory(); + } + public SSLSocketFactory getSocketFactory() throws GeneralSecurityException { return socketFactory; } @@ -92,6 +110,18 @@ public class DefaultSslConfiguration implements SslConfiguration { /** * @see SslConfiguration#getEnabledProtocol() */ + public String getEnabledProtoco() { + if ((enabledProtocols != null) && (enabledProtocols.length > 0)) { + // We use the first one + return enabledProtocols[0]; + } else { + return DEFAULT_ENABLED_PROTOCOL; + } + } + + /** + * @see SslConfiguration#getEnabledProtocols() + */ public String[] getEnabledProtocols() { return enabledProtocols; } diff --git a/distribution/pom.xml b/distribution/pom.xml index 9ef4bfe..903700f 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -15,7 +15,7 @@ <parent> <artifactId>ftpserver-parent</artifactId> <groupId>org.apache.ftpserver</groupId> - <version>1.1.4-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/examples/pom.xml b/examples/pom.xml index 68773fc..5c74987 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -21,14 +21,12 @@ <parent> <artifactId>ftpserver-parent</artifactId> <groupId>org.apache.ftpserver</groupId> - <version>1.1.4-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.ftpserver</groupId> <artifactId>ftpserver-examples</artifactId> <packaging>pom</packaging> <name>Apache FtpServer Examples</name> - <version>1.1.4-SNAPSHOT</version> <modules> <module>ftpserver-example-spring-war</module> <module>ftpserver-osgi-ftplet-service</module> diff --git a/ftplet-api/pom.xml b/ftplet-api/pom.xml index e299b97..987ee99 100644 --- a/ftplet-api/pom.xml +++ b/ftplet-api/pom.xml @@ -17,7 +17,7 @@ <parent> <artifactId>ftpserver-parent</artifactId> <groupId>org.apache.ftpserver</groupId> - <version>1.1.4-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/pom.xml b/pom.xml index 61d995d..907de27 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ <artifactId>ftpserver-parent</artifactId> <packaging>pom</packaging> <name>Apache FtpServer Parent</name> - <version>1.1.4-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <url>https://mina.apache.org/ftpserverproject</url> <issueManagement>