0 Replies Latest reply on Jan 3, 2004 4:40 AM by asinitsyn

    How to specify user name to run MDB and Session Bean under

    asinitsyn Newbie

      Hello,

      Please, advise how to specify user name MDB and Session Bean are executed with. My code needs to write to DB with what user name transaction was performed. I'm looking for solution of how to specify it in deployment descriptor. I tried

      <security-identity>
       <run-as>
       <role-name>someuser</role-name>
       </run-as>
       </security-identity>


      but it requires to specify role name, not user name. Hardcoding username and password in my code is not very flexible. Under weblogic I was able to specify some virtual role in run-as and after that map it to real user. Is there something similar in JBoss or I have to authenticate user in my code to change user code is executed with. If I cannot do it in deployment descriptor, then is using new InitialContext(env) with credentials supplied sufficient?

      Thanks in advance,
      Andrew