Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 为什么在Spring MVC安全应用程序中一个安全过滤器阻止执行另一个?_Spring Mvc_Spring Security_Spring Rest - Fatal编程技术网

Spring mvc 为什么在Spring MVC安全应用程序中一个安全过滤器阻止执行另一个?

Spring mvc 为什么在Spring MVC安全应用程序中一个安全过滤器阻止执行另一个?,spring-mvc,spring-security,spring-rest,Spring Mvc,Spring Security,Spring Rest,我是Spring安全模块的新手。我想知道两个安全过滤器之间的区别是什么 <security:intercept-url method="GET" pattern="/newapi/user/**" access="hasRole('ROLE_USER','LOW_ADMIN')" /> <security:intercept-url method="GET" pattern="/newapi/user/*/*" access="hasRole('ROLE_USER,'BIG_A

我是Spring安全模块的新手。我想知道两个安全过滤器之间的区别是什么

<security:intercept-url method="GET" pattern="/newapi/user/**" access="hasRole('ROLE_USER','LOW_ADMIN')" />
<security:intercept-url method="GET" pattern="/newapi/user/*/*" access="hasRole('ROLE_USER,'BIG_ADMIN')" />

另外,第一个安全过滤器似乎阻止执行第二个过滤器,因为当我执行/newapi/user/data/7897896时,只有第一个安全过滤器在执行,但人们希望我执行第二个安全过滤器。有人能告诉我为什么会发生这种情况,以及我们如何解决这些问题吗

仅供参考-我们有非常大/巨大的web应用程序,它定义了将近150多个安全过滤器,因此调试此类安全相关问题变得非常困难。任何一位Spring安全专家都能告诉我们您的想法吗?

规则自上而下应用。因此,这个新的应该放在原来的前面,否则它将被/**路径的广泛范围所取代,所以这就是您的第二个安全过滤器不执行的原因。您需要像下面这样更改序列

<security:intercept-url method="GET" pattern="/newapi/user/*/*" access="hasRole('ROLE_USER,'BIG_ADMIN')" />
<security:intercept-url method="GET" pattern="/newapi/user/**" access="hasRole('ROLE_USER','LOW_ADMIN')" />