Class AccessControl

java.lang.Object
com.vaadin.cdi.access.AccessControl
Direct Known Subclasses:
JaasAccessControl

public abstract class AccessControl extends Object
Access control base class. Various implementations can exist (default JAAS, others with Alternative) and the active implementation can be selected in beans.xml .
  • Constructor Details

    • AccessControl

      public AccessControl()
  • Method Details

    • isUserSignedIn

      public abstract boolean isUserSignedIn()
      Returns true if some used has logged in.
      Returns:
      true if a user is logged in
    • isUserInRole

      public abstract boolean isUserInRole(String role)
      Checks if the current user has a role.
      Parameters:
      role -
      Returns:
      true if currently logged in user is in given role
    • getPrincipalName

      public abstract String getPrincipalName()
      Returns the principal (user) name of the currently logged in user.
      Returns:
      name of the user that is currently logged in, if no user is logged in null will be returned.
    • isUserInSomeRole

      public boolean isUserInSomeRole(String... roles)
      Checks if the user has any of the given roles.
      Parameters:
      roles -
      Returns:
      true if currently logged in user is in some of given roles