com.Prominic.jFTPd
Class FTPSecuritySource

java.lang.Object
  extended by com.Prominic.jFTPd.FTPSecuritySource
Direct Known Subclasses:
FTPAnonSecuritySource, FTPUserListSecuritySource

public abstract class FTPSecuritySource
extends java.lang.Object

Generic security source (either based on a user defined on users.dat file or on anonymous user).


Field Summary
protected static java.lang.String ANONYMOUS_USERNAME
           
 
Constructor Summary
FTPSecuritySource()
           
 
Method Summary
abstract  boolean canDelete(FTPUser user, java.lang.String path)
          Implement this if the given user can delete the specified path.
abstract  boolean canDownload(FTPUser user, java.lang.String path)
          Implement this if the given user can download from the specified path.
abstract  boolean canRename(FTPUser user, java.lang.String frompath, java.lang.String topath)
          Implement this if the given user can rename the specified path.
abstract  boolean canUpload(FTPUser user, java.lang.String path)
          Implement this if the given user can upload to the specified path.
 boolean isAnonymousUsername(java.lang.String username)
          Checks if the username provided by the client is ANONYMOUS_USERNAME.
 boolean isValidEmail(java.lang.String email)
          Simple check for a string to be an email.
abstract  FTPUser userWithUsernameAndPassword(java.lang.String username, java.lang.String password)
          Creates an FTPUser based on the username and password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANONYMOUS_USERNAME

protected static final java.lang.String ANONYMOUS_USERNAME
See Also:
Constant Field Values
Constructor Detail

FTPSecuritySource

public FTPSecuritySource()
Method Detail

canDelete

public abstract boolean canDelete(FTPUser user,
                                  java.lang.String path)
Implement this if the given user can delete the specified path.

Parameters:
user - - user
path - - path to be deleted
Returns:
- true if user can delete the specified path.

canDownload

public abstract boolean canDownload(FTPUser user,
                                    java.lang.String path)
Implement this if the given user can download from the specified path.

Parameters:
user - - user
path - - path
Returns:
- true if user can download from the specified path.

canRename

public abstract boolean canRename(FTPUser user,
                                  java.lang.String frompath,
                                  java.lang.String topath)
Implement this if the given user can rename the specified path.

Parameters:
user - - user
frompath - - path to be renamed
topath - - new path
Returns:
- true if user can rename the specified path.

canUpload

public abstract boolean canUpload(FTPUser user,
                                  java.lang.String path)
Implement this if the given user can upload to the specified path.

Parameters:
user - - user
path - - path where upload should be done
Returns:
- true if user can upload there.

isAnonymousUsername

public boolean isAnonymousUsername(java.lang.String username)
Checks if the username provided by the client is ANONYMOUS_USERNAME.

Parameters:
username - - username
Returns:
true if the username is the one chosen to behave as anonymous.

isValidEmail

public boolean isValidEmail(java.lang.String email)
Simple check for a string to be an email.

Parameters:
email - - string to be checked.
Returns:
true if the string looks like a valid email address.

userWithUsernameAndPassword

public abstract FTPUser userWithUsernameAndPassword(java.lang.String username,
                                                    java.lang.String password)
Creates an FTPUser based on the username and password. The informations are read from the users.dat file.

Parameters:
username - - username
password - - password.
Returns: