* Extract security info from the bean's metadata.
* @param bean the metadata of the current bean.
* @return the security info.
*/
public static ISecurityInfo getSecurityInfo(final EasyBeansEjbJarClassMetadata bean) {
ISecurityInfo securityInfo = new SecurityInfo(bean);
// Add each declared role
securityInfo.setDeclaredRole(bean.getDeclareRoles());
// Sets the run-as role.
String runAsRole = bean.getRunAs();
if (runAsRole != null) {
securityInfo.setRunAsRole(runAsRole);
}
// For each business method, add info.
Collection<? extends EasyBeansEjbJarMethodMetadata> methods = bean.getMethodMetadataCollection();
// No methods, break now
if (methods == null) {
return securityInfo;
}
for (EasyBeansEjbJarMethodMetadata method : methods) {
// Match only business method
if (!method.isBusinessMethod()) {
continue;
}
IMethodSecurityInfo methodSecurityInfo = new MethodSecurityInfo();
securityInfo.addMethodSecurityInfo(methodSecurityInfo);
// Set meta-info
methodSecurityInfo.setExcluded(method.hasDenyAll());
methodSecurityInfo.setUnchecked(method.hasPermitAll());
List<String> roles = method.getRolesAllowed();