List of usage examples for org.springframework.security.web.access.expression WebExpressionConfigAttribute WebExpressionConfigAttribute
public WebExpressionConfigAttribute(Expression authorizeExpression,
EvaluationContextPostProcessor<FilterInvocation> postProcessor)
From source file:org.springframework.security.web.access.expression.ExpressionBasedFilterInvocationSecurityMetadataSource.java
private static LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> processMap( LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap, ExpressionParser parser) { Assert.notNull(parser, "SecurityExpressionHandler returned a null parser object"); LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestToExpressionAttributesMap = new LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>( requestMap);//from ww w.j av a 2 s . com for (Map.Entry<RequestMatcher, Collection<ConfigAttribute>> entry : requestMap.entrySet()) { RequestMatcher request = entry.getKey(); Assert.isTrue(entry.getValue().size() == 1, () -> "Expected a single expression attribute for " + request); ArrayList<ConfigAttribute> attributes = new ArrayList<>(1); String expression = entry.getValue().toArray(new ConfigAttribute[1])[0].getAttribute(); logger.debug("Adding web access control expression '" + expression + "', for " + request); AbstractVariableEvaluationContextPostProcessor postProcessor = createPostProcessor(request); try { attributes.add(new WebExpressionConfigAttribute(parser.parseExpression(expression), postProcessor)); } catch (ParseException e) { throw new IllegalArgumentException("Failed to parse expression '" + expression + "'"); } requestToExpressionAttributesMap.put(request, attributes); } return requestToExpressionAttributesMap; }