1 14 15 package echoserver; 16 17 import org.quickserver.net.server.*; 18 import java.io.*; 19 import org.quickserver.net.AppException; 20 21 24 public class EchoServerQuickAuthenticator extends QuickAuthenticator { 25 26 public boolean askAuthorisation(ClientHandler clientHandler) 27 throws IOException, AppException { 28 String username = askStringInput(clientHandler, "User Name :"); 29 31 String password = askStringInput(clientHandler, "Password :"); 32 34 if(username.equals(password)) { 35 sendString(clientHandler, "Auth OK"); 36 return true; 37 } else { 38 sendString(clientHandler, "Auth Failed"); 39 return false; 40 } 41 } 42 } 43 | Popular Tags |