1 16 package org.apache.juddi.auth; 17 18 import org.apache.commons.logging.Log; 19 import org.apache.commons.logging.LogFactory; 20 import org.apache.juddi.error.RegistryException; 21 22 27 public class DefaultAuthenticator implements Authenticator 28 { 29 private static Log log = LogFactory.getLog(DefaultAuthenticator.class); 31 32 35 public DefaultAuthenticator() 36 { 37 } 38 39 42 public String authenticate(String userID,String credential) 43 throws RegistryException 44 { 45 return userID; 46 } 47 48 49 50 51 52 53 54 public static void main(String [] args) 55 throws Exception 56 { 57 Authenticator auth = new DefaultAuthenticator(); 58 59 try { 60 System.out.print("anou_mana/password: "); 61 auth.authenticate("anou_mana","password"); 62 System.out.println("successfully authenticated"); 63 } 64 catch(Exception ex) { 65 System.out.println(ex.getMessage()); 66 } 67 68 try { 69 System.out.print("anou_mana/badpass: "); 70 auth.authenticate("anou_mana","badpass"); 71 System.out.println("successfully authenticated"); 72 } 73 catch(Exception ex) { 74 System.out.println(ex.getMessage()); 75 } 76 77 try { 78 System.out.print("bozo/clown: "); 79 auth.authenticate("bozo","clown"); 80 System.out.println("successfully authenticated"); 81 } 82 catch(Exception ex) { 83 System.out.println(ex.getMessage()); 84 } 85 86 try { 87 System.out.print("sviens/password: "); 88 auth.authenticate("sviens","password"); 89 System.out.println("successfully authenticated"); 90 } 91 catch(Exception ex) { 92 System.out.println(ex.getMessage()); 93 } 94 } 95 } | Popular Tags |