Package org.quickserver.net.qsadmin

Examples of org.quickserver.net.qsadmin.Data


* @see org.quickserver.net.qsadmin.Authenticator
*/
public class Authenticator extends QuickAuthenticationHandler {

     public AuthStatus askAuthentication(ClientHandler handler) throws IOException, AppException {
         Data data = (Data) handler.getClientData();
         data.setLastAsked("U");
         handler.sendClientMsg("+OK Username required");
         return null;
     }
View Full Code Here


         handler.sendClientMsg("+OK Username required");
         return null;
     }

     public AuthStatus handleAuthentication(ClientHandler handler, String command) throws IOException, AppException {
         Data data = (Data)handler.getClientData();

         if(data.getLastAsked().equals("U")) {
             data.setUsername(command);
             data.setLastAsked("P");
             handler.sendClientMsg("+OK Password required");
         }
         else if(data.getLastAsked().equals("P")) {
             data.setPassword(command.getBytes());
            
             if(Authenticator.validate(data.getUsername(), data.getPassword())) {
                 handler.sendClientMsg("+OK Logged in");
                 data.setPassword(null);
                 return AuthStatus.SUCCESS;
             }
             else {
                 handler.sendClientMsg("-ERR Authorisation Failed");
                 data.setPassword(null);
                 return AuthStatus.FAILURE;
             }
         }
         else {
             throw new AppException("Unknown LastAsked!");
View Full Code Here

TOP

Related Classes of org.quickserver.net.qsadmin.Data

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.