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

The RunAs annotation doesn't work in EJBs with Elytron

    XMLWordPrintable

Details

    • 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(); } }    
    • ---
    • ---

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: