Package com.nicholasalfonso.lato.service
Class CurrentUserService
java.lang.Object
com.nicholasalfonso.lato.service.CurrentUserService
Helper component for retrieving the currently authenticated
User.-
Constructor Summary
ConstructorsConstructorDescriptionCurrentUserService(UserRepository userRepository) Creates the service with access to user persistence. -
Method Summary
Modifier and TypeMethodDescriptionReturns the user associated with the current security context.
-
Constructor Details
-
CurrentUserService
Creates the service with access to user persistence.- Parameters:
userRepository- repository used to load user records
-
-
Method Details
-
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
-