SEC-1086: AccessDecisionManager implementations now log debug messages giving the results returned by each voter polled.

This commit is contained in:
Luke Taylor 2009-03-19 02:01:24 +00:00
parent d163cd7d18
commit a0f3015ac6
4 changed files with 15 additions and 0 deletions

View File

@ -18,6 +18,8 @@ package org.springframework.security.vote;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.AccessDecisionManager;
import org.springframework.security.AccessDeniedException;
import org.springframework.security.SpringSecurityMessageSource;
@ -39,6 +41,7 @@ import org.springframework.util.Assert;
public abstract class AbstractAccessDecisionManager implements AccessDecisionManager, InitializingBean,
MessageSourceAware {
//~ Instance fields ================================================================================================
protected final Log logger = LogFactory.getLog(getClass());
private List<AccessDecisionVoter> decisionVoters;

View File

@ -48,6 +48,10 @@ public class AffirmativeBased extends AbstractAccessDecisionManager {
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, configAttributes);
if (logger.isDebugEnabled()) {
logger.debug("Voter: " + voter + ", returned: " + result);
}
switch (result) {
case AccessDecisionVoter.ACCESS_GRANTED:
return;

View File

@ -60,6 +60,10 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, configAttributes);
if (logger.isDebugEnabled()) {
logger.debug("Voter: " + voter + ", returned: " + result);
}
switch (result) {
case AccessDecisionVoter.ACCESS_GRANTED:
grant++;

View File

@ -62,6 +62,10 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
for(AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
if (logger.isDebugEnabled()) {
logger.debug("Voter: " + voter + ", returned: " + result);
}
switch (result) {
case AccessDecisionVoter.ACCESS_GRANTED:
grant++;