mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-27 06:12:27 +00:00
SEC-262: Refactor common method into superclass.
This commit is contained in:
parent
d795836bf1
commit
07e805e342
@ -19,6 +19,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.acegisecurity.AccessDecisionManager;
|
import org.acegisecurity.AccessDecisionManager;
|
||||||
|
import org.acegisecurity.AccessDeniedException;
|
||||||
import org.acegisecurity.AcegiMessageSource;
|
import org.acegisecurity.AcegiMessageSource;
|
||||||
import org.acegisecurity.ConfigAttribute;
|
import org.acegisecurity.ConfigAttribute;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
@ -138,4 +139,12 @@ public abstract class AbstractAccessDecisionManager
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final void checkAllowIfAllAbstainDecisions() {
|
||||||
|
if (!this.isAllowIfAllAbstainDecisions()) {
|
||||||
|
throw new AccessDeniedException(messages.getMessage(
|
||||||
|
"AbstractAccessDecisionManager.accessDenied",
|
||||||
|
"Access is denied"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,12 +79,6 @@ public class AffirmativeBased extends AbstractAccessDecisionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To get this far, every AccessDecisionVoter abstained
|
// To get this far, every AccessDecisionVoter abstained
|
||||||
if (this.isAllowIfAllAbstainDecisions()) {
|
checkAllowIfAllAbstainDecisions();
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
throw new AccessDeniedException(messages.getMessage(
|
|
||||||
"AbstractAccessDecisionManager.accessDenied",
|
|
||||||
"Access is denied"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,13 +108,7 @@ public class ConsensusBased extends AbstractAccessDecisionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To get this far, every AccessDecisionVoter abstained
|
// To get this far, every AccessDecisionVoter abstained
|
||||||
if (this.isAllowIfAllAbstainDecisions()) {
|
checkAllowIfAllAbstainDecisions();
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
throw new AccessDeniedException(messages.getMessage(
|
|
||||||
"AbstractAccessDecisionManager.accessDenied",
|
|
||||||
"Access is denied"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowIfEqualGrantedDeniedDecisions() {
|
public boolean isAllowIfEqualGrantedDeniedDecisions() {
|
||||||
|
@ -106,12 +106,6 @@ public class UnanimousBased extends AbstractAccessDecisionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To get this far, every AccessDecisionVoter abstained
|
// To get this far, every AccessDecisionVoter abstained
|
||||||
if (this.isAllowIfAllAbstainDecisions()) {
|
checkAllowIfAllAbstainDecisions();
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
throw new AccessDeniedException(messages.getMessage(
|
|
||||||
"AbstractAccessDecisionManager.accessDenied",
|
|
||||||
"Access is denied"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user