org.apache.ftpserver.usermanager.impl
Class PropertiesUserManager

java.lang.Object
  extended by org.apache.ftpserver.usermanager.impl.AbstractUserManager
      extended by org.apache.ftpserver.usermanager.impl.PropertiesUserManager
All Implemented Interfaces:
UserManager

public class PropertiesUserManager
extends AbstractUserManager

Internal class, do not use directly.

Properties file based UserManager implementation. We use user.properties file to store user data.

The file will use the following properties for storing users:

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
 

Author:
Apache MINA Project

Field Summary
 
Fields inherited from class org.apache.ftpserver.usermanager.impl.AbstractUserManager
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 Summary
PropertiesUserManager(PasswordEncryptor passwordEncryptor, java.io.File userDataFile, java.lang.String adminName)
          Internal constructor, do not use directly.
PropertiesUserManager(PasswordEncryptor passwordEncryptor, java.net.URL userDataPath, java.lang.String adminName)
          Internal constructor, do not use directly.
 
Method Summary
 User authenticate(Authentication authentication)
          User authenticate method
 void delete(java.lang.String usrName)
          Delete an user.
 void dispose()
          Close the user manager - remove existing entries.
 boolean doesExist(java.lang.String name)
          User existance check
 java.lang.String[] getAllUserNames()
          Get all user names.
 java.io.File getFile()
          Retrive the file backing this user manager
 User getUserByName(java.lang.String userName)
          Load user data.
 void refresh()
          Reloads the contents of the user.properties file.
 void save(User usr)
          Save user data.
 
Methods inherited from class org.apache.ftpserver.usermanager.impl.AbstractUserManager
getAdminName, getPasswordEncryptor, isAdmin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesUserManager

public PropertiesUserManager(PasswordEncryptor passwordEncryptor,
                             java.io.File userDataFile,
                             java.lang.String adminName)
Internal constructor, do not use directly. Use PropertiesUserManagerFactory instead.


PropertiesUserManager

public PropertiesUserManager(PasswordEncryptor passwordEncryptor,
                             java.net.URL userDataPath,
                             java.lang.String adminName)
Internal constructor, do not use directly. Use PropertiesUserManagerFactory instead.

Method Detail

refresh

public void refresh()
Reloads the contents of the user.properties file. This allows any manual modifications to the file to be recognised by the running server.


getFile

public java.io.File getFile()
Retrive the file backing this user manager

Returns:
The file

save

public void save(User usr)
          throws FtpException
Save user data. Store the properties.

Throws:
FtpException

delete

public void delete(java.lang.String usrName)
            throws FtpException
Delete an user. Removes all this user entries from the properties. After removing the corresponding from the properties, save the data.

Throws:
FtpException

getAllUserNames

public java.lang.String[] getAllUserNames()
Get all user names.


getUserByName

public User getUserByName(java.lang.String userName)
Load user data.


doesExist

public boolean doesExist(java.lang.String name)
User existance check


authenticate

public User authenticate(Authentication authentication)
                  throws AuthenticationFailedException
User authenticate method

Throws:
AuthenticationFailedException

dispose

public void dispose()
Close the user manager - remove existing entries.



Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.