2 Replies Latest reply on Feb 20, 2018 12:01 PM by Jonathan Trafford

    Elytron and EAP 7.1.0 Programattic login

    Jonathan Trafford Newbie

      Hello,

       

      I have an EJB which is invoked using the TimerService, and from within the @Timeout method I need to perform a login and run as a particular user.

       

      Previously I was able to use the following code with the picket box and jaas implementation of EAP 7.0

       

      LoginContext context = new LoginContext("myRealm", new UsernamePasswordHandler("admin", "admin123");

      context.login();

      Subject subject = context.getSubject();

      Subject.doAs(subject, (PrivilegedAction<Void>)() -> {

           invokeScheduledMethodHere();

           return null;

      });

      context.logout();

       

      How would I do this using the new Elytron Systems?

       

      thanks,

      Jonny