You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by "Pitoniak, Michael" <mp...@enterasys.com> on 2009/01/09 17:18:24 UTC

not encrypting passwords on embedded server

Team,

 What do I need to do to this embedded sever code to turn off encrypting of passwords?

Thx,

mike



import java.io.File;

import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.ssl.SslConfigurationFactory;
import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;

public class EmbeddingFtpServer {

    public static void main(String[] args) throws Exception {
        FtpServerFactory serverFactory = new FtpServerFactory();

        ListenerFactory factory = new ListenerFactory();

        // set the port of the listener
        factory.setPort(21);

        // define SSL configuration
        SslConfigurationFactory ssl = new SslConfigurationFactory();
        ssl.setKeystoreFile(new File("support/apacheFtpServer/ftpserver.jks"));
        ssl.setKeystorePassword("password");

        // set the SSL configuration for the listener
        factory.setSslConfiguration(ssl.createSslConfiguration());
        factory.setImplicitSsl(false);

        // replace the default listener
        serverFactory.addListener("default", factory.createListener());

        PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
        userManagerFactory.setFile(new File("support/apacheFtpServer/users.properties"));

        serverFactory.setUserManager(userManagerFactory.createUserManager());

        // start the server
        FtpServer server = serverFactory.createServer();

        server.start();
    }
}


Re: not encrypting passwords on embedded server

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Fri, Jan 9, 2009 at 5:18 PM, Pitoniak, Michael
<mp...@enterasys.com> wrote:
>  What do I need to do to this embedded sever code to turn off encrypting of passwords?

You need to set the password encryptor:
userManagerFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());

/niklas