Class AuthenticationUtil
- java.lang.Object
- 
- org.camunda.bpm.webapp.impl.security.auth.AuthenticationUtil
 
- 
 public class AuthenticationUtil extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringAPP_WELCOMEstatic String[]APPSprotected static StringCAM_AUTH_SESSION_KEYprotected static WebappLoggerLOGGER
 - 
Constructor SummaryConstructors Constructor Description AuthenticationUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static 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(javax.servlet.http.HttpSession session)Allows obtaining anAuthenticationsobject from theHttpSession.static List<String>getGroupsOfUser(ProcessEngine engine, String userId)protected static ObjectgetSessionMutex(javax.servlet.http.HttpSession session)Returns the session mutex to synchronize on.static List<String>getTenantsOfUser(ProcessEngine engine, String userId)protected static booleanisAuthorizedForApp(AuthorizationService authorizationService, String username, List<String> groupIds, String application)static voidrevalidateSession(javax.servlet.http.HttpServletRequest request, UserAuthentication authentication)Invalidates the oldHttpSessionof the current request and creates a new one.static voidupdateCache(Authentications authentications, javax.servlet.http.HttpSession session, long cacheTimeToLive)Update/remove authentications when cache validation time (= x + TTL) is due.static voidupdateSession(javax.servlet.http.HttpSession session, Authentications authentications)Store authentications in current session.
 
- 
- 
- 
Field Detail- 
LOGGERprotected static final WebappLogger LOGGER 
 - 
CAM_AUTH_SESSION_KEYprotected static final String CAM_AUTH_SESSION_KEY - See Also:
- Constant Field Values
 
 - 
APPSpublic static final String[] APPS 
 - 
APP_WELCOMEpublic static final String APP_WELCOME - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
createAuthenticationpublic static UserAuthentication createAuthentication(String engineName, String username) 
 - 
createAuthenticationpublic static UserAuthentication createAuthentication(ProcessEngine processEngine, String username) 
 - 
createAuthenticationpublic static UserAuthentication createAuthentication(String engineName, String username, List<String> groupIds, List<String> tenantIds) 
 - 
createAuthenticationpublic static UserAuthentication createAuthentication(ProcessEngine processEngine, String username, List<String> groupIds, List<String> tenantIds) Creates and returns a UserAuthenticationwith the following information:- userId
- processEngineName
- groupIds
- tenantIds
- authorizedApps
 
 - 
getTenantsOfUserpublic static List<String> getTenantsOfUser(ProcessEngine engine, String userId) 
 - 
getGroupsOfUserpublic static List<String> getGroupsOfUser(ProcessEngine engine, String userId) 
 - 
isAuthorizedForAppprotected static boolean isAuthorizedForApp(AuthorizationService authorizationService, String username, List<String> groupIds, String application) 
 - 
getAuthsFromSessionpublic static Authentications getAuthsFromSession(javax.servlet.http.HttpSession session) Allows obtaining anAuthenticationsobject from theHttpSession. If no such object exists in the session, a new instance is created and returned.- Parameters:
- session- the- HttpSessioninstance from which to retrieve the- Authentications.
 
 - 
revalidateSessionpublic static void revalidateSession(javax.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- the- HttpServletRequestinstance from which the session is obtained and a new- HttpSessioncreated.
- authentication- the new- Authenticationinstance that is created through user login. It is added to the existing authentications.
 
 - 
updateSessionpublic static void updateSession(javax.servlet.http.HttpSession session, Authentications authentications)Store authentications in current session.
 - 
updateCachepublic static void updateCache(Authentications authentications, javax.servlet.http.HttpSession session, long cacheTimeToLive) Update/remove authentications when cache validation time (= x + TTL) is due. The following information is updated: - groupIds
- tenantIds
- authorizedApps- An authorization is only removed if the user doesn't exist anymore (user was deleted). 
 
 - 
getSessionMutexprotected static Object getSessionMutex(javax.servlet.http.HttpSession session) Returns the session mutex to synchronize on. Avoids updating the auth cache by multiple HTTP requests in parallel. 
 
- 
 
-