6 Replies Latest reply on Jun 3, 2008 1:31 PM by Kabir Khan

    Security aspects failing in AS trunk

    Kabir Khan Master

      When running the org.jboss.test.aop.test.SecurityUnitTestCase testcase in AS trunk I get the following error:

       <testcase classname="org.jboss.test.aop.test.SecurityUnitTestCase" name="testAnnotated" time="0.984">
       <error type="javax.management.RuntimeMBeanException">javax.management.RuntimeMBeanException
       at org.jboss.mx.interceptor.ReflectedDispatcher.handleInvocationExceptions(ReflectedDispatcher.java:180)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:165)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:270)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
       at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:815)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:416)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
       at sun.rmi.transport.Transport$1.run(Transport.java:153)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: org.jboss.security.SubjectInfo.getAuthenticationPrincipal()Ljava/security/Principal;
       at org.jboss.test.aop.bean.SecurityTester.org$jboss$test$aop$bean$SecurityTester$testAnnotated$aop(SecurityTester.java:380)
       at org.jboss.test.aop.bean.SecurityTester$SecurityTesterAdvisor.testAnnotated6887871432162944908(SecurityTester$SecurityTesterAdvisor.java)
       at org.jboss.test.aop.bean.SecurityTester.testAnnotated(SecurityTester.java)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       ... 41 more
      Caused by: java.lang.NoSuchMethodError: org.jboss.security.SubjectInfo.getAuthenticationPrincipal()Ljava/security/Principal;
       at org.jboss.security.plugins.JBossSecurityContextUtil.getUserPrincipal(JBossSecurityContextUtil.java:81)
       at org.jboss.security.SecurityAssociation.getPrincipal(SecurityAssociation.java:200)
       at org.jboss.aspects.security.SecurityActions$PrincipalInfoAction$2.getPrincipal(SecurityActions.java:163)
       at org.jboss.aspects.security.SecurityActions.getPrincipal(SecurityActions.java:362)
       at org.jboss.aspects.security.AuthenticationInterceptor.authenticate(AuthenticationInterceptor.java:108)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:66)
       at org.jboss.test.aop.bean.JoinPoint_constructor_AnnotatedSecuredPOJO_0_291$aop.invokeNext(JoinPoint_constructor_AnnotatedSecuredPOJO_0_291$aop.java)
       at org.jboss.test.aop.bean.JoinPoint_constructor_AnnotatedSecuredPOJO_0_291$aop.invokeJoinpoint(JoinPoint_constructor_AnnotatedSecuredPOJO_0_291$aop.java)
       at org.jboss.test.aop.bean.AnnotatedSecuredPOJO$AnnotatedSecuredPOJOAdvisor.AnnotatedSecuredPOJOAdvisor_new_$aop(AnnotatedSecuredPOJO$AnnotatedSecuredPOJOAdvisor.java)
       at org.jboss.test.aop.bean.AnnotatedSecuredPOJO.AnnotatedSecuredPOJO_new_$aop(AnnotatedSecuredPOJO.java)
       at org.jboss.test.aop.bean.SecurityTester.org$jboss$test$aop$bean$SecurityTester$testAnnotated$aop(SecurityTester.java:240)
       ... 48 more
      </error>
      


        • 1. Re: Security aspects failing in AS trunk
          Kabir Khan Master

          I'm trying again having got rid of all snapshots from thirdparty

          • 2. Re: Security aspects failing in AS trunk
            Kabir Khan Master

            Cleaning out 3rdparty fixes that problem. I am still seeing some failures, but will see if I can figure out what is going on

            • 3. Re: Security aspects failing in AS trunk
              Anil Saldanha Master

              Sorry that you had to clean your thirdparty, Kabir. :( You should be doing that anyway each time there is an update shown on build-thirdparty.xml

              • 4. Re: Security aspects failing in AS trunk
                Ståle Pedersen Newbie

                hi (im following up kabirs tests a bit), i tested org.jboss.test.aop.test.SecurityUnitTestCase from head now and it fails with this stacktrace:

                23:21:01,972 INFO [SecurityTester] TESTING XML Security
                23:21:01,973 INFO [SecurityTester] testing unchecked constructor
                23:21:02,441 INFO [SecurityTester] testing unchecked method
                23:21:02,507 ERROR [SecurityTester] failed
                java.lang.SecurityException: Password Incorrect/Password Required
                 at org.jboss.aspects.security.AuthenticationInterceptor.handleGeneralSecurityException(AuthenticationInterceptor.java:55)
                 at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:70)
                 at org.jboss.test.aop.bean.JoinPoint_unchecked_N_2712120300325346458_70$aop.invokeNext(JoinPoint_unchecked_N_2712120300325346458_70$aop.java)
                 at org.jboss.test.aop.bean.JoinPoint_unchecked_N_2712120300325346458_70$aop.invokeJoinpoint(JoinPoint_unchecked_N_2712120300325346458_70$aop.java)
                 at org.jboss.test.aop.bean.SecuredPOJO$SecuredPOJOAdvisor.unchecked_N_2712120300325346458(SecuredPOJO$SecuredPOJOAdvisor.java)
                 at org.jboss.test.aop.bean.SecuredPOJO$SecuredPOJOInstanceAdvisor.unchecked_N_2712120300325346458(SecuredPOJO$SecuredPOJOInstanceAdvisor.java)
                 at org.jboss.test.aop.bean.SecuredPOJO.unchecked(SecuredPOJO.java)
                 at org.jboss.test.aop.bean.SecurityTester.org$jboss$test$aop$bean$SecurityTester$testXml$aop(SecurityTester.java:90)
                 at org.jboss.test.aop.bean.SecurityTester$SecurityTesterAdvisor.testXml7807095709035618991(SecurityTester$SecurityTesterAdvisor.java)
                 at org.jboss.test.aop.bean.SecurityTester.testXml(SecurityTester.java)
                 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:585)
                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 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:585)
                 at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:270)
                 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:585)
                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
                 at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
                 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:585)
                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
                 at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:815)
                 at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:416)
                 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:585)
                 at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
                 at sun.rmi.transport.Transport$1.run(Transport.java:153)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
                 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
                 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
                 at java.lang.Thread.run(Thread.java:595)

                the similar stacktrace happens for the annotated test.
                what we first try to do here is to create an object (constructor is marked as unchecked) and then call a method and a field that both are marked as unchecked. it creates the object without any errors, but the method fails.
                if there is anything we need to change in our test / setup please let me know :)

                • 5. Re: Security aspects failing in AS trunk
                  Anil Saldanha Master

                  Remind me where the latest aspects/security is?

                  • 6. Re: Security aspects failing in AS trunk
                    Kabir Khan Master

                    They have been moved to the standalone aspects module:
                    https://svn.jboss.org/repos/jbossas/projects/jboss-aspects/trunk/security/src/main/java/org/jboss/aspects/security/

                    To run the test do the following in AS trunk testsuite/:

                    $ ./build.sh one-test -Dtest=org.jboss.test.aop.test.SecurityUnitTestCase
                    


                    (I edited the post to get the correct command)