소스 검색

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

Ben Alex 19 년 전
부모
커밋
563ac1324c
1개의 변경된 파일6개의 추가작업 그리고 13개의 파일을 삭제
  1. 6 13
      core/src/main/java/org/acegisecurity/vote/UnanimousBased.java

+ 6 - 13
core/src/main/java/org/acegisecurity/vote/UnanimousBased.java

@@ -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;