Package com.jangular.backend.service

# Class UserLoginHistoryService

java.lang.Object
com.jangular.backend.service.UserLoginHistoryService

@Service public class UserLoginHistoryService extends Object

## Constructor Summary

Constructors
Constructor
Description
`UserLoginHistoryService()`

## Method Summary

Modifier and Type
Method
Description
`List<UserLoginHistory>`
`getActiveSessions(Long userId)`
Get active sessions (logins without logout)
`List<UserLoginHistory>`
`getFailedLogins(Long userId)`
Get failed login attempts
`List<UserLoginHistory>`
`getLoginHistoryBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate)`
Get login history within a date range
`List<UserLoginHistory>`
`getSuccessfulLogins(Long userId)`
Get successful login history
`List<UserLoginHistory>`
`getUserLoginHistory(Long userId)`
Get user login history
`UserLoginHistory`
`recordLoginAttempt(Long userId, String ipAddress, String userAgent, boolean successful, String errorMessage)`
Record a login attempt (successful or failed)
`void`
`recordLogout(Long userId)`
Record a user logout

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### UserLoginHistoryService

public UserLoginHistoryService()

## Method Details

### recordLoginAttempt

@Transactional public UserLoginHistory recordLoginAttempt(Long userId, String ipAddress, String userAgent, boolean successful, String errorMessage)
Record a login attempt (successful or failed)

### recordLogout

@Transactional public void recordLogout(Long userId)
Record a user logout

### getUserLoginHistory

public List<UserLoginHistory> getUserLoginHistory(Long userId)
Get user login history

### getSuccessfulLogins

public List<UserLoginHistory> getSuccessfulLogins(Long userId)
Get successful login history

### getFailedLogins

public List<UserLoginHistory> getFailedLogins(Long userId)
Get failed login attempts

### getActiveSessions

public List<UserLoginHistory> getActiveSessions(Long userId)
Get active sessions (logins without logout)

### getLoginHistoryBetween

public List<UserLoginHistory> getLoginHistoryBetween(Long userId, LocalDateTime startDate, LocalDateTime endDate)
Get login history within a date range