Examples of IpAddressMatcher


Examples of org.springframework.security.web.util.IpAddressMatcher

     *
     * @param ipAddress the address or range of addresses from which the request must come.
     * @return true if the IP address of the current request is in the required range.
     */
    public boolean hasIpAddress(String ipAddress) {
        return (new IpAddressMatcher(ipAddress).matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.IpAddressMatcher

     *
     * @param ipAddress the address or range of addresses from which the request must come.
     * @return true if the IP address of the current request is in the required range.
     */
    public boolean hasIpAddress(String ipAddress) {
        return (new IpAddressMatcher(ipAddress).matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

        assertTrue(v4matcher.matches(ipv4Request));
    }

    @Test
    public void ipv4SubnetMatchesCorrectly() throws Exception {
        IpAddressMatcher matcher = new IpAddressMatcher("192.168.1.0/24");
        assertTrue(matcher.matches(ipv4Request));
        matcher = new IpAddressMatcher("192.168.1.128/25");
        assertFalse(matcher.matches(ipv4Request));
        ipv4Request.setRemoteAddr("192.168.1.159"); // 159 = 0x9f
        assertTrue(matcher.matches(ipv4Request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

        assertTrue(matcher.matches(ipv4Request));
    }

    @Test
    public void ipv6RangeMatches() throws Exception {
        IpAddressMatcher matcher = new IpAddressMatcher("2001:DB8::/48");

        assertTrue(matcher.matches("2001:DB8:0:0:0:0:0:0"));
        assertTrue(matcher.matches("2001:DB8:0:0:0:0:0:1"));
        assertTrue(matcher.matches("2001:DB8:0:FFFF:FFFF:FFFF:FFFF:FFFF"));
        assertFalse(matcher.matches("2001:DB8:1:0:0:0:0:0"));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

    }

    // SEC-1733
    @Test
    public void zeroMaskMatchesAnything() throws Exception {
        IpAddressMatcher matcher = new IpAddressMatcher("0.0.0.0/0");

        assertTrue(matcher.matches("123.4.5.6"));
        assertTrue(matcher.matches("192.168.0.159"));

        matcher = new IpAddressMatcher("192.168.0.159/0");
        assertTrue(matcher.matches("123.4.5.6"));
        assertTrue(matcher.matches("192.168.0.159"));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

     *
     * @param ipAddress the address or range of addresses from which the request must come.
     * @return true if the IP address of the current request is in the required range.
     */
    public boolean hasIpAddress(String ipAddress) {
        return (new IpAddressMatcher(ipAddress).matches(request));
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

      return true;
    }

    for (InterceptedUrl iu : matching) {
      for (ConfigAttribute ipPattern : iu.getConfigAttributes()) {
        if (new IpAddressMatcher(ipPattern.getAttribute()).matches(request)) {
          return true;
        }
      }
    }
View Full Code Here

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher

     *
     * @param ipAddress the address or range of addresses from which the request must come.
     * @return true if the IP address of the current request is in the required range.
     */
    public boolean hasIpAddress(String ipAddress) {
        return (new IpAddressMatcher(ipAddress).matches(request));
    }
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.