KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > authentication > LDAPAuthenticationManager


1 package org.enhydra.shark.authentication;
2
3 import org.enhydra.shark.api.*;
4
5 import org.enhydra.shark.api.internal.authentication.*;
6 import org.enhydra.shark.api.internal.working.CallbackUtilities;
7
8 import java.util.*;
9
10 /**
11  * Authenticates userId or password for some userId.
12  * @author Sasa Bojanic
13  */

14 public class LDAPAuthenticationManager implements AuthenticationManager {
15    // LDAP client for connection to server defined within config file
16
private LDAPClient ldapClient;
17
18    private CallbackUtilities cus;
19    
20    /**
21     * Configures LDAPAuthenticationManager.
22     *
23     * @param cus an instance of CallbackUtilities used to get
24     * properties for configuring AuthenticationManager in Shark.
25     *
26     * @exception RootException thrown if configuring doesn't succeed.
27     */

28    public void configure (CallbackUtilities cus) throws RootException {
29       this.cus=cus;
30       ldapClient=new LDAPClient(cus);
31    }
32
33    /**
34     * Validates user.
35     *
36     * @param t user transaction.
37     * @param username user name.
38     * @param pwd user password.
39     *
40     * @return true if user is validated, otherwise false.
41     *
42     * @exception RootException If something unexpected happens.
43     */

44    public boolean validateUser (UserTransaction t,String JavaDoc username,String JavaDoc pwd) throws RootException {
45       return ldapClient.checkPassword(username,pwd);
46    }
47
48 }
49
Popular Tags