1 22 package org.jboss.test.security.ejb.jbas1852; 23 24 import java.security.Principal ; 25 import javax.ejb.CreateException ; 26 import javax.ejb.SessionBean ; 27 import javax.ejb.SessionContext ; 28 29 35 public class PrivateSessionBean implements SessionBean 36 { 37 private SessionContext sessionContext; 38 39 public void ejbCreate() throws CreateException 40 { 41 System.out.println("PrivateSessionBean.ejbCreate() called"); 42 } 43 44 public void ejbActivate() 45 { 46 System.out.println("PrivateSessionBean.ejbActivate() called"); 47 } 48 49 public void ejbPassivate() 50 { 51 System.out.println("PrivateSessionBean.ejbPassivate() called"); 52 } 53 54 public void ejbRemove() 55 { 56 System.out.println("PrivateSessionBean.ejbRemove() called"); 57 } 58 59 public void setSessionContext(SessionContext context) 60 { 61 sessionContext = context; 62 } 63 64 public String echo(String arg) 65 { 66 System.out.println("PrivateSessionBean.echo, arg="+arg); 67 Principal p = sessionContext.getCallerPrincipal(); 68 System.out.println("PrivateSessionBean.echo, callerPrincipal="+p); 69 System.out.println("PrivateSessionBean.echo, isCallerInRole('InternalUser')="+sessionContext.isCallerInRole("InternalUser")); 70 return arg; 71 } 72 public void noop() 73 { 74 System.out.println("PrivateSessionBean.noop"); 75 Principal p = sessionContext.getCallerPrincipal(); 76 System.out.println("PrivateSessionBean.noop, callerPrincipal="+p); 77 } 78 public void restricted() 79 { 80 System.out.println("PrivateSessionBean.restricted"); 81 Principal p = sessionContext.getCallerPrincipal(); 82 System.out.println("PrivateSessionBean.restricted, callerPrincipal="+p); 83 } 84 } 85 | Popular Tags |