org.apache.ftpserver.usermanager
Class PropertiesUserManager

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

public class PropertiesUserManager
extends AbstractUserManager

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


Field Summary
 
Fields inherited from class org.apache.ftpserver.usermanager.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()
           
 
Method Summary
 User authenticate(Authentication authentication)
          User authenticate method
 void configure()
          Configure user manager.
 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.
 User getUserByName(java.lang.String userName)
          Load user data.
 boolean isEncryptPassword()
          If true is returned, passwords will be stored as hashes rather than in clear text.
 void save(User usr)
          Save user data.
 void setEncryptPasswords(boolean encryptPassword)
          If set to true, passwords will be stored as a hash to ensure that it can not be retrived from the user file.
 void setPropFile(java.io.File propFile)
          Set the file used to store and read users.
 void setPropPasswordEncrypt(boolean encryptPassword)
          Deprecated. Use setEncryptPasswords(boolean)
 
Methods inherited from class org.apache.ftpserver.usermanager.AbstractUserManager
getAdminName, isAdmin, setAdmin, setAdminName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesUserManager

public PropertiesUserManager()
Method Detail

setPropFile

public void setPropFile(java.io.File propFile)
Set the file used to store and read users. Must be set before configure() is called.

Parameters:
propFile - A file containing users

isEncryptPassword

public boolean isEncryptPassword()
If true is returned, passwords will be stored as hashes rather than in clear text. Default is true.

Returns:
True if passwords are stored as hashes.

setEncryptPasswords

public void setEncryptPasswords(boolean encryptPassword)
If set to true, passwords will be stored as a hash to ensure that it can not be retrived from the user file. Must be set before configure() is called.

Parameters:
encryptPassword - True to store a hash of the passwords, false to store the passwords in clear text.

setPropPasswordEncrypt

public void setPropPasswordEncrypt(boolean encryptPassword)
Deprecated. Use setEncryptPasswords(boolean)


configure

public void configure()
Configure user manager.


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-2008 The Apache Software Foundation. All Rights Reserved.