List of usage examples for org.springframework.security.web.access.expression WebExpressionConfigAttribute getAuthorizeExpression
Expression getAuthorizeExpression()
From source file:org.codehaus.groovy.grails.plugins.springsecurity.WebExpressionVoter.java
/** * {@inheritDoc}//from w w w. j a v a 2 s. com * @see org.springframework.security.access.AccessDecisionVoter#vote( * org.springframework.security.core.Authentication, java.lang.Object, java.util.Collection) */ public int vote(final Authentication authentication, final Object object, final Collection<ConfigAttribute> attributes) { Assert.notNull(authentication, "authentication cannot be null"); Assert.notNull(object, "object cannot be null"); Assert.notNull(attributes, "attributes cannot be null"); WebExpressionConfigAttribute weca = findConfigAttribute(attributes); if (weca == null) { return ACCESS_ABSTAIN; } FilterInvocation fi = (FilterInvocation) object; EvaluationContext ctx = _expressionHandler.createEvaluationContext(authentication, fi); return ExpressionUtils.evaluateAsBoolean(weca.getAuthorizeExpression(), ctx) ? ACCESS_GRANTED : ACCESS_DENIED; }