SEC-263: Stop polling voters after first one votes to deny.

This commit is contained in:
Ben Alex 2006-05-23 11:11:21 +00:00
parent 07e805e342
commit 563ac1324c
1 changed files with 6 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -15,13 +15,13 @@
package org.acegisecurity.vote;
import java.util.Iterator;
import org.acegisecurity.AccessDeniedException;
import org.acegisecurity.Authentication;
import org.acegisecurity.ConfigAttribute;
import org.acegisecurity.ConfigAttributeDefinition;
import java.util.Iterator;
/**
* Simple concrete implementation of {@link
@ -60,7 +60,6 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
public void decide(Authentication authentication, Object object,
ConfigAttributeDefinition config) throws AccessDeniedException {
int grant = 0;
int deny = 0;
int abstain = 0;
Iterator configIter = config.getConfigAttributes();
@ -82,9 +81,9 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
break;
case AccessDecisionVoter.ACCESS_DENIED:
deny++;
break;
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
default:
abstain++;
@ -94,12 +93,6 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
}
}
if (deny > 0) {
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
}
// To get this far, there were no deny votes
if (grant > 0) {
return;