|
|||||||||
| 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 SimpleKeyAgreement |
permanentKeyAgreementInstance
If set, this will be passed on to the constructed HostProtocolHandler objects. |
protected byte[] |
preAuthenticationMessageFromClient
If this is set, then we have received a (long) pre-authentication message from the client and will use it to verify its public key. |
protected java.util.Vector |
presharedShortSecrets
If this is set, then we have some form of user input that has been created _before_ starting a specific protocol instance and is assumed to be secret. |
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. |
SimpleKeyAgreement |
getPermanentKeyAgreementInstance()
Returns the permanent key agreement instance. |
byte[] |
getPermanentPreAuthenticationMessage()
|
byte[] |
getPreAuthenticationMessageFromClient()
Returns the pre-authentication message received from the client. |
java.util.Vector |
getPresharedShortSecrets()
Returns the user-input preshared short secret. |
boolean |
isRunning()
Returns true if the server is running, false otherwise. |
boolean |
removeProtocolCommandHandler(java.lang.String command)
Removes a protocol command handler. |
void |
setPermanentKeyAgreementInstance(SimpleKeyAgreement keyAgreement)
Sets the permanent key agreement instance to use for all subsequent HostProtocolHandler invocations. |
void |
setPreAuthenticationMessageFromClient(byte[] publicKeyCommitment)
Sets a pre-authentication message received from the client and committing it to its public key that it will use when starting the proper protocol run. |
void |
setPresharedShortSecret(byte[] presharedShortSecret)
Sets a preshared short secret as entered by the user. |
void |
setPresharedShortSecrets(java.util.Vector presharedShortSecrets)
Sets a list of preshared short secrets as entered by the user. |
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.Vector presharedShortSecrets
Vector may contain multiple entries,
in this case each entry is assumed to be a 'candidate secret'.
protected byte[] preAuthenticationMessageFromClient
protected SimpleKeyAgreement permanentKeyAgreementInstance
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 setPresharedShortSecret(byte[] presharedShortSecret)
public void setPresharedShortSecrets(java.util.Vector presharedShortSecrets)
public java.util.Vector getPresharedShortSecrets()
public void setPreAuthenticationMessageFromClient(byte[] publicKeyCommitment)
public byte[] getPreAuthenticationMessageFromClient()
public void setPermanentKeyAgreementInstance(SimpleKeyAgreement keyAgreement)
public SimpleKeyAgreement getPermanentKeyAgreementInstance()
public byte[] getPermanentPreAuthenticationMessage()
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 | ||||||||