{
if (method.getEjbName().equals(ejbName))
{
if (permission.isNotChecked())
{
PermitAllImpl annotation = new PermitAllImpl();
addAnnotations(PermitAll.class, annotation, container, method);
} else
{
RolesAllowedImpl annotation = new RolesAllowedImpl();
for (String roleName : permission.getRoles())
{
annotation.addValue(roleName);
}
// Log and add
log.debug("Adding @" + RolesAllowed.class.getSimpleName() + " for method "
+ method.getMethodName() + "("
+ method.getMethodParams() + ") of EJB " + method.getEjbName() + ": "
+ Arrays.asList(annotation.value()));
addAnnotations(RolesAllowed.class, annotation, container, method);
}
}
}
}
}
}
if (enterpriseBean != null && enterpriseBean.getSecurityDomain() != null)
{
String securityDomain = enterpriseBean.getSecurityDomain();
SecurityDomainImpl annotation = new SecurityDomainImpl(securityDomain);
if (dd.getUnauthenticatedPrincipal() != null)
annotation.setUnauthenticatedPrincipal(dd
.getUnauthenticatedPrincipal());
addClassAnnotation(container, annotation.annotationType(), annotation);
} else if (dd.getSecurityDomain() != null)
{
String securityDomain = dd.getSecurityDomain();
SecurityDomainImpl annotation = new SecurityDomainImpl(securityDomain);
if (dd.getUnauthenticatedPrincipal() != null)
annotation.setUnauthenticatedPrincipal(dd
.getUnauthenticatedPrincipal());
addClassAnnotation(container, annotation.annotationType(), annotation);
} else if (dd.getUnauthenticatedPrincipal() != null)
{
SecurityDomain annotation = ejbClass.getAnnotation(SecurityDomain.class);
if(annotation == null)
{
annotation = container.getAnnotation(SecurityDomain.class, ejbClass);
}
SecurityDomainImpl override;
if (annotation != null)
{
override = new SecurityDomainImpl(annotation.value());
override.setUnauthenticatedPrincipal(dd
.getUnauthenticatedPrincipal());
}
else
{