Package com.jangular.backend.service
Class UserService
java.lang.Object
com.jangular.backend.service.UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRoleToUser(Long userId, RoleName roleName) Add role to uservoidchangePassword(Long userId, String newPassword) Change user passwordcreateUser(User user) Creates a new user with encoded password and default USER rolebooleanexistsByEmail(String email) Check if email already existsbooleanexistsByUsername(String username) Check if username already existsGet all active usersfindByEmail(String email) Find user by emailFind user by IDfindByUsername(String username) Find user by usernameGet default role (ROLE_USER)voidincrementFailedAttempts(String username) Increment failed attemptsvoidLock user account after max failed attemptsremoveRoleFromUser(Long userId, RoleName roleName) Remove role from uservoidresetFailedAttempts(String username) Reset failed attemptsvoidsoftDeleteUser(Long userId) Soft delete a uservoidunlockUser(String username) Unlock user accountupdateUser(User user) Updates a user's information
-
Constructor Details
-
UserService
public UserService()
-
-
Method Details
-
createUser
Creates a new user with encoded password and default USER role -
findByUsername
Find user by username -
findByEmail
Find user by email -
findById
Find user by ID -
findAllActiveUsers
Get all active users -
getDefaultRole
Get default role (ROLE_USER) -
updateUser
Updates a user's information -
softDeleteUser
Soft delete a user -
changePassword
Change user password -
existsByUsername
Check if username already exists -
existsByEmail
Check if email already exists -
addRoleToUser
Add role to user -
removeRoleFromUser
Remove role from user -
lockUser
Lock user account after max failed attempts -
unlockUser
Unlock user account -
incrementFailedAttempts
Increment failed attempts -
resetFailedAttempts
Reset failed attempts
-