1 22 package org.jboss.etutorial.security.bean; 23 24 import javax.annotation.security.RolesAllowed; 25 import javax.ejb.Stateless ; 26 import javax.ejb.TransactionAttribute ; 27 import javax.ejb.TransactionAttributeType ; 28 import javax.annotation.security.PermitAll; 29 import javax.annotation.security.RolesAllowed; 30 import javax.ejb.Remote ; 31 import org.jboss.annotation.security.SecurityDomain; 32 import org.jboss.annotation.security.SecurityDomain; 33 34 @Stateless 35 @SecurityDomain("other") 36 public class CalculatorBean implements Calculator 37 { 38 @PermitAll 39 @TransactionAttribute (TransactionAttributeType.REQUIRES_NEW) 40 public int add(int x, int y) 41 { 42 return x + y; 43 } 44 45 @RolesAllowed({"student"}) 46 public int subtract(int x, int y) 47 { 48 return x - y; 49 } 50 51 @RolesAllowed({"teacher"}) 52 public int divide(int x, int y) 53 { 54 return x / y; 55 } 56 } 57 | Popular Tags |