use of org.springframework.security.web.access.expression.ExpressionBasedFilterInvocationSecurityMetadataSource in project spring-security by spring-projects.
the class FilterSecurityMetadataSourceBeanDefinitionParserTests method expressionsAreSupported.
@Test
public void expressionsAreSupported() {
setContext("<filter-security-metadata-source id='fids'>" + " <intercept-url pattern='/**' access=\"hasRole('ROLE_A')\" />" + "</filter-security-metadata-source>");
ExpressionBasedFilterInvocationSecurityMetadataSource fids = (ExpressionBasedFilterInvocationSecurityMetadataSource) this.appContext.getBean("fids");
ConfigAttribute[] cad = fids.getAttributes(createFilterInvocation("/anything", "GET")).toArray(new ConfigAttribute[0]);
assertThat(cad.length).isEqualTo(1);
assertThat(cad[0].toString()).isEqualTo("hasRole('ROLE_A')");
}
Aggregations