/** * Takes an AccountInfo object and compares its pin to the pin it has on record for the given * account number. Returns true if the pin is correct, or throws an authorization exception if the * pin is incorrect or the account number does not exist in its records. */ public boolean authenticatePin(AccountInfo account) throws AuthorizationException, RemoteException { Integer pinOnRecord = authValues.get(account.getAccountNum()); if (pinOnRecord == null) { throw new AuthorizationException("No such account exists"); } if (pinOnRecord.equals(account.getPin())) { return true; } throw new AuthorizationException("Incorrect PIN"); }