Package marauroa.server.game.db
Class LoginEventDAO
java.lang.Object
marauroa.server.game.db.LoginEventDAO
data access object for login events
- Author:
- miguel, hendrik
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class to store the login events -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLoginEvent(String username, InetAddress source, String service, String seed, int result)
Deprecated.void
addLoginEvent(DBTransaction transaction, String username, InetAddress source, String service, String seed, int result)
Deprecated.void
addLoginEvent(DBTransaction transaction, String username, InetAddress source, String service, String seed, int result, Timestamp timestamp)
logs an login attemptgetAmountOfFailedLogins(DBTransaction transaction, long id, int playerId)
gets the amount of failed login attempsgetLastSuccessfulLoginEvent(DBTransaction transaction, int playerId, String service)
gets the last successful login eventgetLoginEvents(String username, int events)
Deprecated.getLoginEvents(DBTransaction transaction, String username, int events)
gets a list of recent login eventsboolean
isAccountBlocked(String username)
Deprecated.boolean
isAccountBlocked(DBTransaction transaction, String username)
checks if this account is temporary blocked because of too many failed login attempts.boolean
isAddressBlocked(String address)
Deprecated.boolean
isAddressBlocked(DBTransaction transaction, String address)
checks if the ip-address is temporary blocked because of too many failed login attempts.
-
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 SQLExceptionDeprecated.logs an login attempt- Parameters:
transaction
- DBTransactionusername
- usernamesource
- ip-addressservice
- name of serviceseed
- seedresult
- 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 SQLExceptionlogs an login attempt- Parameters:
transaction
- DBTransactionusername
- usernamesource
- ip-addressservice
- name of serviceseed
- seedresult
- 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 mergedtimestamp
- timestamp- Throws:
SQLException
- in case of an database error
-
getLoginEvents
public List<String> getLoginEvents(DBTransaction transaction, String username, int events) throws SQLExceptiongets a list of recent login events- Parameters:
transaction
- DBTransactionusername
- usernameevents
- 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 SQLExceptiongets the last successful login event- Parameters:
transaction
- DBTransactionplayerId
- accountIdservice
- name of service, may benull
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 SQLExceptiongets the amount of failed login attemps- Parameters:
transaction
- DBTransactionid
- only look for events younger than this idplayerId
- accountId- Returns:
- amount of failed login attempts grouped by service name
- Throws:
SQLException
- in case of an database error
-
isAccountBlocked
checks if this account is temporary blocked because of too many failed login attempts. Blocking accounts is not related to banning accounts.- Parameters:
transaction
- DBTransactionusername
- username- Returns:
- true, if this account is blocked; false otherwise
- Throws:
SQLException
- in case of an database error
-
isAddressBlocked
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
- DBTransactionaddress
- 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 SQLExceptionDeprecated.logs an login attempt- Parameters:
username
- usernamesource
- ip-addressservice
- name of serviceseed
- seedresult
- 0 failed password, 1 successful login, 2 banned, 3 inactive, 4 blocked, 5 merged- Throws:
SQLException
- in case of an database error
-
getLoginEvents
Deprecated.gets a list of recent login events- Parameters:
username
- usernameevents
- number of events- Returns:
- list of login attempts
- Throws:
SQLException
- in case of an database error
-
isAccountBlocked
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.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
-