package com.kri.common.webmvc; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.security.web.util.matcher.IpAddressMatcher; @RequiredArgsConstructor public class IpAccessControlService { private final KriIpAccessProperties properties; public boolean isAccessible(String ipAddress) { List cidrs = properties.getEffectiveCidrs(); return cidrs.stream() .map(IpAddressMatcher::new) .anyMatch(matcher -> matcher.matches(ipAddress)); } }