Extra test to confirm http-method specific matching behaviour.

This commit is contained in:
Luke Taylor 2009-12-14 13:55:48 +00:00
parent cad32ffe39
commit 6805761d85
1 changed files with 15 additions and 0 deletions

View File

@ -180,6 +180,21 @@ public class DefaultFilterInvocationSecurityMetadataSourceTests {
assertEquals(userAttrs, attrs);
}
@Test
public void methodSpecificMatchTakesPrecdenceRegardlessOfOrdering() throws Exception {
// Unfortunate but unavoidable
LinkedHashMap requestMap = new LinkedHashMap();
Collection<ConfigAttribute> userAttrs = SecurityConfig.createList("A");
requestMap.put(new RequestKey("/secure/specific.html", null), SecurityConfig.createList("B"));
requestMap.put(new RequestKey("/secure/*.html", "GET"), userAttrs);
fids = new DefaultFilterInvocationSecurityMetadataSource(new AntUrlPathMatcher(), requestMap);
fids.setStripQueryStringFromUrls(true);
FilterInvocation fi = createFilterInvocation("/secure/specific.html", "GET");
Collection<ConfigAttribute> attrs = fids.getAttributes(fi);
assertEquals(userAttrs, attrs);
}
/**
* Check fixes for SEC-321
*/