1 Reply Latest reply on Jul 29, 2011 3:15 AM by beckers

    Execute as different person

    beckers Newbie

      Hi,

       

      I'm porting an application from jboss 6.0.0 to 7.0.0 and have another problem.

      I start a quartz scheduler (in the web container) and schedule a job. The jobs is executes with the principal/subject of the user who initialized the scheduler. In jboss 6 I used the WebAuthentication to change to the user I wanted the jobs to run as.

      This class I can''t find anymore.

      I tried another way to change the users identity. LoginContext.login() and then Subject.doAs, but the changed identity is not propagated to the ejb container, as getCallerPrincipal still gets the "old" principal.

      I also tried the @RunAs annotation. The principal didn't change.

      How can I run a method of a stateless session bean as a different user?

       

      Yours,

      Andreas

        • 1. Re: Execute as different person
          beckers Newbie

          The problem was, that security was turned of because the security domain defined in jboss.xml is not yet supported.

          So @RunAs works. But @RunAsPrincipal doesn't seem to work or I might use it incorrectly.

          @RunAsPrincipal doesn't change anything, that might be as specified.

          @RunAs and @RunAsPrincipal together changes the Role but not the principal name, I keep getting "run-as-principal".

           

          Yours,

          Andreas