jbossas/jboss-as — pull request #795 by jaikiran (2011-12-03 19:28:15+00:00)
Title: Fix EJB security-role-ref handling and linking of roles with principal names

The commits in this branch fix handling of security-role-ref in ejb-jar.xml and the mapping of principal with role names via jboss-ejb3.xml.

If a security-role-ref defines a alias role to a real role and the jboss-ejb3.xml sets up a mapping between some principal "joe" to the real role, then the call to isCallerInRole(realRole) and isCallerInRole(aliasRole) on the EJB context is expected to return true if the "joe" is the current logged-in user.

ejb-jar.xml:

foo

AliasRole
RealRole

RealRole

jboss-ejb3.xml:

RealRole
joe

Application code:

// login as joe
securityUtil.login("joe", "pass");
bean.isCallerInRole("RealRole"); // returns true
bean.isCallerInRole("AliasRole"); // returns true

With this commit, the above usecase works correctly now.