Package edu.ucsb.cs156.dining.services
Class CurrentUserService
java.lang.Object
edu.ucsb.cs156.dining.services.CurrentUserService
- Direct Known Subclasses:
CurrentUserServiceImpl
This is a service that provides information about the current user.
It is an abstract class because we have different implementations for testing and production.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract CurrentUser
This method returns the current user as a CurrentUser objectabstract Collection
<? extends org.springframework.security.core.GrantedAuthority> getRoles()
This method returns the roles of the current user.abstract User
getUser()
This method returns the current user as a User object.final boolean
This method returns whether the current user is logged in.
-
Constructor Details
-
CurrentUserService
public CurrentUserService()
-
-
Method Details
-
getUser
This method returns the current user as a User object.- Returns:
- the current user
-
getCurrentUser
This method returns the current user as a CurrentUser object- Returns:
- the current user
-
getRoles
This method returns the roles of the current user.- Returns:
- a collection of roles
-
isLoggedIn
public final boolean isLoggedIn()This method returns whether the current user is logged in.- Returns:
- whether the current user is logged in
-