return this.rolesAllowed;
}
private boolean isAccessDenied(final ComponentConfiguration componentConfiguration, final String viewClassName, final Method viewMethod) {
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentConfiguration.getComponentDescription();
// find the component method corresponding to this view method
final Method componentMethod = this.findComponentMethod(componentConfiguration, viewMethod);
final EJBMethodIdentifier ejbMethodIdentifier = EJBMethodIdentifier.fromMethod(componentMethod);
final Set<String> rolesAllowed = ejbComponentDescription.getRolesAllowed(viewClassName, ejbMethodIdentifier);
final boolean methodMarkedForDenyAll = this.isMethodMarkedForDenyAll(ejbComponentDescription, viewClassName, ejbMethodIdentifier);
final boolean methodMarkedForPermitAll = this.isMethodMarkedForPermitAll(ejbComponentDescription, viewClassName, ejbMethodIdentifier);
if (methodMarkedForDenyAll) {
// make sure the method isn't marked for @PermitAll
if (methodMarkedForPermitAll) {
throw new IllegalStateException("Method " + componentMethod + " for view " + viewClassName + " shouldn't be " +
"marked for both @PemitAll and @DenyAll at the same time");
}
// make sure @RolesAllowed isn't applied to the method explicitly
if (!rolesAllowed.isEmpty()) {
throw new IllegalStateException("Method " + componentMethod + " for view " + viewClassName + " shouldn't be " +
"marked for both @RolesAllowed and @DenyAll at the same time");
}
// only @DenyAll is applied on the method, so return true
return true;
}
// check on class level for @DenyAll *only* if the method isn't marked with @PermitAll and @RolesAllowed (in which case,
// it doesn't qualify for @DenyAll)
if (!rolesAllowed.isEmpty()) {
return false;
}
if (methodMarkedForPermitAll) {
return false;
}
final Class<?> declaringClass = componentMethod.getDeclaringClass();
if (ejbComponentDescription.isDenyAllApplicableToClass(viewClassName, declaringClass.getName())) {
return true;
}
return false;
}