|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.openuat.authentication.AuthenticationEventSender
org.openuat.util.HostServerBase
public abstract class HostServerBase
This is a base class for listening to connections and spawning HostProtocolHandler objects upon incoming connections. It takes care of handling the background listening thread.
| Field Summary | |
|---|---|
protected boolean |
keepConnected
If set to true, the fully connected socket/channel that represents a connection to a client will not be closed as soon as the HostProtocolHandler is finished with it, but will be passed to the authentication success event of the respective listener for further reuse. |
protected java.util.Hashtable |
protocolCommandHandlers
This only keeps the command handlers so that they can be pre-registered and then be passed onto HostProtocolHandler objects when they are instantiated. |
protected int |
protocolTimeoutMs
If =! |
protected boolean |
running
Used to signal the listening thread to stop itself. |
protected boolean |
useJSSE
If set to true, the JSSE will be used, if set to false, the Bouncycastle Lightweight API. |
| Fields inherited from class org.openuat.authentication.AuthenticationEventSender |
|---|
eventsHandlers |
| Constructor Summary | |
|---|---|
HostServerBase(boolean keepConnected,
boolean useJSSE,
int protocolTimeoutMs)
Initializes the listener. |
|
| Method Summary | |
|---|---|
void |
addProtocolCommandHandler(java.lang.String command,
ProtocolCommandHandler handler)
Adds a protocol command handler. |
boolean |
isRunning()
Returns true if the server is running, false otherwise. |
boolean |
removeProtocolCommandHandler(java.lang.String command)
Removes a protocol command handler. |
boolean |
setProtocolCommandHandler(java.util.Hashtable handlers)
|
void |
start()
Starts a background thread (using the run() method of this class) that will listen for incoming connections. |
protected void |
startProtocol(RemoteConnection remote)
This is a small helper function that derived classes should call after accepting an incoming connection. |
void |
stop()
Signals the background listening thread to stop and waits for it. |
| Methods inherited from class org.openuat.authentication.AuthenticationEventSender |
|---|
addAuthenticationProgressHandler, raiseAuthenticationFailureEvent, raiseAuthenticationProgressEvent, raiseAuthenticationStartedEvent, raiseAuthenticationSuccessEvent, removeAuthenticationProgressHandler, setAuthenticationProgressHandlers |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.openuat.util.HostAuthenticationServer |
|---|
addAuthenticationProgressHandler, removeAuthenticationProgressHandler |
| Methods inherited from interface java.lang.Runnable |
|---|
run |
| Field Detail |
|---|
protected boolean running
protected boolean keepConnected
protected boolean useJSSE
protected int protocolTimeoutMs
protected java.util.Hashtable protocolCommandHandlers
| Constructor Detail |
|---|
public HostServerBase(boolean keepConnected,
boolean useJSSE,
int protocolTimeoutMs)
useJSSE - If set to true, the JSSE API with the default JCE provider of the JVM will be used
for cryptographic operations. If set to false, an internal copy of the Bouncycastle
Lightweight API classes will be used.protocolTimeoutMs - The maximum duration in milliseconds that this authentication
protocol may take before it will abort with an AuthenticationFailed
exception. Set to -1 to disable the timeout.If set to true, the connection to the client will be kept connected after the
registered HostProtocolHandler has finished. This allows the socket to be
reused for additional communication after the first authentication
protocol has been completed.| Method Detail |
|---|
public void addProtocolCommandHandler(java.lang.String command,
ProtocolCommandHandler handler)
HostAuthenticationServer
addProtocolCommandHandler in interface HostAuthenticationServercommand - The command to react to.handler - The handler that will be called to handle the protocol
session when it is started with command.HostProtocolHandler.addProtocolCommandHandler(java.lang.String, org.openuat.util.ProtocolCommandHandler)public boolean removeProtocolCommandHandler(java.lang.String command)
HostAuthenticationServer
removeProtocolCommandHandler in interface HostAuthenticationServercommand - The command to stop reacting to.
HostProtocolHandler.removeProtocolCommandHandler(java.lang.String)public boolean setProtocolCommandHandler(java.util.Hashtable handlers)
HostProtocolHandler.setProtocolCommandHandlers(java.util.Hashtable)
public void start()
throws java.io.IOException
start in interface HostAuthenticationServerjava.io.IOException
public void stop()
throws InternalApplicationException
stop in interface HostAuthenticationServerInternalApplicationExceptionpublic boolean isRunning()
protected void startProtocol(RemoteConnection remote)
remote - The (already opened) remote connection to use.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||