Package edu.ucsb.cs156.example.services
Class CurrentUserService
java.lang.Object
edu.ucsb.cs156.example.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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract CurrentUserThis 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.This method returns the roles of the current user as a sorted list of strings.abstract UsergetUser()This method returns the current user as a User object.final booleanThis method returns whether the current user is logged in.
- 
Constructor Details- 
CurrentUserServicepublic CurrentUserService()
 
- 
- 
Method Details- 
getUserThis method returns the current user as a User object.- Returns:
- the current user
 
- 
getCurrentUserThis method returns the current user as a CurrentUser object- Returns:
- the current user
 
- 
getRolesThis method returns the roles of the current user.- Returns:
- a collection of roles
 
- 
isLoggedInpublic final boolean isLoggedIn()This method returns whether the current user is logged in.- Returns:
- whether the current user is logged in
 
- 
getRolesSortedThis method returns the roles of the current user as a sorted list of strings.- Returns:
- a collection of roles
 
 
-