0 Replies Latest reply on Oct 10, 2013 5:12 AM by Avi Cohen

    Method permission doesn't work when calling from MDB

    Avi Cohen Newbie



      I have an issue that method permission (specified in ejb-jar.xml) work anyehere in the code except when calling those beans from MDB class.


      I'm using jboss-as-7.1.1.Final


              <subsystem xmlns="urn:jboss:domain:messaging:1.1">








      <!-- auth roles are fetched from the data base -->

      <security-domain name="exgl" cache-type="default">


                              <login-module code="DatabaseUsers" flag="required">

                                  <module-option name="dsJndiName" value="java:jboss/datasources/EXGLDS"/>

                                  <module-option name="principalsQuery" value="SELECT szpassword FROM x_user WHERE szlogin=?"/>

                                  <module-option name="rolesQuery" value="SELECT ar.szrole, 'Roles' FROM x_user_role ur INNER JOIN x_auth_role ar ON ar.ulid = ur.ulroleid INNER JOIN x_user u ON u.ulid = ur.uluserid WHERE szlogin=?"/>

                                  <module-option name="hashAlgorithm" value="SHA-256"/>

                                  <module-option name="hashEncoding" value="base64"/>








      (I'm using login that has all the permissions)




              activationConfig = {


                              propertyName = "destinationType", propertyValue = "javax.jms.Queue"),


                              propertyName = "destination", propertyValue = "queue/OLAppQueue") })



      public class QueueListenerMDB implements MessageListener {



          public OrderLineDeleteBean deleteBean;



          public void onMessage(final Message message) {

              try {


                     final LoginContext loginContext = new LoginContext("exgl", new PassiveCallbackHandler("ASA", "Abcd1234"));


                     Subject.doAs(loginContext.getSubject(), new PrivilegedAction<Boolean>() {


                          public Boolean run() {

                              try {




              name = "OrderLineDeleteBean")




      public class OrderLineDeleteBean extends OrderLineBaseBean {


      public void testAccess() {





      I tried calling this bean from anywhere else and the permissions work (authorized roles pass and unauthorized roles fail).


      Can anyone tell why this doesn't work the same when calling from MDB? or am I missing something else here?


      Thanks a lot