当前位置: 首页>>代码示例>>Java>>正文


Java Md5PasswordEncryptor类代码示例

本文整理汇总了Java中org.apache.ftpserver.usermanager.Md5PasswordEncryptor的典型用法代码示例。如果您正苦于以下问题:Java Md5PasswordEncryptor类的具体用法?Java Md5PasswordEncryptor怎么用?Java Md5PasswordEncryptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Md5PasswordEncryptor类属于org.apache.ftpserver.usermanager包,在下文中一共展示了Md5PasswordEncryptor类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureFtpServerFactory

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
/**
  * @param args
* @throws IOException 
  */
 public FtpServerFactory configureFtpServerFactory() throws IOException{
 FtpServerFactory fsf = new FtpServerFactory();		
 log.info("Configuring an on-the-fly FTP server.");

  String ftpUsersFilePath = null;
  File fFTPServerUserFile = null;
  ftpUsersFilePath = RepositoryManager.getRepositoryLocation() + File.separator + "conf" + File.separator + FTP_USERS_FILE;
  log.debug("Creating FTP users file at " + ftpUsersFilePath);
     fFTPServerUserFile = new File(ftpUsersFilePath);
     fFTPServerUserFile.mkdirs();
  fFTPServerUserFile.delete();
  
  fFTPServerUserFile.createNewFile();
  			 		  		      
     final Map<String, Ftplet> ftpletMap = new HashMap<String, Ftplet>();
  
     Ftplet ftplet = new ConfFtplet(this);
     ftpletMap.put("default",ftplet);		      
     fsf.setFtplets(ftpletMap);
   
     userManagerFactory = new PropertiesUserManagerFactory();
     userManagerFactory.setFile(new File(ftpUsersFilePath));
     userManagerFactory.setPasswordEncryptor(new Md5PasswordEncryptor());	    
     userManager = userManagerFactory.createUserManager();
     
    

     
     ListenerFactory listenerFactory = new ListenerFactory();
     listenerFactory.setPort(DEFAULT_FTP_PORT);
     fsf.addListener("default", listenerFactory.createListener());
     fsf.setUserManager(userManager);
  
     // Inicializar host ip.
     this.host = VMRCServerUtils.getPublicIP();
     return fsf;
 }
 
开发者ID:grycap,项目名称:vmrc,代码行数:42,代码来源:FTPServer.java

示例2: AbstractUserManager

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
public AbstractUserManager() {
    this(null,  new Md5PasswordEncryptor());
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:4,代码来源:AbstractUserManager.java

示例3: doParse

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
@Override
protected void doParse(final Element element,
        final ParserContext parserContext,
        final BeanDefinitionBuilder builder) {


    Class<?> factoryClass;
    if (element.getLocalName().equals("file-user-manager")) {
        factoryClass = PropertiesUserManagerFactory.class;
    } else {
        factoryClass = DbUserManagerFactory.class;
    }
    BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder.genericBeanDefinition(factoryClass);

    
    // common for both user managers
    if (StringUtils.hasText(element.getAttribute("encrypt-passwords"))) {
        String encryptionStrategy = element.getAttribute("encrypt-passwords"); 
        
        if(encryptionStrategy.equals("true") || encryptionStrategy.equals("md5")) {
            factoryBuilder.addPropertyValue("passwordEncryptor", new Md5PasswordEncryptor());
        } else if(encryptionStrategy.equals("salted")) {
            factoryBuilder.addPropertyValue("passwordEncryptor", new SaltedPasswordEncryptor());
        } else {
            factoryBuilder.addPropertyValue("passwordEncryptor", new ClearTextPasswordEncryptor());
        }
    }
    
    if (factoryClass == PropertiesUserManagerFactory.class) {
        if (StringUtils.hasText(element.getAttribute("file"))) {
            factoryBuilder.addPropertyValue("file", element.getAttribute("file"));
        }
        if (StringUtils.hasText(element.getAttribute("url"))) {
            factoryBuilder.addPropertyValue("url", element.getAttribute("url"));
        }
    } else {
        Element dsElm = SpringUtil.getChildElement(element,
                FtpServerNamespaceHandler.FTPSERVER_NS, "data-source");

        // schema ensure we get the right type of element
        Element springElm = SpringUtil.getChildElement(dsElm, null, null);
        Object o;
        if ("bean".equals(springElm.getLocalName())) {
            o = parserContext.getDelegate().parseBeanDefinitionElement(
                    springElm, builder.getBeanDefinition());
        } else {
            // ref
            o = parserContext.getDelegate().parsePropertySubElement(
                    springElm, builder.getBeanDefinition());

        }
        factoryBuilder.addPropertyValue("dataSource", o);

        factoryBuilder.addPropertyValue("sqlUserInsert", getSql(element,
                "insert-user"));
        factoryBuilder.addPropertyValue("sqlUserUpdate", getSql(element,
                "update-user"));
        factoryBuilder.addPropertyValue("sqlUserDelete", getSql(element,
                "delete-user"));
        factoryBuilder.addPropertyValue("sqlUserSelect", getSql(element,
                "select-user"));
        factoryBuilder.addPropertyValue("sqlUserSelectAll", getSql(element,
                "select-all-users"));
        factoryBuilder.addPropertyValue("sqlUserAdmin",
                getSql(element, "is-admin"));
        factoryBuilder.addPropertyValue("sqlUserAuthenticate", getSql(element,
                "authenticate"));
    }

    BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition();
    String factoryId = parserContext.getReaderContext().generateBeanName(factoryDefinition);
    
    BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, factoryId);
    registerBeanDefinition(factoryHolder, parserContext.getRegistry());

    // set the factory on the listener bean
    builder.getRawBeanDefinition().setFactoryBeanName(factoryId);
    builder.getRawBeanDefinition().setFactoryMethodName("createUserManager");

}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:81,代码来源:UserManagerBeanDefinitionParser.java

示例4: createPasswordEncryptor

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
@Override
protected PasswordEncryptor createPasswordEncryptor() {
    return new Md5PasswordEncryptor();
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:5,代码来源:Md5PasswordEncryptorTest.java

示例5: testMd5PasswordEncryptor

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
public void testMd5PasswordEncryptor() throws Throwable {
    PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"" + USER_FILE_PATH + "\" encrypt-passwords=\"md5\" />");

    assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:6,代码来源:FileUserManagerConfigTest.java

示例6: testTruePasswordEncryptor

import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
public void testTruePasswordEncryptor() throws Throwable {
    PropertiesUserManager um = createPropertiesUserManager("<file-user-manager file=\"" + USER_FILE_PATH + "\" encrypt-passwords=\"true\" />");

    assertTrue(um.getPasswordEncryptor() instanceof Md5PasswordEncryptor);
}
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:6,代码来源:FileUserManagerConfigTest.java


注:本文中的org.apache.ftpserver.usermanager.Md5PasswordEncryptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。