Class FileAuthenticator
java.lang.Object
org.deltava.security.FileAuthenticator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Authenticator
An authenticator to validate users against a file repository. This should typically be used for testing or backup purposes only.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Field Summary
Fields inherited from interface org.deltava.security.Authenticator
DEFAULT_PROPS_FILE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether this Authenticator will accept a User.void
Adds a user to the Directory.void
authenticate
(Person usr, String pwd) Authenticates the user by searching for the directory name and then comparing the existing password on file to the one specified.boolean
Checks if a particular name exists in the Directory.void
Disables a user's account.void
Create a new File Authenticator and populate its user list from a file.void
Removes a user from the Directory.void
Renames a user in the Directory.void
updatePassword
(Person usr, String pwd) Updates a user's password.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.deltava.security.Authenticator
close
-
Constructor Details
-
FileAuthenticator
public FileAuthenticator()
-
-
Method Details
-
init
Create a new File Authenticator and populate its user list from a file. User entries are stored internally in an unsorted Map. This file is comma-delimited with the fields in the following order: FIRSTNAME, LASTNAME, PILOT ID, PASSWORD- Specified by:
init
in interfaceAuthenticator
- Parameters:
propsFile
- the properties file to use- Throws:
SecurityException
- if an error occurs
-
authenticate
Authenticates the user by searching for the directory name and then comparing the existing password on file to the one specified. The DN search is case-insensitive.- Specified by:
authenticate
in interfaceAuthenticator
- Parameters:
usr
- the User beanpwd
- the user's password- Throws:
SecurityException
- if authentication fails- See Also:
-
accepts
Checks whether this Authenticator will accept a User. The User must have a non-empty Directory name.- Specified by:
accepts
in interfaceAuthenticator
- Parameters:
usr
- the user bean- Returns:
- TRUE if the Directory name is populated, otherwise FALSE
-
contains
Checks if a particular name exists in the Directory.- Specified by:
contains
in interfaceAuthenticator
- Parameters:
usr
- the User bean- Returns:
- TRUE if the user exists, otherwise FALSE
-
updatePassword
Updates a user's password.- Specified by:
updatePassword
in interfaceAuthenticator
- Parameters:
usr
- the User beanpwd
- the user's password- Throws:
SecurityException
- if an error occurs
-
add
Adds a user to the Directory.- Specified by:
add
in interfaceAuthenticator
- Parameters:
usr
- the User beanpwd
- the user's password- Throws:
SecurityException
- if an error occurs
-
remove
Removes a user from the Directory.- Specified by:
remove
in interfaceAuthenticator
- Parameters:
usr
- the User bean- Throws:
SecurityException
- if an error occurs
-
disable
Disables a user's account.- Specified by:
disable
in interfaceAuthenticator
- Parameters:
usr
- the user bean- Throws:
SecurityException
- if an error occurs
-
rename
Renames a user in the Directory. NOT IMPLEMENTED- Specified by:
rename
in interfaceAuthenticator
- Parameters:
usr
- the User beannewName
- the new fullly-qualified Directory name- Throws:
UnsupportedOperationException
- alwaysSecurityException
- if an error occurs
-