|
QuickServer v1.4.6 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines a class that can be used by QuickServer to authenticate a client when new connection is made to QuickServer.
Recommendations to be followed when implementing ClientAuthenticationHandler
ClientData class, which can be retrieved
using handler.getClientData() method.
Ex:
package echoserver;
import java.net.*;
import java.io.*;
import org.quickserver.net.server.ClientAuthenticationHandler;
import org.quickserver.net.server.ClientHandler;
public class EchoAuthenticationHandler
implements ClientAuthenticationHandler {
public AuthStatus askAuthentication(ClientHandler handler)
throws IOException, AppException {
handler.sendClientMsg("Password :");
return null;
}
public AuthStatus handleAuthentication(ClientHandler handler, String data)
throws IOException, AppException {
if(data.equals("password"))
return AuthStatus.SUCCESS;
else
return AuthStatus.FAILURE;
}
public AuthStatus handleAuthentication(ClientHandler handler, Object data)
throws IOException, AppException {
if(true) throw new IOException("Object mode not implemented!");
}
public AuthStatus handleAuthentication(ClientHandler handler, byte data[])
throws IOException {
if(true) throw new IOException("Byte mode not implemented!");
}
}
| Method Summary | |
AuthStatus |
askAuthentication(ClientHandler handler)
Method called first time after gotConnected() method is caled on ClientEventHandler, if Authenticator is set. |
AuthStatus |
handleAuthentication(ClientHandler handler,
byte[] data)
Method called when ever a client sends binary data before authentication. |
AuthStatus |
handleAuthentication(ClientHandler handler,
java.lang.Object data)
Method called when ever a client sends Object data before authentication. |
AuthStatus |
handleAuthentication(ClientHandler handler,
java.lang.String data)
Method called when ever a client sends character/string data before authentication. |
| Method Detail |
public AuthStatus askAuthentication(ClientHandler handler)
throws java.io.IOException,
AppException
java.io.IOException - if io error in socket
AppException - if client socket needs to be closed.
public AuthStatus handleAuthentication(ClientHandler handler,
java.lang.String data)
throws java.io.IOException,
AppException
java.io.IOException - if io error in socket
AppException - if client socket needs to be closed.
public AuthStatus handleAuthentication(ClientHandler handler,
java.lang.Object data)
throws java.io.IOException,
AppException
java.io.IOException - if io error in socket
AppException - if client socket needs to be closed.
public AuthStatus handleAuthentication(ClientHandler handler,
byte[] data)
throws java.io.IOException,
AppException
java.io.IOException - if io error in socket
AppException - if client socket needs to be closed.
|
QuickServer v1.4.6 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||