Class CurrentUserService

java.lang.Object
com.nicholasalfonso.lato.service.CurrentUserService

@Component public class CurrentUserService extends Object
Helper component for retrieving the currently authenticated User.
  • Constructor Details

    • CurrentUserService

      public CurrentUserService(UserRepository userRepository)
      Creates the service with access to user persistence.
      Parameters:
      userRepository - repository used to load user records
  • Method Details

    • getCurrentUser

      public User getCurrentUser()
      Returns the user associated with the current security context.
      Returns:
      the authenticated user entity
      Throws:
      IllegalStateException - if no authenticated user is present or the user is not found