1 7 package org.jboss.tutorial.security.bean; 8 9 import javax.annotation.security.RolesAllowed; 10 import javax.ejb.Stateless ; 11 import javax.ejb.TransactionAttribute ; 12 import javax.ejb.TransactionAttributeType ; 13 import javax.annotation.security.PermitAll; 14 import javax.annotation.security.RolesAllowed; 15 import javax.ejb.Remote ; 16 import org.jboss.annotation.security.SecurityDomain; 17 import org.jboss.annotation.security.SecurityDomain; 18 19 @Stateless 20 @SecurityDomain("other") 21 @Remote (Calculator.class) 22 public class CalculatorBean implements Calculator 23 { 24 @PermitAll 25 @TransactionAttribute (TransactionAttributeType.REQUIRES_NEW) 26 public int add(int x, int y) 27 { 28 return x + y; 29 } 30 31 @RolesAllowed({"student"}) 32 public int subtract(int x, int y) 33 { 34 return x - y; 35 } 36 37 @RolesAllowed({"teacher"}) 38 public int divide(int x, int y) 39 { 40 return x / y; 41 } 42 } 43 | Popular Tags |