Class RunAsRunner

java.lang.Object
com.evolveum.midpoint.model.impl.security.RunAsRunner

@Experimental public class RunAsRunner extends Object
Takes care of optimized "run as" operations. By optimization we mean that if the currently logged-in user is the same as the one specified in runAs, no login procedure is carried out. BEWARE: In order to return the original security context, the close() method must be called. This object is therefore to be used in try-with-resources context ONLY. TODO: Rework this class. The original idea was that we can execute a set of actions, each possibly under different identity and/or "run privileged" flag, and this class would minimize the number of required logins. This worked well before the introduction "run privileged" flag. But after it was added, the switching of contexts became non-trivial. Hence, we now establish the identity for each request separately, optimizing only "runAs" operation against currently logged-in user. We'll optimize this later.