Class DelayedLoginStore

java.lang.Object
com.atlassian.jira.security.login.DelayedLoginStore
All Implemented Interfaces:
LoginStore

public class DelayedLoginStore extends Object implements LoginStore
  • Field Details

    • FLUSH_INTERVAL

      public static final Duration FLUSH_INTERVAL
    • DELAYED_STORE_IS_DISABLED_MSG

      public static final String DELAYED_STORE_IS_DISABLED_MSG
      See Also:
  • Constructor Details

    • DelayedLoginStore

      public DelayedLoginStore(com.atlassian.core.util.Clock clock, ApplicationProperties applicationProperties, com.atlassian.crowd.embedded.api.CrowdService crowdService, com.atlassian.event.api.EventPublisher eventPublisher)
    • DelayedLoginStore

      public DelayedLoginStore(com.atlassian.core.util.Clock clock, BulkLoginStore bulkLoginStore, com.atlassian.event.api.EventPublisher eventPublisher)
  • Method Details

    • getLoginInfo

      public LoginInfo getLoginInfo(ApplicationUser user)
      LoginInfo is cached locally. Local changes invalidate entries so locally (i.e on this node) data is strictly consistent. Changes between nodes are eventually consistent and are achieved via CacheBuilder.expireAfterWrite(Duration)
      Specified by:
      getLoginInfo in interface LoginStore
      Parameters:
      user - the user in play. This MUST not be null.
      Returns:
      a non null LoginInfo object
    • recordLoginAttempt

      public LoginInfo recordLoginAttempt(ApplicationUser user, boolean authenticated)
      Failed authentication is immediately delegated. First successful authentication is immediately delegated. Second (and following) successful authentications (during FLUSH_INTERVAL) are cached.
      Specified by:
      recordLoginAttempt in interface LoginStore
      Parameters:
      user - the user in play. This MUST not be null.
      authenticated - set to true if they authenticated ok or false otherwise
      Returns:
      a non null LoginInfo object
    • updateLastLoginTime

      public LoginInfo updateLastLoginTime(ApplicationUser user)
      Description copied from interface: LoginStore
      This will update the last login time for the user without resetting the elevated security check
      Specified by:
      updateLastLoginTime in interface LoginStore
      Parameters:
      user - the user in play. This MUST not be null.
      Returns:
      a non null LoginInfo object
    • getMaxAuthenticationAttemptsAllowed

      public long getMaxAuthenticationAttemptsAllowed()
      Description copied from interface: LoginStore
      This returns the maximum failed authentications attempts that the user can perform after which they will be asked for extra elevated security information
      Specified by:
      getMaxAuthenticationAttemptsAllowed in interface LoginStore
      Returns:
      the maximum authentication attempts allowed.
    • resetFailedLoginCount

      public void resetFailedLoginCount(ApplicationUser user)
      Description copied from interface: LoginStore
      This can be called to reset the failed login count of a user
      Specified by:
      resetFailedLoginCount in interface LoginStore
      Parameters:
      user - the user to authorise. This MUST not be null.
    • onClearCache

      @EventListener public void onClearCache(ClearCacheEvent event)
    • onPluginFrameworkStartedEvent

      @EventListener public void onPluginFrameworkStartedEvent(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event)
    • onPluginFrameworkShutdownEvent

      @EventListener public void onPluginFrameworkShutdownEvent(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event)
    • onImportStartedEvent

      @EventListener public void onImportStartedEvent(ImportStartedEvent event)
      This method was presented because quick import functionality doesn't restart plugin system. Hence, past events(before the backup), can be applied causing flaky tests. When quick import is performed, dropping tables and refreshing database sequencer are not transactional. Consequently, there could be stale data in database tables if scheduled job flushed data between those two operations.
      Parameters:
      event - that triggers flush operation