Class LDAPAuthenticator
java.lang.Object
org.deltava.security.LDAPAuthenticator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Authenticator
An authenticator to validate users against an LDAP server.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Field Summary
FieldsFields inherited from interface org.deltava.security.Authenticator
DEFAULT_PROPS_FILE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
This Authenticator accepts all users with a valid Directory Name.void
Adds a User to the Directory.void
authenticate
(Person usr, String pwd) Authenticates the user by doing an LDAP bind operation and checking if it succeeded.boolean
Checks if a particular name exists in the Directory.void
Disables a user's account.void
Initializes the authenticator.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
-
Field Details
-
log
-
_env
-
-
Constructor Details
-
LDAPAuthenticator
public LDAPAuthenticator()
-
-
Method Details
-
init
Initializes the authenticator.- Specified by:
init
in interfaceAuthenticator
- Parameters:
propsFile
- the properties file to use- Throws:
SecurityException
- if an error occurs
-
authenticate
Authenticates the user by doing an LDAP bind operation and checking if it succeeded.- Specified by:
authenticate
in interfaceAuthenticator
- Parameters:
usr
- the user beanpwd
- the user's password- Throws:
SecurityException
- if authentication fails for any reason, contained within the cause of the exception.- See Also:
-
updatePassword
Updates a user's password.- Specified by:
updatePassword
in interfaceAuthenticator
- Parameters:
usr
- the user beanpwd
- the new 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
-
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
- Throws:
SecurityException
- if an error occurs
-
accepts
This Authenticator accepts all users with a valid Directory Name.- Specified by:
accepts
in interfaceAuthenticator
- Parameters:
usr
- the user bean- Returns:
- TRUE if the user's DN property is not empty
-
disable
Disables a user's account. This deletes the User.- Specified by:
disable
in interfaceAuthenticator
- Parameters:
usr
- the user bean- 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
-
rename
Renames a user in the Directory.- Specified by:
rename
in interfaceAuthenticator
- Parameters:
usr
- the user beannewName
- the new fully-qualified directory- Throws:
SecurityException
- if an error occurs
-