Diana,
Thanks for your reply.
My problem is that I can authenticate with a user and password, but at runtime, I want to change this authenticated principal to another principal and use this new principal at my SecurityContext.
My application receives a csv file, uses a default user to authenticate, but during the program flow I need to change the Principal by data provided at this csv file.
With picketbox I was able to do something like this:
SecurityContextAssociation.getSecurityContext().setOutgoingRunAs(runAsIdentity);
I need to know if it's possible to do with Elytron, I tried doing it:
SecurityDomain securityDomain = SecurityDomain.getCurrent();
MembershipPrincipal membership = new MembershipPrincipal("ANYUSER_ID");
SecurityIdentity si = securityDomain.getCurrentSecurityIdentity();
si.createRunAsIdentity(membership, true);
But this throw an unauthorized exception.
BR
Rodrigo