@Test public void testUnexpected() { RangerIpMatcher ipMatcher = createMatcher(new String[]{"1.2.3.*"} ); Assert.assertTrue(ipMatcher.isMatched(createRequest("1.2.3.123567"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("1.2.3..123567"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("1.2.3.boo"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("1.2.3."))); ipMatcher = createMatcher(new String[]{"1.*.3.4"} ); Assert.assertFalse(ipMatcher.isMatched(createRequest("1.3.3.4"))); Assert.assertFalse(ipMatcher.isMatched(createRequest("1.1.3.4"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("1.*.3.4"))); ipMatcher = createMatcher(new String[]{"99:a9:b9:c9:*"} ); Assert.assertTrue(ipMatcher.isMatched(createRequest("99:a9:b9:c9:*"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("99:a9:b9:c9:1.3.4"))); Assert.assertTrue(ipMatcher.isMatched(createRequest("99:a9:b9:c9: <:-) "))); }
@Override public boolean isMatched(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.isMatched(" + request + ")"); } boolean ipMatched = true; if (_allowAny) { LOG.debug("isMatched: allowAny flag is true. Matched!"); } else { String requestIp = extractIp(request); if (requestIp == null) { LOG.debug("isMatched: couldn't get ip address from request. Ok. Implicitly matched!"); } else { ipMatched = isWildcardMatched(_wildCardIps, requestIp) || isExactlyMatched(_exactIps, requestIp); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.isMatched(" + request+ "): " + ipMatched); } return ipMatched; }
RangerIpMatcher extends RangerAbstractConditionEvaluator { @Override public boolean isMatched(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.isMatched(" + request + ")"); } boolean ipMatched = true; if (_allowAny) { LOG.debug("isMatched: allowAny flag is true. Matched!"); } else { String requestIp = extractIp(request); if (requestIp == null) { LOG.debug("isMatched: couldn't get ip address from request. Ok. Implicitly matched!"); } else { ipMatched = isWildcardMatched(_wildCardIps, requestIp) || isExactlyMatched(_exactIps, requestIp); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.isMatched(" + request+ "): " + ipMatched); } return ipMatched; } }
RangerIpMatcher extends RangerAbstractConditionEvaluator { @Override public boolean isMatched(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.isMatched(" + request + ")"); } boolean ipMatched = true; if (_allowAny) { LOG.debug("isMatched: allowAny flag is true. Matched!"); } else { String requestIp = extractIp(request); if (requestIp == null) { LOG.debug("isMatched: couldn't get ip address from request. Ok. Implicitly matched!"); } else { ipMatched = isWildcardMatched(_wildCardIps, requestIp) || isExactlyMatched(_exactIps, requestIp); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.isMatched(" + request+ "): " + ipMatched); } return ipMatched; }  }
RangerIpMatcher extends RangerAbstractConditionEvaluator { @Override public boolean isMatched(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.isMatched(" + request + ")"); } boolean ipMatched = true; if (_allowAny) { LOG.debug("isMatched: allowAny flag is true. Matched!"); } else { String requestIp = extractIp(request); if (requestIp == null) { LOG.debug("isMatched: couldn't get ip address from request. Ok. Implicitly matched!"); } else { ipMatched = isWildcardMatched(_wildCardIps, requestIp) || isExactlyMatched(_exactIps, requestIp); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.isMatched(" + request+ "): " + ipMatched); } return ipMatched; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request); }
RangerIpMatcher extends RangerAbstractConditionEvaluator { @Override public boolean isMatched(final RangerAccessRequest request) { if(LOG.isDebugEnabled()) { LOG.debug("==> RangerIpMatcher.isMatched(" + request + ")"); } boolean ipMatched = true; if (_allowAny) { LOG.debug("isMatched: allowAny flag is true. Matched!"); } else { String requestIp = extractIp(request); if (requestIp == null) { LOG.debug("isMatched: couldn't get ip address from request. Ok. Implicitly matched!"); } else { ipMatched = isWildcardMatched(_wildCardIps, requestIp) || isExactlyMatched(_exactIps, requestIp); } } if(LOG.isDebugEnabled()) { LOG.debug("<== RangerIpMatcher.isMatched(" + request+ "): " + ipMatched); } return ipMatched; }  @Override void init(); @Override boolean isMatched(final RangerAccessRequest request);  }