public class PropertiesUserManager extends AbstractUserManager
Properties file based UserManager implementation. We use
user.properties file to store user data.
| Property | Documentation |
|---|---|
| ftpserver.user.{username}.homedirectory | Path to the home directory for the user, based on the file system implementation used |
| ftpserver.user.{username}.userpassword | The password for the user. Can be in clear text, MD5 hash or salted SHA hash based on the configuration on the user manager |
| ftpserver.user.{username}.enableflag | true if the user is enabled, false otherwise |
| ftpserver.user.{username}.writepermission | true if the user is allowed to upload files and create directories, false otherwise |
| ftpserver.user.{username}.idletime | The number of seconds the user is allowed to be idle before disconnected. 0 disables the idle timeout |
| ftpserver.user.{username}.maxloginnumber | The maximum number of concurrent logins by the user. 0 disables the check. |
| ftpserver.user.{username}.maxloginperip | The maximum number of concurrent logins from the same IP address by the user. 0 disables the check. |
| ftpserver.user.{username}.uploadrate | The maximum number of bytes per second the user is allowed to upload files. 0 disables the check. |
| ftpserver.user.{username}.downloadrate | The maximum number of bytes per second the user is allowed to download files. 0 disables the check. |
Example:
ftpserver.user.admin.homedirectory=/ftproot ftpserver.user.admin.userpassword=admin ftpserver.user.admin.enableflag=true ftpserver.user.admin.writepermission=true ftpserver.user.admin.idletime=0 ftpserver.user.admin.maxloginnumber=0 ftpserver.user.admin.maxloginperip=0 ftpserver.user.admin.uploadrate=0 ftpserver.user.admin.downloadrate=0
ATTR_ENABLE, ATTR_HOME, ATTR_LOGIN, ATTR_MAX_DOWNLOAD_RATE, ATTR_MAX_IDLE_TIME, ATTR_MAX_LOGIN_NUMBER, ATTR_MAX_LOGIN_PER_IP, ATTR_MAX_UPLOAD_RATE, ATTR_PASSWORD, ATTR_WRITE_PERM| Constructor and Description |
|---|
PropertiesUserManager(PasswordEncryptor passwordEncryptor,
File userDataFile,
String adminName)
Internal constructor, do not use directly.
|
PropertiesUserManager(PasswordEncryptor passwordEncryptor,
URL userDataPath,
String adminName)
Internal constructor, do not use directly.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.ftpserver.ftplet.User |
authenticate(org.apache.ftpserver.ftplet.Authentication authentication)
User authenticate method
|
void |
delete(String usrName)
Delete an user.
|
void |
dispose()
Close the user manager - remove existing entries.
|
boolean |
doesExist(String name)
User existance check
|
String[] |
getAllUserNames()
Get all user names.
|
File |
getFile()
Retrive the file backing this user manager
|
org.apache.ftpserver.ftplet.User |
getUserByName(String userName)
Load user data.
|
void |
refresh()
Reloads the contents of the user.properties file.
|
void |
save(org.apache.ftpserver.ftplet.User usr)
Save user data.
|
getAdminName, getPasswordEncryptor, isAdminpublic PropertiesUserManager(PasswordEncryptor passwordEncryptor, File userDataFile, String adminName)
PropertiesUserManagerFactory instead.public PropertiesUserManager(PasswordEncryptor passwordEncryptor, URL userDataPath, String adminName)
PropertiesUserManagerFactory instead.public void refresh()
public File getFile()
public void save(org.apache.ftpserver.ftplet.User usr)
throws org.apache.ftpserver.ftplet.FtpException
org.apache.ftpserver.ftplet.FtpExceptionpublic void delete(String usrName) throws org.apache.ftpserver.ftplet.FtpException
org.apache.ftpserver.ftplet.FtpExceptionpublic String[] getAllUserNames()
public org.apache.ftpserver.ftplet.User getUserByName(String userName)
public boolean doesExist(String name)
public org.apache.ftpserver.ftplet.User authenticate(org.apache.ftpserver.ftplet.Authentication authentication)
throws org.apache.ftpserver.ftplet.AuthenticationFailedException
org.apache.ftpserver.ftplet.AuthenticationFailedExceptionpublic void dispose()
Copyright © 2003–2017 The Apache Software Foundation. All rights reserved.