Package edu.ucsb.nceas.metacat
Class AuthLdap
java.lang.Object
edu.ucsb.nceas.metacat.AuthLdap
- All Implemented Interfaces:
AuthInterface
An implementation of the AuthInterface interface that allows Metacat to use
the LDAP protocol for directory services. The LDAP authentication service is
used to determine if a user is authenticated, and whether they are a member
of a particular group.
-
Field Summary
Fields inherited from interface edu.ucsb.nceas.metacat.AuthInterface
GROUPDESINDEX, GROUPNAMEINDEX, USERCNINDEX, USERDNINDEX, USEREMAILINDEX, USERINFOCNINDEX, USERINFOEMAILINDEX, USERINFOORGANIDEX, USERORGINDEX, USERORGUNITINDEX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticate
(String user, String password) Determine if a user/password are valid according to the authentication service.getAttributes
(String foruser) Get attributes describing a user or groupgetAttributes
(String user, String password, String foruser) Get attributes describing a user or groupString[][]
Get all groups from the authentication serviceString[][]
Get the groups for a particular user from the authentication servicegetPrincipals
(String user, String password) Get all groups and users from authentication scheme.String[]
getUserInfo
(String user, String password) Get all users from the authentication serviceString[][]
Get all users from the authentication serviceString[]
Get the users for a particular group from the authentication servicestatic void
Test method for the classstatic int
searchUser
(String user, String[][] userGroup) Method for getting index of user DN in User info array
-
Constructor Details
-
AuthLdap
Construct an AuthLdap- Throws:
InstantiationException
-
-
Method Details
-
authenticate
Determine if a user/password are valid according to the authentication service.- Specified by:
authenticate
in interfaceAuthInterface
- Parameters:
user
- the name of the principal to authenticatepassword
- the password to use for authentication- Throws:
ConnectException
-
getUsers
Get all users from the authentication service- Specified by:
getUsers
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the service- Throws:
ConnectException
-
getUserInfo
Get all users from the authentication service- Specified by:
getUserInfo
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the service- Throws:
ConnectException
-
getUsers
Get the users for a particular group from the authentication service- Specified by:
getUsers
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the servicegroup
- the group whose user list should be returned- Throws:
ConnectException
-
getGroups
Get all groups from the authentication service- Specified by:
getGroups
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the service- Throws:
ConnectException
-
getGroups
Get the groups for a particular user from the authentication service- Specified by:
getGroups
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the serviceforuser
- the user whose group list should be returned- Throws:
ConnectException
-
getAttributes
Get attributes describing a user or group- Specified by:
getAttributes
in interfaceAuthInterface
- Parameters:
foruser
- the user for which the attribute list is requested- Throws:
ConnectException
-
getAttributes
public HashMap<String,Vector<String>> getAttributes(String user, String password, String foruser) throws ConnectException Get attributes describing a user or group- Specified by:
getAttributes
in interfaceAuthInterface
- Parameters:
user
- the user for authenticating against the servicepassword
- the password for authenticating against the serviceforuser
- the user whose attributes should be returned- Throws:
ConnectException
-
getPrincipals
Get all groups and users from authentication scheme. The output is formatted in XML.- Specified by:
getPrincipals
in interfaceAuthInterface
- Parameters:
user
- the user which requests the informationpassword
- the user's password- Throws:
ConnectException
-
searchUser
Method for getting index of user DN in User info array -
main
Test method for the class
-