1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.security; 26 27 import static org.testng.Assert.fail; 28 29 import javax.annotation.security.RunAs; 30 import javax.ejb.EJB ; 31 import javax.ejb.EJBAccessException ; 32 import javax.ejb.Remote ; 33 import javax.ejb.Stateless ; 34 35 import org.objectweb.easybeans.log.JLog; 36 import org.objectweb.easybeans.log.JLogFactory; 37 38 43 @RunAs("secondaryrole") 44 @Stateless 45 @Remote 46 public class SLSBSecurityInheritanceTester01 implements ItfSecurityInheritanceTester { 47 48 51 private static JLog logger = JLogFactory.getLog(SLSBSecurityInheritanceTester01.class); 52 53 56 @EJB 57 private ItfSecurityInheritance bean; 58 59 63 public void callMethodDenyAll() { 64 try { 65 bean.dummyMethod1(); 66 fail("The method has a denyAll annotation, so the bean cannot call this method."); 67 } catch (EJBAccessException e) { 68 logger.debug("The bean threw an expected exception {0}", e); 69 } 70 } 71 72 76 public void callMethodMainRole() { 77 try { 78 bean.dummyMethod2(); 79 fail("The method has a rolesAllowed annotation that does not " 80 + "include the secondaryrole, so the bean cannot call this method."); 81 } catch (EJBAccessException e) { 82 logger.debug("The bean threw an expected exception {0}", e); 83 } 84 } 85 86 89 public void callMethodPermitAll() { 90 bean.dummyMethod3(); 91 } 92 } 93 | Popular Tags |