1 Reply Latest reply on Dec 27, 2002 5:50 AM by Ami Bender

    Implementing/configuring a bespoke SecurityProxy

    Ami Bender Newbie

      Hi

      I am attempting to add bespoke method level security to a working session EJB by implementing the Security Proxy architecture. The solution does not require the use of JBossSX References, identity, roles or EJB method permissions.

      Unfortunately I cant seem to get the Proxy to instantiate.
      Any advice will be appreciated.

      Problem:
      [ObjectName: jboss.j2ee:service=EjbModule,url=file%/usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/reur.jar
      state: FAILED
      I Depend On:
      Depends On Me: org.jboss.deployment.DeploymentException: Failed to create SecurityProxy of type: reur.PatternValidatorProxy,
      org.jboss.proxy.ejb.ProxyFactory; - nested throwable: (java.lang.InstantiationException: reur.PatternValidatorProxy)]

      (full output at bottom)

      Code/Conf files:

      EJB-JAR

      <!--removed a container bean for ease of reading-->
      <ejb-jar >

      No Description.
      <display-name>Generated by XDoclet</display-name>

      <enterprise-beans>

      <!-- Session Beans -->

      <![CDATA[An EJB based Reg Expression matcher]]>
      <display-name>Matches a RegularExpression against a pattern</display-name>

      <ejb-name>PatternValidator</ejb-name>

      reur.PatternValidatorHome
      reur.PatternValidator
      <ejb-class>reur.PatternValidatorBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      </enterprise-beans>

      </assembly-descriptor>

      </ejb-jar>

      *******************************************************************
      JBOSS.xml



      <security-domain>java:/jaas/other</security-domain>
      <enterprise-beans>


      <ejb-name>UsedPattern</ejb-name>
      <jndi-name>ejb/reur/UsedPattern</jndi-name>



      <ejb-name>PatternValidator</ejb-name>
      <jndi-name>ejb/reur/PatternValidator</jndi-name>
      <security-proxy>reur.PatternValidatorProxy</security-proxy>


      </enterprise-beans>


      *************************************************************************************

      in jboss-service.xml in ..../jboss-3.0.4_tomcat-4.1.12/server/default/conf

      <!-- ==================================================================== -->
      <!-- Security -->
      <!-- ==================================================================== -->


      jboss.security:service=XMLLoginConfig


      login-config.xml


      <!-- JAAS security manager and realm mapping -->


      org.jboss.security.plugins.JaasSecurityManager
      reur.PatternValidatorProxy


      ********************************************************************************************

      public class PatternValidatorProxy implements SecurityProxy
      {
      Category log = Category.getInstance(PatternValidatorProxy.class);
      Method echo;

      protected Object delegate;

      public PatternValidatorProxy(Object o){
      System.out.println("(PatternValidatorProxy) In PatternValidatorProxy constructor(Object) ");
      delegate = o;
      }

      .....
      }


      public class PatternValidatorProxyFactory implements SecurityProxyFactory, Serializable {
      public org.jboss.security.SecurityProxy create(Object proxyDelegate){
      PatternValidatorProxy proxy = new PatternValidatorProxy(proxyDelegate);
      return proxy;
      }
      }




      2002-12-23 16:44:45,654 WARN [org.jboss.system.ServiceController] Problem creating service jboss.j2ee:service=EjbModule
      ,url=file%/usr/local/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/reur.jar
      org.jboss.deployment.DeploymentException: Failed to create SecurityProxy of type: reur.PatternValidatorProxy, org.jboss.
      proxy.ejb.ProxyFactory; - nested throwable: (java.lang.InstantiationException: reur.PatternValidatorProxy)
      at org.jboss.ejb.EjbModule.initializeContainer(EjbModule.java:769)
      at org.jboss.ejb.EjbModule.createStatelessSessionContainer(EjbModule.java:583)
      at org.jboss.ejb.EjbModule.createContainer(EjbModule.java:538)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:363)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy5.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:315)
      at org.jboss.system.ServiceController.create(ServiceController.java:243)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy9.create(Unknown Source)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:377)
      at org.jboss.deployment.MainDeployer.create(MainDeployer.java:760)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:620)