Package marauroa.server.game.db
Class AccountLinkDAO
java.lang.Object
marauroa.server.game.db.AccountLinkDAO
data access object for account links
- Author:
- hendrik
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addAccountLink(DBTransaction transaction, int accountId, String tokenType, String externalUsername, String externalNickname, String externalEmail, String secret)
adds an accountLink.int
getAccountIdByLinkedSecret(DBTransaction transaction, String tokenType, String secret)
gets the id of the accountint
getAccountIdByLinkedUsername(DBTransaction transaction, String username)
gets the id of the accountboolean
verifyPermanentToken(DBTransaction transaction, SecuredLoginInfo info)
verifies that a provided token is a known secret
-
Constructor Details
-
AccountLinkDAO
protected AccountLinkDAO()Creates a new AccountLinkDAO
-
-
Method Details
-
getAccountIdByLinkedUsername
public int getAccountIdByLinkedUsername(DBTransaction transaction, String username) throws SQLExceptiongets the id of the account- Parameters:
transaction
- DBTransactionusername
- username- Returns:
- id of account, or -1 if no such account exists
- Throws:
SQLException
- in case of an database error
-
getAccountIdByLinkedSecret
public int getAccountIdByLinkedSecret(DBTransaction transaction, String tokenType, String secret) throws SQLExceptiongets the id of the account- Parameters:
transaction
- DBTransactiontokenType
- type of tokensecret
- a secret- Returns:
- true on success, false if the account does not exists or the password does not match
- Throws:
SQLException
- in case of an database error
-
verifyPermanentToken
public boolean verifyPermanentToken(DBTransaction transaction, SecuredLoginInfo info) throws SQLExceptionverifies that a provided token is a known secret- Parameters:
transaction
- DBTransactioninfo
- SecuredLoginInfo- Returns:
- true, if a secret could be verified, false otherweise
- Throws:
SQLException
- in case of a database error
-
addAccountLink
public boolean addAccountLink(DBTransaction transaction, int accountId, String tokenType, String externalUsername, String externalNickname, String externalEmail, String secret) throws SQLExceptionadds an accountLink. tokenType and either username or secret are required.- Parameters:
transaction
- DBTransactionaccountId
- account.idtokenType
- tokenexternalUsername
- usernameexternalNickname
- nicknameexternalEmail
- emailsecret
- secret- Returns:
- true if the accountLink was created successfully
- Throws:
SQLException
-