authorities.add(RoleImpl.ROLE_ANONYMOUS);
authorities.add(RoleImpl.ROLE_ADMINISTRATOR);
try {
Set<Class<DomainEntity>> entities = scanner.collect(EntitySecurity.class);
for (Class<DomainEntity> entityClass : entities) {
EntitySecurity es = entityClass.getAnnotation(EntitySecurity.class);
if (es != null) {
for (EntitySecurityRule rule : es.value()) {
authorities.addAll(Arrays.asList(rule.ifAllGranted()));
authorities.addAll(Arrays.asList(rule.ifAnyGranted()));
authorities.addAll(Arrays.asList(rule.ifNotGranted()));
}
}