1 Reply Latest reply on Apr 10, 2009 1:15 AM by kesi.wei

    How to get Instance of JBoss Security Subject Factory?

    michaelfgh

      Hi, all,

      my work environment, JBoss5.0.0GA+MySQL, now I use datasource encryption.

      my application-policy as follow:

      <application-policy name="fgdb-password-encrypted">
       ....
      
       </application-policy>


      I define a mbean as follows:

      <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
      ...>
       ...
       <attribute name="JndiName">...</attribute>
       <attribute name="SecurityDomainJndiName">fgdb-password-encrypted</attribute>
       ....
       </mbean>
      


      Now I can't connection database, I find the cause is that it can't get Instance of JBoss Security Subject Factory.

      and I find a xml file security-jboss-beans.xml, it has some sentence.
      <!-- Instance of JBoss Security Subject Factory -->
       <bean name="JBossSecuritySubjectFactory"
       class="org.jboss.security.integration.JBossSecuritySubjectFactory">
       <property name="securityManagement"><inject bean="JNDIBasedSecurityManagement" /></property>
       </bean>


      but I don't know how to get this instance.
      so I modify a class BaseConnectionManager2 in this jar jboss-jca.jar
      I add as follows sentence,
      subjectFactory = new JBossSecuritySubjectFactory();
       ((JBossSecuritySubjectFactory) subjectFactory).setSecurityManagement(new JNDIBasedSecurityManagement());


      now my problem disappears, I think mondify JBoss class is not a good way,
      Can someone give me some hints?
      any help can be appreciated.