Class AccountLinkDAO

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

public class AccountLinkDAO extends Object
data access object for account links
Author:
hendrik
  • Constructor Details

    • AccountLinkDAO

      protected AccountLinkDAO()
      Creates a new AccountLinkDAO
  • Method Details

    • getAccountIdByLinkedUsername

      public int getAccountIdByLinkedUsername(DBTransaction transaction, String username) throws SQLException
      gets the id of the account
      Parameters:
      transaction - DBTransaction
      username - 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 SQLException
      gets the id of the account
      Parameters:
      transaction - DBTransaction
      tokenType - type of token
      secret - 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 SQLException
      verifies that a provided token is a known secret
      Parameters:
      transaction - DBTransaction
      info - 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 SQLException
      adds an accountLink. tokenType and either username or secret are required.
      Parameters:
      transaction - DBTransaction
      accountId - account.id
      tokenType - token
      externalUsername - username
      externalNickname - nickname
      externalEmail - email
      secret - secret
      Returns:
      true if the accountLink was created successfully
      Throws:
      SQLException