Class Authentications
java.lang.Object
org.camunda.bpm.webapp.impl.security.auth.Authentications
- All Implemented Interfaces:
Serializable
Wrapper around current authentications.
In Camunda Platform rest and web applications, authentications are managed per process engine: at a given point in time, there might be multiple authentications active for different users and process engines in a single session. The situation is that a "physical" user may possess credentials for different process engines, each of these representing a different process engine user. For each process engine, there can be at most one authentication active in a given session.
In addition, the AuthenticationFilter
binds an instance of this
class to a thread local and may be obtained by getCurrent()
- Author:
- Daniel Meyer
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
UserAuthentication> holds an entry for each processEngine->userId pair currently authenticated -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addOrReplace
(UserAuthentication authentication) Adds an authentication to the list of current authentications.static void
clears theAuthentications
for the current thread.getAuthenticationForProcessEngine
(String engineName) Returns anAuthentication
for a provided process engine name or "null".static Authentications
Returns the authentications for the current thread.boolean
hasAuthenticationForProcessEngine
(String engineName) Allows checking whether a user is currently authenticated for a given process engine name.removeByEngineName
(String engineName) Removes the authentication for the provided process engine name.static void
setCurrent
(Authentications auth) sets theAuthentications
for the current thread in a thread local.
-
Field Details
-
authentications
holds an entry for each processEngine->userId pair currently authenticated
-
-
Constructor Details
-
Authentications
public Authentications()
-
-
Method Details
-
getAuthenticationForProcessEngine
Returns anAuthentication
for a provided process engine name or "null".- Parameters:
engineName
- the name of the process engine for which the userId should be retrieved.- Returns:
Authentication
for the provided process engine or "null" if no user is authenticated for this process engine.
-
addOrReplace
Adds an authentication to the list of current authentications. If there already exists an authentication of the same process engine, it is replaced silently.- Parameters:
authentication
- the authentication to add
-
removeByEngineName
Removes the authentication for the provided process engine name.- Parameters:
engineName
- the name of the process engine for which the authentication should be removed.- Returns:
- the removed user authentication
-
getAuthentications
- Returns:
- all active
Authentications
.
-
hasAuthenticationForProcessEngine
Allows checking whether a user is currently authenticated for a given process engine name.- Parameters:
engineName
- the name of the process engine for which we want to check for authentication.- Returns:
- true if a user is authenticated for the provided process engine name.
-
setCurrent
sets theAuthentications
for the current thread in a thread local.- Parameters:
auth
- theAuthentications
to set.
-
clearCurrent
public static void clearCurrent()clears theAuthentications
for the current thread. -
getCurrent
Returns the authentications for the current thread.- Returns:
- the authentications.
-