Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-14189

The RunAs annotation doesn't work in EJBs with Elytron

XMLWordPrintable

    • Hide

       

      package org.visiontech.test;
      
      public interface TestInterface {
          
          public void test();
          
      }
      

       

       

      package org.visiontech.test;
      import javax.annotation.security.RolesAllowed;
      import javax.ejb.Stateless;
      
      @Stateless
      public class Test2 implements TestInterface {
          @Override
          @RolesAllowed("TEST")
          public void test() {
              System.out.println("IT WORKS!");
          }
          
      }

       

       

      package org.visiontech.test;
      import javax.annotation.PostConstruct;
      import javax.annotation.security.RunAs;
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      import javax.inject.Inject;
      
      @Singleton
      @Startup
      @RunAs("TEST")
      public class Test1 {
          
          @Inject
          private TestInterface test;
          
          @PostConstruct
          protected void test() {
              test.test();
          }
          
      }

       

       

      Show
        package org.visiontech.test; public interface TestInterface { public void test(); }     package org.visiontech.test; import javax.annotation.security.RolesAllowed; import javax.ejb.Stateless; @Stateless public class Test2 implements TestInterface { @Override @RolesAllowed( "TEST" ) public void test() { System .out.println( "IT WORKS!" ); } }     package org.visiontech.test; import javax.annotation.PostConstruct; import javax.annotation.security.RunAs; import javax.ejb.Singleton; import javax.ejb.Startup; import javax.inject.Inject; @Singleton @Startup @RunAs( "TEST" ) public class Test1 { @Inject private TestInterface test; @PostConstruct protected void test() { test.test(); } }    
    • Undefined
    • ---
    • ---

      Role is not correctly assigned when using @RunAs annotation and Elytron Security Domain. Everything works correctly with legacy picketbox Security Domain.

      Wildfly is configured to use default "other" application-security-domain, also using default security domain ApplicationDomain.

      This exception is rised when deploying the application.

      Caused by: javax.ejb.EJBAccessException: WFLYEJB0364: Invocation on method: public abstract void org.visiontech.test.TestInterface.test() of bean: Test2 is not allowedCaused by: javax.ejb.EJBAccessException: WFLYEJB0364: Invocation on method: public abstract void org.visiontech.test.TestInterface.test() of bean: Test2 is not allowed at org.jboss.as.ejb3@21.0.0.Final//org.jboss.as.ejb3.security.JaccInterceptor.hasPermission(JaccInterceptor.java:120)

      Test/Sample project: test.zip

        1. standalone-full-ha.new.xml
          44 kB
          Alessandro Moscatelli

              dvilkola@redhat.com Diana Krepinska (Inactive)
              alessandro.moscatelli@live.com Alessandro Moscatelli (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: