SEC-1086: AccessDecisionManager implementations now log debug messages giving the results returned by each voter polled.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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++;
|
||||
|
||||
Reference in New Issue
Block a user