Class JaasAccessControl

java.lang.Object
com.vaadin.cdi.access.AccessControl
com.vaadin.cdi.access.JaasAccessControl
All Implemented Interfaces:
Serializable

@Default public class JaasAccessControl extends AccessControl implements Serializable
JaasAccessControl is an AccessControl implementation that also provides set of JAAS helper methods to login and out the user as well as to query additional information. In order to use JaasAccessControl a proper security domain must be configured in the underlying application server.
See Also:
  • Constructor Details

    • JaasAccessControl

      public JaasAccessControl()
  • Method Details

    • isUserSignedIn

      public boolean isUserSignedIn()
      Description copied from class: AccessControl
      Returns true if some used has logged in.
      Specified by:
      isUserSignedIn in class AccessControl
      Returns:
      true if a user is logged in
    • isUserInRole

      public boolean isUserInRole(String role)
      Description copied from class: AccessControl
      Checks if the current user has a role.
      Specified by:
      isUserInRole in class AccessControl
      Parameters:
      role -
      Returns:
      true if currently logged in user is in given role
    • getPrincipalName

      public String getPrincipalName()
      Description copied from class: AccessControl
      Returns the principal (user) name of the currently logged in user.
      Specified by:
      getPrincipalName in class AccessControl
      Returns:
      name of the user that is currently logged in, if no user is logged in null will be returned.
    • login

      public static void login(String username, String password) throws jakarta.servlet.ServletException
      Logs in the user to underlying container security context using configured security domain in deployment descriptor
      Parameters:
      username -
      password -
      Throws:
      jakarta.servlet.ServletException - if login fails or current session has already been authenticated
    • logout

      public static void logout() throws jakarta.servlet.ServletException
      Logs user out from current container managed security context
      Throws:
      jakarta.servlet.ServletException
    • getCurrentRequest

      @RequestScoped public static jakarta.servlet.http.HttpServletRequest getCurrentRequest()