Examples of RequestKey


Examples of org.springframework.security.web.access.intercept.RequestKey

*/
public class RequestKeyTests {

    @Test
    public void equalsWorksWithNullHttpMethod() {
        RequestKey key1 = new RequestKey("/someurl");
        RequestKey key2 = new RequestKey("/someurl");

        assertEquals(key1, key2);
        key1 = new RequestKey("/someurl","GET");
        assertFalse(key1.equals(key2));
        assertFalse(key2.equals(key1));
    }
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

        assertFalse(key2.equals(key1));
    }

    @Test
    public void keysWithSameUrlAndHttpMethodAreEqual() {
        RequestKey key1 = new RequestKey("/someurl", "GET");
        RequestKey key2 = new RequestKey("/someurl", "GET");

        assertEquals(key1, key2);
    }
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

        assertEquals(key1, key2);
    }

    @Test
    public void keysWithSameUrlAndDifferentHttpMethodAreNotEqual() {
        RequestKey key1 = new RequestKey("/someurl", "GET");
        RequestKey key2 = new RequestKey("/someurl", "POST");

        assertFalse(key1.equals(key2));
        assertFalse(key2.equals(key1));
    }
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

        assertFalse(key2.equals(key1));
    }

    @Test
    public void keysWithDifferentUrlsAreNotEquals() {
        RequestKey key1 = new RequestKey("/someurl", "GET");
        RequestKey key2 = new RequestKey("/anotherurl", "GET");

        assertFalse(key1.equals(key2));
        assertFalse(key2.equals(key1));
    }
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

      LinkedHashMap<RequestKey, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>();
      for (String key : this.getUrlPatterns().keySet()) {
        String value = this.getUrlPatterns().get(key);
        Collection<ConfigAttribute> elements = new ArrayList<ConfigAttribute>();
        elements.add(new SecurityConfig(value));
        requestMap.put(new RequestKey(key), elements);
      }
      this.defaultFilterInvocationSecurityMetadataSource = new DefaultFilterInvocationSecurityMetadataSource(matcher, requestMap);
    }
    return this.defaultFilterInvocationSecurityMetadataSource.lookupAttributes(uri, null);
  }
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

        LinkedHashMap<RequestKey, Collection<ConfigAttribute>> requestToExpressionAttributesMap =
            new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>(requestMap);

        for (Map.Entry<RequestKey, Collection<ConfigAttribute>> entry : requestMap.entrySet()) {
            RequestKey request = entry.getKey();
            Assert.isTrue(entry.getValue().size() == 1, "Expected a single expression attribute for " + request);
            ArrayList<ConfigAttribute> attributes = new ArrayList<ConfigAttribute>(1);
            String expression = entry.getValue().toArray(new ConfigAttribute[1])[0].getAttribute();
            logger.debug("Adding web access control expression '" + expression + "', for " + request);
            try {
View Full Code Here

Examples of org.springframework.security.web.access.intercept.RequestKey

    {
      LinkedHashMap<String, String> srcMap = resourceDetailsService.getRequestMap();
      LinkedHashMap<RequestKey, Collection<ConfigAttribute>> distMap = new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>();
     
      for (Map.Entry<String, String> entry : srcMap.entrySet()) {
        RequestKey key = new RequestKey(entry.getKey(), null);
        //使用SecurityConfig构造List<ConfigAttribute>
        SecurityConfig sc = new SecurityConfig(entry.getValue());
        List<ConfigAttribute> list = sc.createList(sc.getAttribute());
        distMap.put(key, list);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.