Class AuthenticationUtil
java.lang.Object
org.camunda.bpm.webapp.impl.security.auth.AuthenticationUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final String[]protected static final Stringprotected static final WebappLogger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UserAuthenticationcreateAuthentication(String engineName, String username) static UserAuthenticationcreateAuthentication(String engineName, String username, List<String> groupIds, List<String> tenantIds) static UserAuthenticationcreateAuthentication(ProcessEngine processEngine, String username) static UserAuthenticationcreateAuthentication(ProcessEngine processEngine, String username, List<String> groupIds, List<String> tenantIds) Creates and returns aUserAuthenticationwith the following information:userIdprocessEngineNamegroupIdstenantIdsauthorizedAppsstatic AuthenticationsgetAuthsFromSession(jakarta.servlet.http.HttpSession session) Allows obtaining anAuthenticationsobject from theHttpSession.getGroupsOfUser(ProcessEngine engine, String userId) protected static ObjectgetSessionMutex(jakarta.servlet.http.HttpSession session) Returns the session mutex to synchronize on.getTenantsOfUser(ProcessEngine engine, String userId) protected static booleanisAuthorizedForApp(AuthorizationService authorizationService, String username, List<String> groupIds, String application) static voidrevalidateSession(jakarta.servlet.http.HttpServletRequest request, UserAuthentication authentication) Invalidates the oldHttpSessionof the current request and creates a new one.static voidupdateCache(Authentications authentications, jakarta.servlet.http.HttpSession session, long cacheTimeToLive) Update/remove authentications when cache validation time (= x + TTL) is due.static voidupdateSession(jakarta.servlet.http.HttpSession session, Authentications authentications) Store authentications in current session.
-
Field Details
-
LOGGER
-
CAM_AUTH_SESSION_KEY
- See Also:
-
APPS
-
APP_WELCOME
- See Also:
-
-
Constructor Details
-
AuthenticationUtil
public AuthenticationUtil()
-
-
Method Details
-
createAuthentication
-
createAuthentication
-
createAuthentication
-
createAuthentication
public static UserAuthentication createAuthentication(ProcessEngine processEngine, String username, List<String> groupIds, List<String> tenantIds) Creates and returns a
UserAuthenticationwith the following information:userIdprocessEngineNamegroupIdstenantIdsauthorizedApps
-
getTenantsOfUser
-
getGroupsOfUser
-
isAuthorizedForApp
protected static boolean isAuthorizedForApp(AuthorizationService authorizationService, String username, List<String> groupIds, String application) -
getAuthsFromSession
Allows obtaining anAuthenticationsobject from theHttpSession. If no such object exists in the session, a new instance is created and returned.- Parameters:
session- theHttpSessioninstance from which to retrieve theAuthentications.
-
revalidateSession
public static void revalidateSession(jakarta.servlet.http.HttpServletRequest request, UserAuthentication authentication) Invalidates the oldHttpSessionof the current request and creates a new one. Additionally, transfers the existing authentications to the new session and adds a new one.- Parameters:
request- theHttpServletRequestinstance from which the session is obtained and a newHttpSessioncreated.authentication- the newAuthenticationinstance that is created through user login. It is added to the existing authentications.
-
updateSession
public static void updateSession(jakarta.servlet.http.HttpSession session, Authentications authentications) Store authentications in current session. -
updateCache
public static void updateCache(Authentications authentications, jakarta.servlet.http.HttpSession session, long cacheTimeToLive) Update/remove authentications when cache validation time (= x + TTL) is due.
The following information is updated:
groupIdstenantIdsauthorizedAppsAn authorization is only removed if the user doesn't exist anymore (user was deleted).
-
getSessionMutex
Returns the session mutex to synchronize on.
Avoids updating the auth cache by multiple HTTP requests in parallel.
-