You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2008/04/09 17:36:31 UTC
svn commit: r646404 - in
/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl:
ClientAuth.java DefaultSslConfiguration.java
Author: ngn
Date: Wed Apr 9 08:36:30 2008
New Revision: 646404
URL: http://svn.apache.org/viewvc?rev=646404&view=rev
Log:
Added Javadocs
Turned ClientAuth into a enum
Modified:
mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/ClientAuth.java
mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/DefaultSslConfiguration.java
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/ClientAuth.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/ClientAuth.java?rev=646404&r1=646403&r2=646404&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/ClientAuth.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/ClientAuth.java Wed Apr 9 08:36:30 2008
@@ -1,17 +1,39 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * 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.apache.ftpserver.ssl;
-public class ClientAuth {
- public static final ClientAuth NEED = new ClientAuth("Need");
- public static final ClientAuth WANT = new ClientAuth("Want");
- public static final ClientAuth NONE = new ClientAuth("None");
+/**
+ * Enumeration of possible levels of client
+ * authentication during an SSL session.
+ */
+public enum ClientAuth {
+
+ /**
+ * Client authentication is required
+ */
+ NEED,
- private String type;
+ /**
+ * Client authentication is requested but not required
+ */
+ WANT,
- private ClientAuth(String type) {
- this.type = type;
- }
-
- public String toString() {
- return type;
- }
+ /**
+ * Client authentication is not performed
+ */
+ NONE
}
Modified: mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/DefaultSslConfiguration.java
URL: http://svn.apache.org/viewvc/mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/DefaultSslConfiguration.java?rev=646404&r1=646403&r2=646404&view=diff
==============================================================================
--- mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/DefaultSslConfiguration.java (original)
+++ mina/ftpserver/trunk/core/src/main/java/org/apache/ftpserver/ssl/DefaultSslConfiguration.java Wed Apr 9 08:36:30 2008
@@ -40,8 +40,8 @@
/**
- * Ssl implementation. This class encapsulates all
- * the SSL functionalities.
+ * Used to configure the SSL settings for the control channel
+ * or the data channel.
*/
public class DefaultSslConfiguration implements SslConfiguration {
@@ -49,12 +49,12 @@
private File keystoreFile = new File("./res/.keystore");
private String keystorePass;
- private String keystoreType = "JKS";
+ private String keystoreType = KeyStore.getDefaultType();
private String keystoreAlgorithm = "SunX509";
private File trustStoreFile;
private String trustStorePass;
- private String trustStoreType = "JKS";
+ private String trustStoreType = KeyStore.getDefaultType();
private String trustStoreAlgorithm = "SunX509";
private String sslProtocol = "TLS";
@@ -69,47 +69,100 @@
private String[] enabledCipherSuites;
+ /**
+ * The key store file used by this configuration
+ * @return The key store file
+ */
public File getKeystoreFile() {
return keystoreFile;
}
+ /**
+ * Set the key store file to be used by this configuration
+ * @param keyStoreFile A path to an existing key store file
+ */
public void setKeystoreFile(File keyStoreFile) {
this.keystoreFile = keyStoreFile;
}
+ /**
+ * The password used to load the key store
+ * @return The password
+ */
public String getKeystorePassword() {
return keystorePass;
}
-
+
+ /**
+ * Set the password used to load the key store
+ * @param keystorePass The password
+ */
public void setKeystorePassword(String keystorePass) {
this.keystorePass = keystorePass;
}
-
+
+ /**
+ * The key store type, defaults to @see {@link KeyStore#getDefaultType()}
+ * @return The key store type
+ */
public String getKeystoreType() {
return keystoreType;
}
+ /**
+ * Set the key store type
+ * @param keystoreType The key store type
+ */
public void setKeystoreType(String keystoreType) {
this.keystoreType = keystoreType;
}
+ /**
+ * The algorithm used to open the key store.
+ * Defaults to "SunX509"
+ * @return The key store algorithm
+ */
public String getKeystoreAlgorithm() {
return keystoreAlgorithm;
}
+ /**
+ * Override the key store algorithm used to
+ * open the key store
+ * @param keystoreAlgorithm The key store algorithm
+ */
public void setKeystoreAlgorithm(String keystoreAlgorithm) {
this.keystoreAlgorithm = keystoreAlgorithm;
}
+ /**
+ * The SSL protocol used for this channel.
+ * Supported values are "SSL" and "TLS".
+ * Defaults to "TLS".
+ * @return The SSL protocol
+ */
public String getSslProtocol() {
return sslProtocol;
}
-
+
+ /**
+ * Set the SSL protocol used for this channel.
+ * Supported values are "SSL" and "TLS".
+ * Defaults to "TLS".
+ * @param sslProtocol The SSL protocol
+ */
public void setSslProtocol(String sslProtocol) {
this.sslProtocol = sslProtocol;
}
+ /**
+ * Set what client authentication level to use, supported
+ * values are "yes" or "true" for required authentication,
+ * "want" for wanted authentication and "false" or "none"
+ * for no authentication. Defaults to "none".
+ * @param clientAuthReqd The desired authentication level
+ */
public void setClientAuthentication(String clientAuthReqd) {
if("true".equalsIgnoreCase(clientAuthReqd)
|| "yes".equalsIgnoreCase(clientAuthReqd)) {
@@ -121,10 +174,18 @@
}
}
+ /**
+ * The password used to load the key
+ * @return The password
+ */
public String getKeyPassword() {
return keyPass;
}
+ /**
+ * Set the password used to load the key
+ * @param keyPass The password
+ */
public void setKeyPassword(String keyPass) {
this.keyPass = keyPass;
}
@@ -133,30 +194,60 @@
return trustStoreFile;
}
+ /**
+ * Set the password used to load the trust store
+ * @param trustStoreFile The password
+ */
public void setTruststoreFile(File trustStoreFile) {
this.trustStoreFile = trustStoreFile;
}
-
+
+ /**
+ * The password used to load the trust store
+ * @return The password
+ */
public String getTruststorePassword() {
return trustStorePass;
}
-
+
+ /**
+ * Set the password used to load the trust store
+ * @param trustStorePass The password
+ */
public void setTruststorePassword(String trustStorePass) {
this.trustStorePass = trustStorePass;
}
+ /**
+ * The trust store type, defaults to @see {@link KeyStore#getDefaultType()}
+ * @return The trust store type
+ */
public String getTruststoreType() {
return trustStoreType;
}
-
+
+ /**
+ * Set the trust store type
+ * @param keystoreType The trust store type
+ */
public void setTruststoreType(String trustStoreType) {
this.trustStoreType = trustStoreType;
}
+ /**
+ * The algorithm used to open the trust store.
+ * Defaults to "SunX509"
+ * @return The trust store algorithm
+ */
public String getTruststoreAlgorithm() {
return trustStoreAlgorithm;
}
+ /**
+ * Override the trust store algorithm used to
+ * open the trust store
+ * @param trustStoreAlgorithm The trust store algorithm
+ */
public void setTruststoreAlgorithm(String trustStoreAlgorithm) {
this.trustStoreAlgorithm = trustStoreAlgorithm;
@@ -217,7 +308,7 @@
}
/**
- * Get SSL Context.
+ * @see SslConfiguration#getSSLContext(String)
*/
public synchronized SSLContext getSSLContext(String protocol) throws GeneralSecurityException {
lazyInit();
@@ -260,18 +351,33 @@
return ctx;
}
+ /**
+ * @see SslConfiguration#getClientAuth()
+ */
public ClientAuth getClientAuth() {
return clientAuthReqd;
}
+ /**
+ * @see SslConfiguration#getSSLContext()
+ */
public SSLContext getSSLContext() throws GeneralSecurityException {
return getSSLContext(sslProtocol);
}
+ /**
+ * @see SslConfiguration#getEnabledCipherSuites()
+ */
public String[] getEnabledCipherSuites() {
return enabledCipherSuites;
}
+ /**
+ * Set the allowed cipher suites, note that
+ * the exact list of supported cipher suites
+ * differs between JRE implementations.
+ * @param enabledCipherSuites
+ */
public void setEnabledCipherSuites(String[] enabledCipherSuites) {
this.enabledCipherSuites = enabledCipherSuites;
}