| java.lang.Object org.quickserver.net.server.QuickAuthenticator
All known Subclasses: echoserver.EchoServerQuickAuthenticator, pipeserver.Authenticator, ftpserver.Authenticator,
QuickAuthenticator | abstract public class QuickAuthenticator implements Authenticator(Code) | | This class is used to authenticate a client when
it connects to QuickServer. Only single instance of this class
will be used per QuickServer to handle all authentication.
Should have a default constructor.
Ex:
package echoserver;
import org.quickserver.net.server.*;
import java.io.*;
public class EchoServerQuickAuthenticator extends QuickAuthenticator {
public boolean askAuthorisation(ClientHandler clientHandler)
throws IOException {
String username = askStringInput(clientHandler, "User Name :");
String password = askStringInput(clientHandler, "Password :");
if(username==null || password ==null)
return false;
if(username.equals(password)) {
sendString(clientHandler, "Auth OK");
return true;
} else {
sendString(clientHandler, "Auth Failed");
return false;
}
}
}
author: Akshathkumar Shetty since: 1.3 |
askBinaryInput | public byte[] askBinaryInput(ClientHandler clientHandler, byte msg) throws IOException(Code) | | Sends the given binary data to the client and reads binary data input.
the binary data input read from the client. If received byte is null it will throw ConnectionLostException. Parameters: msg - binary data to send before reading input.If null is passed it will not send any thing. exception: IOException - if an I/O error occurs since: 1.4 |
askByteInput | public String askByteInput(ClientHandler clientHandler, String msg) throws IOException(Code) | | Prints the given message to the client and reads a line of input.
the line of input read from the client. If received byte is null it will throw ConnectionLostException. Parameters: msg - Message to send before reading input.If null is passed it will not send any thing. exception: IOException - if an I/O error occurs since: 1.3.2 |
askStringInput | public String askStringInput(ClientHandler clientHandler, String msg) throws IOException(Code) | | Prints the given message to the client and reads a line of input.
the line of input read from the client. Parameters: msg - Message to send before reading input. If received String is null it will throw ConnectionLostException.If null is passed it will not send any thing. exception: IOException - if an I/O error occurs |
sendBinary | public void sendBinary(ClientHandler clientHandler, byte msg) throws IOException(Code) | | Sends the given binary data to the client.
Parameters: msg - binary data to send.If null is passed it will not send any thing. since: 1.4 |
sendByte | public void sendByte(ClientHandler clientHandler, String msg) throws IOException(Code) | | Prints the given message to the client.
Parameters: msg - Message to send.If null is passed it will not send any thing. since: 1.3.2 |
sendObject | public void sendObject(ClientHandler clientHandler, Object msg) throws IOException(Code) | | Sends the given object to the client.
Parameters: msg - Message to send.If null is passed it will not send any thing. |
sendString | public void sendString(ClientHandler clientHandler, String msg) throws IOException(Code) | | Prints the given message to the client.
Parameters: msg - Message to send.If null is passed it will not send any thing. |
|
|