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 |
---|---|
User |
authenticate(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
|
User |
getUserByName(String userName)
Load user data.
|
void |
refresh()
Reloads the contents of the user.properties file.
|
void |
save(User usr)
Save user data.
|
getAdminName, getPasswordEncryptor, isAdmin
public 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(User usr) throws FtpException
usr
- the Uset to saveFtpException
- when the UserManager can't fulfill the request.public void delete(String usrName) throws FtpException
usrName
- The name of the User
to deleteFtpException
- when the UserManager can't fulfill the request.public String[] getAllUserNames()
public User getUserByName(String userName)
userName
- the name to search for.public boolean doesExist(String name)
name
- the name of the user to check.public User authenticate(Authentication authentication) throws AuthenticationFailedException
authentication
- The Authentication
that proves the users identityAuthenticationFailedException
public void dispose()
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.