1 17 18 package org.objectweb.jac.aspects.authentication; 19 20 import org.objectweb.jac.aspects.gui.DisplayContext; 21 import org.objectweb.jac.aspects.gui.GuiAC; 22 import org.objectweb.jac.core.Collaboration; 23 import org.objectweb.jac.core.Display; 24 import org.objectweb.jac.core.rtti.ClassRepository; 25 import org.objectweb.jac.core.rtti.MethodItem; 26 import org.objectweb.jac.util.Log; 27 28 34 public class TrustingAuthenticator implements Authenticator { 35 public String authenticate() throws AuthenticationFailedException { 36 DisplayContext context = 37 (DisplayContext)Collaboration.get().getAttribute(GuiAC.DISPLAY_CONTEXT); 38 if (context!=null) { 39 Display display = context.getDisplay(); 40 MethodItem method = 41 ClassRepository.get().getClass(this).getMethod("askUsername"); 42 Object [] parameters = new Object [method.getParameterTypes().length]; 43 if (!display.showInput(this,method,parameters)) { 44 return null; 45 } 46 return (String )parameters[0]; 47 48 } else { 49 Log.warning("No display context available, cannot authenticate user"); 50 return null; 51 } 52 } 53 public void askUsername(String username) { 54 } 55 } 56 | Popular Tags |