1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.auth;
17
18 import org.apache.juddi.error.RegistryException;
19
20 /***
21 * This is a simple implementation of jUDDI's Authenticator interface.
22 *
23 * @author Steve Viens (sviens@apache.org)
24 */
25 public class DefaultAuthenticator implements Authenticator
26 {
27 /***
28 *
29 */
30 public DefaultAuthenticator()
31 {
32 }
33
34 /***
35 *
36 */
37 public String authenticate(String userID,String credential)
38 throws RegistryException
39 {
40 return userID;
41 }
42
43
44 /****************************************************************************/
45 /****************************** TEST DRIVER *********************************/
46 /****************************************************************************/
47
48
49 public static void main(String[] args)
50 throws Exception
51 {
52 Authenticator auth = new DefaultAuthenticator();
53
54 try {
55 System.out.print("anou_mana/password: ");
56 auth.authenticate("anou_mana","password");
57 System.out.println("successfully authenticated");
58 }
59 catch(Exception ex) {
60 System.out.println(ex.getMessage());
61 }
62
63 try {
64 System.out.print("anou_mana/badpass: ");
65 auth.authenticate("anou_mana","badpass");
66 System.out.println("successfully authenticated");
67 }
68 catch(Exception ex) {
69 System.out.println(ex.getMessage());
70 }
71
72 try {
73 System.out.print("bozo/clown: ");
74 auth.authenticate("bozo","clown");
75 System.out.println("successfully authenticated");
76 }
77 catch(Exception ex) {
78 System.out.println(ex.getMessage());
79 }
80
81 try {
82 System.out.print("sviens/password: ");
83 auth.authenticate("sviens","password");
84 System.out.println("successfully authenticated");
85 }
86 catch(Exception ex) {
87 System.out.println(ex.getMessage());
88 }
89 }
90 }