Interface FailedActionHandler


  • public interface FailedActionHandler
    Handles the failed attempts to perform an action
    • Method Detail

      • clearGuestFailures

        void clearGuestFailures​(FailedAction action,
                                String remoteAddress)
        Clears all the guest failures for the given action and remote address
      • clearPasswordFailures

        void clearPasswordFailures​(BasicUser user,
                                   PasswordType passwordType,
                                   boolean forgot)
        Clears all the password failures for the given user and password type, either in normal or forgot password mode
      • clearPinFailures

        void clearPinFailures​(Pin pin)
        Clears all the pin failures for the given Pin
      • clearUserFailures

        void clearUserFailures​(FailedAction action,
                               BasicUser user)
        Clears all the user failures for the given action and user
      • clearVoucherPinFailures

        void clearVoucherPinFailures​(Voucher voucher)
        Clears all the voucher pin failures for the given Voucher
      • countGuestFailures

        int countGuestFailures​(FailedAction action,
                               String remoteAddress)
        Returns the number of guest failures for the given action and remote address
      • countPasswordFailures

        int countPasswordFailures​(BasicUser user,
                                  PasswordType passwordType,
                                  boolean forgot)
        Returns the number of password failures for the given user and password type, either in normal or forgot password mode.
      • countUserFailures

        int countUserFailures​(FailedAction action,
                              BasicUser user)
        Returns the number of user failures for the given action and user.
      • recordAndBlockUserIfMaxReached

        boolean recordAndBlockUserIfMaxReached​(FailedAction action,
                                               BasicUser user,
                                               Integer max,
                                               UserAlertType alertType)
        Records an action failure, blocks the user (if null use the logged user) if the max has been reached and generates an user alert. Also returns if the muser was blocked, so callers can already do some logic regarding it.
      • recordBlockedUserFailedAction

        boolean recordBlockedUserFailedAction​(UserLocatorVO locator)
        Registers a transaction end listener to actually record the FailedAction.BLOCKED_USER guest action. If so, calls the listener in the new transaction, after the current transaction.
        Also, returns if the maximum attempts has been reached in the period defined for the given action, so callers can already do some logic regarding it.
        Parameters:
        locator - the located user that was blocked
      • recordGuestFailure

        boolean recordGuestFailure​(FailedAction action,
                                   String remoteAddress,
                                   UserLocatorVO locator,
                                   Integer maxAttempts,
                                   TimeInterval blockTime)
        Registers a transaction end listener to actually record the action failure. If so, calls the listener in the new transaction, after the current transaction. Also returns if the maximum attempts has been reached in the last hour, so callers can already do some logic regarding it.
      • recordPasswordFailure

        boolean recordPasswordFailure​(BasicUser user,
                                      PasswordType passwordType,
                                      boolean forgot)
        Registers a transaction end listener to actually record the password failure, either in normal or forgot password mode. Blocks the password if the maximum was actually reached.
      • recordPinFailure

        boolean recordPinFailure​(Pin pin,
                                 Integer maxAttempts,
                                 Runnable onMaxReached)
        Registers a transaction end listener to actually record the pin failure. If so, calls the onMaxReached in the new transaction, after the current transaction. Also returns if the maximum attempts has been reached, so callers can already do some logic regarding it.
      • recordUserFailure

        boolean recordUserFailure​(FailedAction action,
                                  BasicUser user,
                                  Integer maxAttempts,
                                  Runnable onMaxReached)
        Registers a transaction end listener to actually record the user action failure. If so, calls the onMaxReached in the new transaction, after the current transaction. Also returns if the maximum attempts has been reached, so callers can already do some logic regarding it.
      • recordVoucherPinFailure

        boolean recordVoucherPinFailure​(Voucher voucher,
                                        Integer maxAttempts,
                                        Runnable onMaxReached)
        Registers a transaction end listener to actually record the voucher pin failure. If so, calls the onMaxReached in the new transaction, after the current transaction. Also returns if the maximum attempts has been reached, so callers can already do some logic regarding it.