Package org.apache.ftpserver.usermanager

Examples of org.apache.ftpserver.usermanager.PropertiesUserManager


    protected void initFtpServer() throws Exception {
        ftpServer = new FtpServer();

        // setup user management to read our users.properties and use clear text passwords
        PropertiesUserManager uman = new PropertiesUserManager();
        uman.setFile(new File("./src/test/resources/users.properties").getAbsoluteFile());
        uman.setPasswordEncryptor(new ClearTextPasswordEncryptor());
        uman.setAdminName("admin");
        uman.configure();
        ftpServer.setUserManager(uman);

        ftpServer.getListener("default").setPort(getPort());
    }
View Full Code Here


  protected void createUsers()
  {
    try
    {
      PropertiesUserManager propertiesUserManager = new PropertiesUserManager();
      propertiesUserManager.setPropFileftpUserPropertiesFile );
      BaseUser ftpUser = new BaseUser();
      ftpUser.setName( userName );
      ftpUser.setPassword( password );
      ftpUser.setHomeDirectory( ftpHomeDir.getAbsolutePath() );
      Authority[] auths = { new WritePermission() };
      ftpUser.setAuthorities( auths );
          ftpUser.setEnabledtrue );
          propertiesUserManager.configure();
      propertiesUserManager.save( ftpUser );
     
      BaseUser adminUser = new BaseUser();
      adminUser.setName( "admin" );
      adminUser.setHomeDirectory( ftpHomeDir.getAbsolutePath() );
      propertiesUserManager.save( adminUser );
    }
    catch (FtpException e)
    {
      log.error( e );
    }
View Full Code Here

      // create all the components
      messageResource = new MessageResourceImpl();
      ((MessageResourceImpl) messageResource)
          .configure();

      userManager = new PropertiesUserManager();
      ((PropertiesUserManager) userManager).configure();

      fileSystemManager = new NativeFileSystemManager();

      statistics = new FtpStatisticsImpl();
View Full Code Here

        NioListener listener = new NioListener();
        listener.setPort(port);
        context.setListener("default", listener);
       
        PropertiesUserManager userManager = new PropertiesUserManager();
        userManager.setAdminName("admin");
        userManager.setEncryptPasswords(false);
        userManager.setPropFile(USERS_FILE);
        userManager.configure();
       
        context.setUserManager(userManager);
       
        return new FtpServer(context);       
    }
View Full Code Here

        return (PropertiesUserManager) server.getUserManager();
    }

    public void testFile() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"/tmp/foo.users\" />");
        assertEquals("/tmp/foo.users", um.getFile().getAbsolutePath());
    }
View Full Code Here

        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"/tmp/foo.users\" />");
        assertEquals("/tmp/foo.users", um.getFile().getAbsolutePath());
    }

    public void testMd5PasswordEncryptor() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"foo\" encrypt-passwords=\"md5\" />");

        assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
    }
View Full Code Here

        assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
    }
   
    public void testTruePasswordEncryptor() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"foo\" encrypt-passwords=\"true\" />");

        assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
    }
View Full Code Here

        assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
    }

    public void testNonePasswordEncryptor() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"foo\" encrypt-passwords=\"clear\" />");

        assertTrue(um.getPasswordEncryptor() instanceof ClearTextPasswordEncryptor);
    }
View Full Code Here

        assertTrue(um.getPasswordEncryptor() instanceof ClearTextPasswordEncryptor);
    }

    public void testSaltedPasswordEncryptor() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"foo\" encrypt-passwords=\"salted\" />");

        assertTrue(um.getPasswordEncryptor() instanceof SaltedPasswordEncryptor);
    }
View Full Code Here

        assertTrue(um.getPasswordEncryptor() instanceof SaltedPasswordEncryptor);
    }
   
    public void testFalsePasswordEncryptor() throws Throwable {
        PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"foo\" encrypt-passwords=\"false\" />");

        assertTrue(um.getPasswordEncryptor() instanceof ClearTextPasswordEncryptor);
    }
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.usermanager.PropertiesUserManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.