Package com.vaadin.cdi.access
Class JaasAccessControl
java.lang.Object
com.vaadin.cdi.access.AccessControl
com.vaadin.cdi.access.JaasAccessControl
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.servlet.http.HttpServletRequestReturns the principal (user) name of the currently logged in user.booleanisUserInRole(String role) Checks if the current user has a role.booleanReturns true if some used has logged in.static voidLogs in the user to underlying container security context using configured security domain in deployment descriptorstatic voidlogout()Logs user out from current container managed security contextMethods inherited from class com.vaadin.cdi.access.AccessControl
isUserInSomeRole
-
Constructor Details
-
JaasAccessControl
public JaasAccessControl()
-
-
Method Details
-
isUserSignedIn
public boolean isUserSignedIn()Description copied from class:AccessControlReturns true if some used has logged in.- Specified by:
isUserSignedInin classAccessControl- Returns:
- true if a user is logged in
-
isUserInRole
Description copied from class:AccessControlChecks if the current user has a role.- Specified by:
isUserInRolein classAccessControl- Parameters:
role-- Returns:
- true if currently logged in user is in given role
-
getPrincipalName
Description copied from class:AccessControlReturns the principal (user) name of the currently logged in user.- Specified by:
getPrincipalNamein classAccessControl- Returns:
- name of the user that is currently logged in, if no user is logged in null will be returned.
-
login
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.ServletExceptionLogs user out from current container managed security context- Throws:
jakarta.servlet.ServletException
-
getCurrentRequest
@RequestScoped public static jakarta.servlet.http.HttpServletRequest getCurrentRequest()
-