Package org.conical.common.bbl.auth
Class LdapAuthenticator
java.lang.Object
org.conical.common.bbl.auth.LdapAuthenticator
- All Implemented Interfaces:
Authenticator
Authenticates users and assigns access roles based on LDAP queries. This
implementation is incomplete and DOES NOT WORK! Do not use.
TODO: implement
- Author:
- rdoherty
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAuthenticatedUser
(String username, String password) Checks the password for the passed user.getUnauthenticatedUser
(String username) Looks up user attributes without authenticating, and returns them.boolean
isValidUser
(String username, String password) Checks if the given username and password represents a valid user.boolean
userHasRole
(String username, String role) Returns true if user has the passed role, else false.
-
Constructor Details
-
LdapAuthenticator
- Throws:
AuthenticationException
-
-
Method Details
-
getAuthenticatedUser
Description copied from interface:Authenticator
Checks the password for the passed user. If valid, returns user attributes and all known roles. If not, returns null. Note that the caller is responsible for encrypting the password using the same algorithm used to store the password originally. No password transformation is performed.- Specified by:
getAuthenticatedUser
in interfaceAuthenticator
- Parameters:
username
- username to checkpassword
- password to check- Returns:
- authenticated user, or null
- Throws:
AuthenticationException
- if an error occurs while authenticating
-
getUnauthenticatedUser
Description copied from interface:Authenticator
Looks up user attributes without authenticating, and returns them. If no user with the passed name can be found, returns null- Specified by:
getUnauthenticatedUser
in interfaceAuthenticator
- Parameters:
username
- user for which to search- Returns:
- unauthenticated user, or null
- Throws:
AuthenticationException
- if an error occurs while searching for the user
-
isValidUser
Description copied from interface:Authenticator
Checks if the given username and password represents a valid user. Same rules asgetAuthenticatedUser()
.- Specified by:
isValidUser
in interfaceAuthenticator
- Parameters:
username
- username to checkpassword
- to check- Returns:
- true if valid user, else false
- Throws:
AuthenticationException
- if an error occurs while authenticating
-
userHasRole
Description copied from interface:Authenticator
Returns true if user has the passed role, else false.- Specified by:
userHasRole
in interfaceAuthenticator
- Parameters:
username
- user to checkrole
- role to check- Returns:
- true if user has role, else false
- Throws:
AuthenticationException
- if an error occurs while looking up user or roles
-