2 Replies Latest reply on Jul 29, 2005 8:43 AM by Colin Daly

    custom security interceptor

    Colin Daly Newbie

      Hi,

      In order to test new role based restrictions on an existing application, I'd like to hack the security interceptor to just log security violations instead of throwing exceptions. Then would significantly reduce the time necessary to weed out problems.

      I wrote the custom interceptor and replaced all occurences of
      org.jboss.ejb.plugins.SecurityInterceptor
      with
      my.custom.SecurityInterceptor
      in standardjboss.xml

      i then created a small jar containing my custom interceptor, put it in $JBOSS_HOME/lib and added it to JBOSS_BOOT_CLASSPATH


      I guess i've got some classloading issue or my approach is wrong because when i try to start jboss i get the following exception on every bean deployment. I would really like to get this working without having to build jboss from source with a hacked security interceptor so any help would be greatly appreciated.

      Cheers,
      Colin.



      16:21:16,053 INFO [EjbModule] Deploying VoucherEJB
      16:21:16,062 WARN [EjbModule] Could not load the my.custom.SecurityInterceptor interceptor for this container
      java.lang.ClassNotFoundException: Unexpected error during load of: my.custom.SecurityInterceptor, msg=org/jboss/proxy/Interceptor
       at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:215)
       at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:132)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
       at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:78)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
       at org.jboss.ejb.EjbModule.addInterceptors(EjbModule.java:856)
       at org.jboss.ejb.EjbModule.initializeContainer(EjbModule.java:743)
       at org.jboss.ejb.EjbModule.createEntityContainer(EjbModule.java:597)
       at org.jboss.ejb.EjbModule.createContainer(EjbModule.java:511)
       at org.jboss.ejb.EjbModule.createService(EjbModule.java:316)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:237)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:219)
       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
       at $Proxy17.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:283)
       at org.jboss.system.ServiceController.create(ServiceController.java:216)
       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.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy14.create(Unknown Source)
       at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:549)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:782)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
       at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy7.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:304)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:478)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:837)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:367)
       at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:251)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:836)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:645)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:592)
       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.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:407)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:311)
       at org.jboss.Main.boot(Main.java:145)
       at org.jboss.Main$1.run(Main.java:399)
       at java.lang.Thread.run(Thread.java:534)
      
      
      






        • 1. Re: custom security interceptor
          Michael Konietzka Newbie

           

          "colin_daly" wrote:
          Hi,


          i then created a small jar containing my custom interceptor, put it in $JBOSS_HOME/lib and added it to JBOSS_BOOT_CLASSPATH


          I guess i've got some classloading issue or my approach is wrong because when i try to start jboss i get the following exception on every bean deployment. I would really like to get this working without having to build jboss from source with a hacked security interceptor so any help would be greatly appreciated.

          [..]



          Well, try to put you classes in another directory.
          For example, i have my own Interecptors in the same jar as my ejb and this is normally deployed. This works, if your ear is the only application,which uses this configuration.
          So my interceptor classes are here: $JBOSS_HOME/server/$YOUR_SERVER/deploy/

          My LoginModule and SecurityProxy are in $JBOSS_HOME/server/$YOUR_SERVER/lib/

          HTH
          Michael



          • 2. Re: custom security interceptor
            Colin Daly Newbie


            Thanks Michael,

            That worked a treat.
            I should have tried the easy option first i guest :)

            Colin.