posted 15 years ago
You're confusing two different aspects of security here; programmatic (the use of isCallerInRole()) and declarative (method permissions).
When a Bean Provider writes a bean that uses programmatic security checks they must declare the role name(s) used in the code using DeclareRoles and/or security-role-ref. If they don�t, and the Application Assembler only has the bean byte code to work with, there�s no way of knowing how to use the bean.
The whole point of being able to write reusable components is that the bean may be used by many different applications/organisations. The Bean Provider has no idea what applications the bean may be used in so the Bean Provider uses arbitrary role name(s) in the bean code and declares them, along with a ddescription.
An Application Assembler from another organization can use this bean by linking the declared roles to actual roles used in their application. If no mapping is supplied the role names used in the code are assumed exist in the application.
DeclareRoles and/or security-role-ref have nothing to do with method permissions.
SCJP, SCWCD, SCBCD, SCEA 5