mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 14:52:24 +00:00
SEC-1033: Fixed missing AuthenticationTrustResolver in web SecurityExpressionRoot. Converted some logging to trace level.
This commit is contained in:
parent
6b4045667a
commit
a2ef10e65f
@ -58,7 +58,7 @@ public class ExpressionAnnotationMethodDefinitionSource extends AbstractMethodDe
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Looking for expression annotations for method '" +
|
logger.trace("Looking for expression annotations for method '" +
|
||||||
method.getName() + "' on target class '" + targetClass + "'");
|
method.getName() + "' on target class '" + targetClass + "'");
|
||||||
PreFilter preFilter = findAnnotation(method, targetClass, PreFilter.class);
|
PreFilter preFilter = findAnnotation(method, targetClass, PreFilter.class);
|
||||||
PreAuthorize preAuthorize = findAnnotation(method, targetClass, PreAuthorize.class);
|
PreAuthorize preAuthorize = findAnnotation(method, targetClass, PreAuthorize.class);
|
||||||
@ -68,7 +68,7 @@ public class ExpressionAnnotationMethodDefinitionSource extends AbstractMethodDe
|
|||||||
|
|
||||||
if (preFilter == null && preAuthorize == null && postFilter == null && postAuthorize == null ) {
|
if (preFilter == null && preAuthorize == null && postFilter == null && postAuthorize == null ) {
|
||||||
// There is no meta-data so return
|
// There is no meta-data so return
|
||||||
logger.debug("No expression annotations found");
|
logger.trace("No expression annotations found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ public class DefaultSecurityExpressionHandler implements SecurityExpressionHandl
|
|||||||
public EvaluationContext createEvaluationContext(Authentication authentication, FilterInvocation fi) {
|
public EvaluationContext createEvaluationContext(Authentication authentication, FilterInvocation fi) {
|
||||||
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
StandardEvaluationContext ctx = new StandardEvaluationContext();
|
||||||
SecurityExpressionRoot root = new WebSecurityExpressionRoot(authentication, fi);
|
SecurityExpressionRoot root = new WebSecurityExpressionRoot(authentication, fi);
|
||||||
|
root.setTrustResolver(trustResolver);
|
||||||
ctx.setRootObject(root);
|
ctx.setRootObject(root);
|
||||||
|
|
||||||
return ctx;
|
return ctx;
|
||||||
|
@ -69,6 +69,10 @@ abstract class SecurityExpressionRoot {
|
|||||||
return trustResolver.isAnonymous(authentication);
|
return trustResolver.isAnonymous(authentication);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isAuthenticated() {
|
||||||
|
return !isAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isRememberMe() {
|
public final boolean isRememberMe() {
|
||||||
return trustResolver.isRememberMe(authentication);
|
return trustResolver.isRememberMe(authentication);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,8 @@ class WebExpressionConfigAttribute implements ConfigAttribute {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return authorizeExpression.getExpressionString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,10 @@ public class WebExpressionVoter implements AccessDecisionVoter {
|
|||||||
private SecurityExpressionHandler expressionHandler = new DefaultSecurityExpressionHandler();
|
private SecurityExpressionHandler expressionHandler = new DefaultSecurityExpressionHandler();
|
||||||
|
|
||||||
public int vote(Authentication authentication, Object object, List<ConfigAttribute> attributes) {
|
public int vote(Authentication authentication, Object object, List<ConfigAttribute> attributes) {
|
||||||
|
assert authentication != null;
|
||||||
|
assert object != null;
|
||||||
|
assert attributes != null;
|
||||||
|
|
||||||
WebExpressionConfigAttribute weca = findConfigAttribute(attributes);
|
WebExpressionConfigAttribute weca = findConfigAttribute(attributes);
|
||||||
|
|
||||||
if (weca == null) {
|
if (weca == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user