Hi,
Jmix doesn’t have this functionality out of the box. You may implement in your project.
The most straightforward way is to register a servlet filter that will analyze the IP address, e.g.:
public class MyIpFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException {
if (matches(request, "0:0:0:0:0:0:0:1")) {
filterChain.doFilter(request, response);
}
}
private boolean matches(HttpServletRequest request, String ipAddress) {
IpAddressMatcher ipAddressMatcher = new IpAddressMatcher(ipAddress);
return ipAddressMatcher.matches(request);
}
}
@Configuration
public class MyConfiguration {
@Bean
public FilterRegistrationBean<MyIpFilter> loggingFilter(){
FilterRegistrationBean<MyIpFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new MyIpFilter());
registrationBean.addUrlPatterns("/hello/*");
return registrationBean;
}
}