Class AdminDeviceService

java.lang.Object
sk.iway.iwcm.users.devices.AdminDeviceService

@Service public class AdminDeviceService extends Object
Integrates shared device history with administrator authentication, cookies, notices and email links.
  • Field Details

  • Constructor Details

    • AdminDeviceService

      @Autowired public AdminDeviceService(DeviceService deviceService)
  • Method Details

    • isBlocked

      public static boolean isBlocked(Identity user, jakarta.servlet.http.HttpServletRequest request)
      Checks the account's browser block without starting an email challenge or changing device state. Legacy login paths use this before establishing an authenticated session.
      Parameters:
      user - administrator whose credentials have been verified
      request - request containing the browser recognition cookie
      Returns:
      true when detection is enabled and the account's browser is blocked
      Throws:
      IllegalStateException - if the device state cannot be loaded
    • requireVerification

      public static boolean requireVerification(jakarta.servlet.http.HttpServletRequest request)
      Checks browser blocking after credentials/factors and before any successful-login callbacks.
    • getPendingLogin

      public AdminDeviceService.PendingLogin getPendingLogin(jakarta.servlet.http.HttpServletRequest request)
      Returns only a live challenge for the browser which started the login.
    • requestUnblockCode

      public void requestUnblockCode(jakarta.servlet.http.HttpServletRequest request)
      Sends a login code using the existing device fields, mail layout and limits.
    • verifyUnblockCode

      public boolean verifyUnblockCode(jakarta.servlet.http.HttpServletRequest request, String code)
      Consumes a session-bound code, reloads the account and restores authentication only on success.
    • recordSuccessfulLogin

      public static void recordSuccessfulLogin(Identity user, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Records a completed interactive login without allowing notification failures to deny access. Called by LogonTools.afterSuccessLogon(HttpServletRequest, HttpServletResponse) after password policy and all required authentication factors have succeeded.
      Parameters:
      user - authenticated administrator
      request - successful authentication request
      response - response receiving the persistent browser cookie
    • getActiveEvents

      public List<DeviceEntity> getActiveEvents(Identity user)
      Returns outstanding account-owned warnings; acknowledgement does not affect recognition.
    • findEvent

      public DeviceEntity findEvent(Identity user, String eventId)
      Looks up the device's current notice without exposing whether another account owns it.
    • getDevices

      public org.springframework.data.domain.Page<DeviceEntity> getDevices(Identity user, int page)
      Returns a bounded page of the authenticated administrator's devices, most recently used first.
    • confirm

      public DeviceEntity confirm(Identity user, String eventId, String proof, boolean code)
      Confirms an owned event only with the secret delivered to the account's email address.
    • requestCode

      public void requestCode(Identity user, String eventId, jakarta.servlet.http.HttpServletRequest request)
      Sends a new code without exposing it in the response or changing device trust.
    • report

      public DeviceEntity report(Identity user, String eventId)
      Blocks the owned browser and signs out its known sessions using the ordinary logout mechanism.
    • addSessionDeviceStatus

      public void addSessionDeviceStatus(Identity user, com.fasterxml.jackson.databind.JsonNode sessionInfo)
      Adds fresh, account-owned confirmation state to session bootstrap data without exposing browser tokens.
    • getAfterLoginRedirect

      public static String getAfterLoginRedirect(jakarta.servlet.http.HttpServletRequest request)
      Consumes a local administration return target, including a security-event query parameter.
      Parameters:
      request - authentication request with the saved return target in its session
      Returns:
      validated local target or the administration overview