Package sk.iway.iwcm.users.devices
Class AdminDeviceService
java.lang.Object
sk.iway.iwcm.users.devices.AdminDeviceService
Integrates shared device history with administrator authentication, cookies, notices and email links.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordHolds the authenticated identity outside both login contexts until the email code succeeds. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSessionDeviceStatus(Identity user, com.fasterxml.jackson.databind.JsonNode sessionInfo) Adds fresh, account-owned confirmation state to session bootstrap data without exposing browser tokens.Confirms an owned event only with the secret delivered to the account's email address.Looks up the device's current notice without exposing whether another account owns it.getActiveEvents(Identity user) Returns outstanding account-owned warnings; acknowledgement does not affect recognition.static StringgetAfterLoginRedirect(jakarta.servlet.http.HttpServletRequest request) Consumes a local administration return target, including a security-event query parameter.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.getPendingLogin(jakarta.servlet.http.HttpServletRequest request) Returns only a live challenge for the browser which started the login.static booleanChecks the account's browser block without starting an email challenge or changing device state.static voidrecordSuccessfulLogin(Identity user, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Records a completed interactive login without allowing notification failures to deny access.Blocks the owned browser and signs out its known sessions using the ordinary logout mechanism.voidrequestCode(Identity user, String eventId, jakarta.servlet.http.HttpServletRequest request) Sends a new code without exposing it in the response or changing device trust.voidrequestUnblockCode(jakarta.servlet.http.HttpServletRequest request) Sends a login code using the existing device fields, mail layout and limits.static booleanrequireVerification(jakarta.servlet.http.HttpServletRequest request) Checks browser blocking after credentials/factors and before any successful-login callbacks.booleanverifyUnblockCode(jakarta.servlet.http.HttpServletRequest request, String code) Consumes a session-bound code, reloads the account and restores authentication only on success.
-
Field Details
-
SESSION_DEVICE_ID
- See Also:
-
VERIFICATION_URL
- See Also:
-
PENDING_LOGIN
- See Also:
-
VERIFICATION_MESSAGE
- See Also:
-
SECOND_FACTOR_VERIFIED
- See Also:
-
-
Constructor Details
-
AdminDeviceService
-
-
Method Details
-
isBlocked
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 verifiedrequest- 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
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 byLogonTools.afterSuccessLogon(HttpServletRequest, HttpServletResponse)after password policy and all required authentication factors have succeeded.- Parameters:
user- authenticated administratorrequest- successful authentication requestresponse- response receiving the persistent browser cookie
-
getActiveEvents
Returns outstanding account-owned warnings; acknowledgement does not affect recognition. -
findEvent
Looks up the device's current notice without exposing whether another account owns it. -
getDevices
Returns a bounded page of the authenticated administrator's devices, most recently used first. -
confirm
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
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
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
-