6 Replies Latest reply on Nov 30, 2017 5:05 AM by Irfan Ali Dogar

    Call from MDB to SSB is always anonymous

    Qu Vad Newbie

      Hello! I ask for your help or advice.

       

      Got problem with JBoss AS7 / EAP6. In MDB, when I lookup for SSB and call its method, the call is always anonymous, i.e. in SSB sessionContext.getCallerPrincipal() returns Principal(anonymous). Always... In AS5 everything was fine.

       

      How can I fix it to make a call with an authenticated user?

       

      My MDB:

       

      @MessageDriven(activationConfig = {

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/piQueue"),

              @ActivationConfigProperty(propertyName = "dLQMaxResent", propertyValue = "3")

      })

      @SecurityDomain("mySecurityDomain")

      public class PIMessageBean implements MessageListener {

      ...

          //subject always anonymous...

          Subject subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");

       

          PIManager pim = lookupPIManager();

          pim.getPIs(); //call is anonymous

      ...

      }

       

      My queue settings:

       

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

          <hornetq-server>

          ...

              <jms-destinations>

                  <jms-queue name="piQueue">

                      <entry name="queue/piQueue"/>

                      <entry name="java:jboss/exported/jms/queue/piQueue"/>

                  </jms-queue>

              </jms-destinations>

              <security-domain>mySecurityDomain</security-domain>

          </hornetq-server>

      </subsystem>

       

      My Security Domain:

       

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

          <authentication>

              <login-module code="com.qu.vad.CustomUsernamePasswordLoginModule" flag="required">

              </login-module>

          </authentication>

      </security-domain>