本文整理汇总了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;
}
示例2: AbstractUserManager
import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
public AbstractUserManager() {
this(null, new Md5PasswordEncryptor());
}
示例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");
}
示例4: createPasswordEncryptor
import org.apache.ftpserver.usermanager.Md5PasswordEncryptor; //导入依赖的package包/类
@Override
protected PasswordEncryptor createPasswordEncryptor() {
return new Md5PasswordEncryptor();
}
示例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);
}
示例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);
}