security - @RunAs and Role Propagation -
glassfish-3.1.2.2.
i have 1 servlet , 2 ejb in project.
servlet--------->init--------------->print
// ejb init code
@stateless @runas("system") @declareroles({"system"}) public class init { @resource ejbcontext ejb; @ejb private print print; public void initialize() { system.out.println("**********" + ejb.getcallerprincipal().getname()); system.out.println("**********" + ejb.iscallerinrole("system")); print.printline(); } }
// ejb print code:
@stateless @declareroles({"system"}) public class print { @resource ejbcontext ejb; public void printline() { system.out.println("**********" + ejb.getcallerprincipal().getname()); system.out.println("*********" + ejb.iscallerinrole("system")); } }
// execution result:
info: **********anonymous (ok) info: **********false (ok) info: **********system (ok) info: **********false (? )
why getting second false (i expecting true) ?
mapping of web project , ejb project
<security-role-mapping> <role-name>system</role-name> <group-name>system</group-name> </security-role-mapping>
thank you.
i figure out problème. in mapping
<principal-name></<principal-name>
must specified username associated group.
Comments
Post a Comment