本文整理匯總了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);
}