且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 Spring Security 的 IP 过滤器

更新时间:2023-12-03 20:09:52

一种方法是使用 Spring Security 的 网络安全表达式.例如:

One way you can do this is to use Spring Security's Web Security Expressions. For example:

<http use-expressions="true">
    <intercept-url pattern="/admin*"
        access="hasRole('admin') and hasIpAddress('192.168.1.0/24')"/>
    ...
</http>