Adding a little bit context to the previous question, as to why I am asking the question in post above.
What we have currently in our application that we are migrating from older security system to Elytron is something like follows:
* User is connected as user X, having role R1.
* At some point, we check whether this user, can have role R2 by authenticating as user X+.
* If successful, some set of actions are being executed under the elevated permissions (including EJB invocation, which needs security identity propagation)
* Throughout the code the expectation is that SecurityDomain.getCurrent().getCurrentSecurityIdentity() will return the elevated user X+.
* After the block of code that needed higher permissions is completed, return back to the regular user X, meaning that SecurityDomain.getCurrent().getCurrentSecurityIdentity() will return user X, and it will have only the role R1.