Class SecuredLoginInfo

java.lang.Object
marauroa.server.game.container.SecuredLoginInfo

public class SecuredLoginInfo extends Object
This class stores the information needed to allow a secure login. Once login is completed the information is cleared.
  • Field Details

    • serverNonce

      public byte[] serverNonce
      A long array of bytes that represent the Hash of a random value.
    • clientNonce

      public byte[] clientNonce
      A long array of bytes that represent a random value.
    • clientNonceHash

      public byte[] clientNonceHash
      A long byte array that represent the hash of the client Nonce field
    • username

      public String username
      Username of the player
    • password

      public byte[] password
      An array that represent the hash of the password xor ClientNonce xor ServerNonce.
    • key

      public RSAKey key
      The server RSA key.
    • address

      public InetAddress address
      client ip address
    • seed

      public String seed
      seed identifying the client
    • reason

      reason why a login failed
    • usingSecureChannel

      public boolean usingSecureChannel
      is the password encrypted
    • tokenType

      public String tokenType
      token type
    • token

      public String token
  • Constructor Details

    • SecuredLoginInfo

      public SecuredLoginInfo(RSAKey key, byte[] clientNonceHash, byte[] serverNonce, InetAddress address)
      Constructor
      Parameters:
      key - the server private key
      clientNonceHash - the client hash
      serverNonce - the server random bigint
      address - client ip address
    • SecuredLoginInfo

      public SecuredLoginInfo(InetAddress address)
      Constructor
      Parameters:
      address - client ip address
  • Method Details

    • addLoginEvent

      public void addLoginEvent(DBTransaction transaction, InetAddress address, int result, Timestamp timestamp) throws SQLException
      Add a login event to database each time player login, even if it fails.
      Parameters:
      transaction - DBTransactions
      address - the IP address that originated the request.
      result - 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 merged
      timestamp - timestamp
      Throws:
      SQLException - if there is any database problem.
    • countConnectionsFromSameIPAddress

      public int countConnectionsFromSameIPAddress(PlayerEntryContainer playerContainer)
      counts the number of connections from this ip-address
      Parameters:
      playerContainer - PlayerEntryContainer
      Returns:
      number of active connections
    • isBlocked

      public boolean isBlocked(DBTransaction transaction) throws SQLException
      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

      public String getStatus(DBTransaction transaction) throws SQLException
      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

      public String toString()
      returns a string suitable for debug output of this DBCommand.
      Overrides:
      toString in class Object
      Returns:
      debug string