Class CurrentUserService

java.lang.Object
edu.ucsb.cs156.example.services.CurrentUserService
Direct Known Subclasses:
CurrentUserServiceImpl

public abstract class CurrentUserService extends Object
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 Details

    • CurrentUserService

      public CurrentUserService()
  • Method Details

    • getUser

      public abstract User getUser()
      This method returns the current user as a User object.
      Returns:
      the current user
    • getCurrentUser

      public abstract CurrentUser getCurrentUser()
      This method returns the current user as a CurrentUser object
      Returns:
      the current user
    • getRoles

      public abstract Collection<? extends org.springframework.security.core.GrantedAuthority> 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