} catch (NoSuchManagedBeanExcpetion e) {
throw new SherpaRuntimeException(e);
}
if(method.isAnnotationPresent(DenyAll.class)) {
throw new SherpaPermissionExcpetion("method ["+method.getName()+"] in class ["+method.getDeclaringClass().getCanonicalName()+"] has `@DenyAll` annotation", "DENY_ALL");
}
if(method.isAnnotationPresent(RolesAllowed.class)) {
boolean fail = true;
for(String role: method.getAnnotation(RolesAllowed.class).value()) {
if(service.hasRole(userid, token, role)) {
fail = false;
}
}
if(fail) {
throw new SherpaPermissionExcpetion("method ["+method.getName()+"] in class ["+method.getDeclaringClass().getCanonicalName()+"] has `@RolesAllowed` annotation", "DENY_ROLE" );
}
}
}