apache shiro url与apache挂毯匹配

时间:2018-11-23 06:34:43

标签: shiro tapestry

这是我的配置

configuration.add(factory.createChain("/abc/*")
            .add(factory.anon()).build());
    configuration.add(factory.createChain("/pdf/pdfReport/*")
            .add(factory.authc()).build());
    configuration.add(factory.createChain("/*").add(factory.authc())
            .build());

我面临的问题是/ abc在根路径中,如果我将其设为匿名,那么shiro仍将其重定向到登录页面。

我猜/ *正在覆盖/ abc请求并发送每个根请求进行身份验证,因为如果我注释此代码

configuration.add(factory.createChain("/*").add(factory.authc())
            .build());

然后我可以匿名访问/ abc。有人可以指导我如何同时保留两者和仍实现mu功能

1 个答案:

答案 0 :(得分:1)

我想通了,我只需要给

configuration.add(factory.createChain("/abc")
        .add(factory.anon()).build());

代替/ *,因为/ *已针对链中/之后的每个网址进行了身份验证