Class LoginEventDAO

java.lang.Object
marauroa.server.game.db.LoginEventDAO

public class LoginEventDAO extends Object
data access object for login events
Author:
miguel, hendrik
  • Constructor Details

    • LoginEventDAO

      protected LoginEventDAO()
      Creates a new LoginEventDAO
  • Method Details

    • addLoginEvent

      @Deprecated public void addLoginEvent(DBTransaction transaction, String username, InetAddress source, String service, String seed, int result) throws SQLException
      Deprecated.
      logs an login attempt
      Parameters:
      transaction - DBTransaction
      username - username
      source - ip-address
      service - name of service
      seed - seed
      result - 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 merged
      Throws:
      SQLException - in case of an database error
    • addLoginEvent

      public void addLoginEvent(DBTransaction transaction, String username, InetAddress source, String service, String seed, int result, Timestamp timestamp) throws SQLException
      logs an login attempt
      Parameters:
      transaction - DBTransaction
      username - username
      source - ip-address
      service - name of service
      seed - seed
      result - 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 merged
      timestamp - timestamp
      Throws:
      SQLException - in case of an database error
    • getLoginEvents

      public List<String> getLoginEvents(DBTransaction transaction, String username, int events) throws SQLException
      gets a list of recent login events
      Parameters:
      transaction - DBTransaction
      username - username
      events - number of events
      Returns:
      list of login attempts
      Throws:
      SQLException - in case of an database error
    • getLastSuccessfulLoginEvent

      public LoginEventDAO.LoginEvent getLastSuccessfulLoginEvent(DBTransaction transaction, int playerId, String service) throws SQLException
      gets the last successful login event
      Parameters:
      transaction - DBTransaction
      playerId - accountId
      service - name of service, may be null for all
      Returns:
      last successful login event
      Throws:
      SQLException - in case of an database error
    • getAmountOfFailedLogins

      public List<Pair<String,​Long>> getAmountOfFailedLogins(DBTransaction transaction, long id, int playerId) throws SQLException
      gets the amount of failed login attemps
      Parameters:
      transaction - DBTransaction
      id - only look for events younger than this id
      playerId - accountId
      Returns:
      amount of failed login attempts grouped by service name
      Throws:
      SQLException - in case of an database error
    • isAccountBlocked

      public boolean isAccountBlocked(DBTransaction transaction, String username) throws SQLException
      checks if this account is temporary blocked because of too many failed login attempts. Blocking accounts is not related to banning accounts.
      Parameters:
      transaction - DBTransaction
      username - username
      Returns:
      true, if this account is blocked; false otherwise
      Throws:
      SQLException - in case of an database error
    • isAddressBlocked

      public boolean isAddressBlocked(DBTransaction transaction, String address) throws SQLException
      checks if the ip-address is temporary blocked because of too many failed login attempts. Blocking ip-addresses is not related to banning ip-addresses.
      Parameters:
      transaction - DBTransaction
      address - ip-address
      Returns:
      true, if this address is blocked; false otherwise
      Throws:
      SQLException - in case of an database error
    • addLoginEvent

      @Deprecated public void addLoginEvent(String username, InetAddress source, String service, String seed, int result) throws SQLException
      Deprecated.
      logs an login attempt
      Parameters:
      username - username
      source - ip-address
      service - name of service
      seed - seed
      result - 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 merged
      Throws:
      SQLException - in case of an database error
    • getLoginEvents

      @Deprecated public List<String> getLoginEvents(String username, int events) throws SQLException
      Deprecated.
      gets a list of recent login events
      Parameters:
      username - username
      events - number of events
      Returns:
      list of login attempts
      Throws:
      SQLException - in case of an database error
    • isAccountBlocked

      @Deprecated public boolean isAccountBlocked(String username) throws SQLException
      Deprecated.
      checks if this account is temporary blocked because of too many failed login attempts. Blocking accounts is not related to banning accounts.
      Parameters:
      username - username
      Returns:
      true, if this account is blocked; false otherwise
      Throws:
      SQLException - in case of an database error
    • isAddressBlocked

      @Deprecated public boolean isAddressBlocked(String address) throws SQLException
      Deprecated.
      checks if the ip-address is temporary blocked because of too many failed login attempts. Blocking ip-addresses is not related to banning ip-addresses.
      Parameters:
      address - ip-address
      Returns:
      true, if this address is blocked; false otherwise
      Throws:
      SQLException - in case of an database error