games.strategy.engine.framework.startup.login
Class ClientLoginValidator
java.lang.Object
games.strategy.engine.framework.startup.login.ClientLoginValidator
- All Implemented Interfaces:
- ILoginValidator
public class ClientLoginValidator
- extends java.lang.Object
- implements ILoginValidator
If we require a password, then we challenge the client with a salt value, the salt
being different for each login attempt. . The client hashes the password entered by
the user with this salt, and sends it back to us. This prevents the password from
travelling over the network in plain text, and also prevents someone listening on
the connection from getting enough information to log in (since the salt will change
on the next login attempt)
- Author:
- sgb
|
Method Summary |
java.util.Map<java.lang.String,java.lang.String> |
getChallengeProperties(java.lang.String userName,
java.net.SocketAddress remoteAddress)
The challenge properties to send to the client. |
void |
setGamePassword(java.lang.String password)
Set the password required for the game, or to null if no password is required. |
java.lang.String |
verifyConnection(java.util.Map<java.lang.String,java.lang.String> propertiesSentToClient,
java.util.Map<java.lang.String,java.lang.String> propertiesReadFromClient,
java.lang.String clientName,
java.net.SocketAddress remoteAddress)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SALT_PROPERTY
public static final java.lang.String SALT_PROPERTY
- See Also:
- Constant Field Values
PASSWORD_REQUIRED_PROPERTY
public static final java.lang.String PASSWORD_REQUIRED_PROPERTY
- See Also:
- Constant Field Values
ClientLoginValidator
public ClientLoginValidator()
setGamePassword
public void setGamePassword(java.lang.String password)
- Set the password required for the game, or to null if no password is required.
getChallengeProperties
public java.util.Map<java.lang.String,java.lang.String> getChallengeProperties(java.lang.String userName,
java.net.SocketAddress remoteAddress)
- Description copied from interface:
ILoginValidator
- The challenge properties to send to the client. The client will be sent the challenge properties,
and will be expected to return a properties object to validate its connection.
- Specified by:
getChallengeProperties in interface ILoginValidator
verifyConnection
public java.lang.String verifyConnection(java.util.Map<java.lang.String,java.lang.String> propertiesSentToClient,
java.util.Map<java.lang.String,java.lang.String> propertiesReadFromClient,
java.lang.String clientName,
java.net.SocketAddress remoteAddress)
- Specified by:
verifyConnection in interface ILoginValidator
propertiesReadFromClient - - client properties written by the client after receiving the challange string.clientName - - the user name given by the clientremoteAddress - - the remote adress
- Returns:
- - null if the attempt was successful, an error message otherwise