Package org.cyclos.impl.access
Class FailedActionHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseNetworkedHandlerImpl
-
- org.cyclos.impl.access.FailedActionHandlerImpl
-
- All Implemented Interfaces:
FailedActionHandler
@Component public class FailedActionHandlerImpl extends BaseNetworkedHandlerImpl implements FailedActionHandler
Implementation forFailedActionHandler
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description FailedActionHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearGuestFailures(FailedAction action, String remoteAddress)Clears all the guest failures for the given action and remote addressvoidclearPasswordFailures(BasicUser user, PasswordType passwordType, boolean forgot)Clears all the password failures for the given user and password type, either in normal or forgot password modevoidclearPinFailures(Pin pin)Clears all the pin failures for the givenPinvoidclearUserFailures(FailedAction action, BasicUser userParam)Clears all the user failures for the given action and userintcountGuestFailures(FailedAction action, String remoteAddress)Returns the number of guest failures for the given action and remote addressintcountPasswordFailures(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.intcountPinFailures(Pin pin)Returns the number of pin failures for the given pinintcountUserFailures(FailedAction action, BasicUser user)Returns the number of user failures for the given action and user.voidinitialize()booleanisBlocked(String remoteAddress)Returns whether the given remote address is blockedbooleanrecordAndBlockUserIfMaxReached(FailedAction action, BasicUser userParam, 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.booleanrecordGuestFailure(FailedAction action, String remoteAddress, UserLocatorVO locator, Integer maxAttempts, TimeInterval blockTime)Registers a transaction end listener to actually record the action failure.booleanrecordPasswordFailure(BasicUser user, PasswordType passwordType, boolean forgot)Registers a transaction end listener to actually record the password failure, either in normal or forgot password mode.booleanrecordPinFailure(Pin pin, Integer maxAttempts, Runnable onMaxReached)Registers a transaction end listener to actually record the pin failure.booleanrecordUserFailure(FailedAction action, BasicUser user, Integer maxAttempts, Runnable onMaxReached)Registers a transaction end listener to actually record the user action failure.-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
clearGuestFailures
public void clearGuestFailures(FailedAction action, String remoteAddress)
Description copied from interface:FailedActionHandlerClears all the guest failures for the given action and remote address- Specified by:
clearGuestFailuresin interfaceFailedActionHandler
-
clearPasswordFailures
public void clearPasswordFailures(BasicUser user, PasswordType passwordType, boolean forgot)
Description copied from interface:FailedActionHandlerClears all the password failures for the given user and password type, either in normal or forgot password mode- Specified by:
clearPasswordFailuresin interfaceFailedActionHandler
-
clearPinFailures
public void clearPinFailures(Pin pin)
Description copied from interface:FailedActionHandlerClears all the pin failures for the givenPin- Specified by:
clearPinFailuresin interfaceFailedActionHandler
-
clearUserFailures
public void clearUserFailures(FailedAction action, BasicUser userParam)
Description copied from interface:FailedActionHandlerClears all the user failures for the given action and user- Specified by:
clearUserFailuresin interfaceFailedActionHandler
-
countGuestFailures
public int countGuestFailures(FailedAction action, String remoteAddress)
Description copied from interface:FailedActionHandlerReturns the number of guest failures for the given action and remote address- Specified by:
countGuestFailuresin interfaceFailedActionHandler
-
countPasswordFailures
public int countPasswordFailures(BasicUser user, PasswordType passwordType, boolean forgot)
Description copied from interface:FailedActionHandlerReturns the number of password failures for the given user and password type, either in normal or forgot password mode.- Specified by:
countPasswordFailuresin interfaceFailedActionHandler
-
countPinFailures
public int countPinFailures(Pin pin)
Description copied from interface:FailedActionHandlerReturns the number of pin failures for the given pin- Specified by:
countPinFailuresin interfaceFailedActionHandler
-
countUserFailures
public int countUserFailures(FailedAction action, BasicUser user)
Description copied from interface:FailedActionHandlerReturns the number of user failures for the given action and user.- Specified by:
countUserFailuresin interfaceFailedActionHandler
-
initialize
@PostConstruct public void initialize()
-
isBlocked
public boolean isBlocked(String remoteAddress)
Description copied from interface:FailedActionHandlerReturns whether the given remote address is blocked- Specified by:
isBlockedin interfaceFailedActionHandler
-
recordAndBlockUserIfMaxReached
public boolean recordAndBlockUserIfMaxReached(FailedAction action, BasicUser userParam, Integer max, UserAlertType alertType)
Description copied from interface:FailedActionHandlerRecords 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.- Specified by:
recordAndBlockUserIfMaxReachedin interfaceFailedActionHandler
-
recordGuestFailure
public boolean recordGuestFailure(FailedAction action, String remoteAddress, UserLocatorVO locator, Integer maxAttempts, TimeInterval blockTime)
Description copied from interface:FailedActionHandlerRegisters 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.- Specified by:
recordGuestFailurein interfaceFailedActionHandler
-
recordPasswordFailure
public boolean recordPasswordFailure(BasicUser user, PasswordType passwordType, boolean forgot)
Description copied from interface:FailedActionHandlerRegisters 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.- Specified by:
recordPasswordFailurein interfaceFailedActionHandler
-
recordPinFailure
public boolean recordPinFailure(Pin pin, Integer maxAttempts, Runnable onMaxReached)
Description copied from interface:FailedActionHandlerRegisters 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.- Specified by:
recordPinFailurein interfaceFailedActionHandler
-
recordUserFailure
public boolean recordUserFailure(FailedAction action, BasicUser user, Integer maxAttempts, Runnable onMaxReached)
Description copied from interface:FailedActionHandlerRegisters 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.- Specified by:
recordUserFailurein interfaceFailedActionHandler
-
-