Package marauroa.server.game.container
Class SecuredLoginInfo
java.lang.Object
marauroa.server.game.container.SecuredLoginInfo
This class stores the information needed to allow a secure login. Once
login is completed the information is cleared.
-
Field Summary
Modifier and TypeFieldDescriptionclient ip addressbyte[]
A long array of bytes that represent a random value.byte[]
A long byte array that represent the hash of the client Nonce fieldThe server RSA key.byte[]
An array that represent the hash of the password xor ClientNonce xor ServerNonce.reason why a login failedseed identifying the clientbyte[]
A long array of bytes that represent the Hash of a random value.token typeUsername of the playerboolean
is the password encrypted -
Constructor Summary
ConstructorDescriptionSecuredLoginInfo(InetAddress address)
ConstructorSecuredLoginInfo(RSAKey key, byte[] clientNonceHash, byte[] serverNonce, InetAddress address)
Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLoginEvent(DBTransaction transaction, InetAddress address, int result, Timestamp timestamp)
Add a login event to database each time player login, even if it fails.int
countConnectionsFromSameIPAddress(PlayerEntryContainer playerContainer)
counts the number of connections from this ip-addressbyte[]
gets the decrypted passwordgetStatus(DBTransaction transaction)
Returns a string indicating the status of the account.boolean
isBlocked(DBTransaction transaction)
Returns true if an account is temporarily blocked due to too many tries in the defined time frame.boolean
are we using a secure channel so that we can skip our own RSA encryption and replay protectiontoString()
returns a string suitable for debug output of this DBCommand.
-
Field Details
-
serverNonce
public byte[] serverNonceA long array of bytes that represent the Hash of a random value. -
clientNonce
public byte[] clientNonceA long array of bytes that represent a random value. -
clientNonceHash
public byte[] clientNonceHashA long byte array that represent the hash of the client Nonce field -
username
Username of the player -
password
public byte[] passwordAn array that represent the hash of the password xor ClientNonce xor ServerNonce. -
key
The server RSA key. -
address
client ip address -
seed
seed identifying the client -
reason
reason why a login failed -
usingSecureChannel
public boolean usingSecureChannelis the password encrypted -
tokenType
token type -
token
-
-
Constructor Details
-
SecuredLoginInfo
public SecuredLoginInfo(RSAKey key, byte[] clientNonceHash, byte[] serverNonce, InetAddress address)Constructor- Parameters:
key
- the server private keyclientNonceHash
- the client hashserverNonce
- the server random bigintaddress
- client ip address
-
SecuredLoginInfo
Constructor- Parameters:
address
- client ip address
-
-
Method Details
-
addLoginEvent
public void addLoginEvent(DBTransaction transaction, InetAddress address, int result, Timestamp timestamp) throws SQLExceptionAdd a login event to database each time player login, even if it fails.- Parameters:
transaction
- DBTransactionsaddress
- the IP address that originated the request.result
- 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 mergedtimestamp
- timestamp- Throws:
SQLException
- if there is any database problem.
-
countConnectionsFromSameIPAddress
counts the number of connections from this ip-address- Parameters:
playerContainer
- PlayerEntryContainer- Returns:
- number of active connections
-
isBlocked
Returns true if an account is temporarily blocked due to too many tries in the defined time frame.- Parameters:
transaction
- DBTransactions- Returns:
- true if an account is temporarily blocked due to too many tries in the defined time frame.
- Throws:
SQLException
- if there is any database problem.
-
getStatus
Returns a string indicating the status of the account. It can be:- active
- inactive
- banned
- Parameters:
transaction
- DBTransactions- Returns:
- a string indicating the status of the account.
- Throws:
SQLException
-
isUsingSecureChannel
public boolean isUsingSecureChannel()are we using a secure channel so that we can skip our own RSA encryption and replay protection- Returns:
- usingSecureChannel
-
getDecryptedPasswordHash
public byte[] getDecryptedPasswordHash()gets the decrypted password- Returns:
- the decrypted password hash
-
toString
returns a string suitable for debug output of this DBCommand.
-