如何在 apache Shiro 配置中声明多个未授权的 URL

How to declare multiple Un-authorized URL's in apache Shiro configuration

我正在试用 Apache Shiro 框架,基本上是从在线项目下载安装程序。我设法让它工作,但我遇到了一个非常小的问题。我想在我的项目中制作多个 JSF 页面,无需任何授权即可访问。

当前的配置类似于:

authc = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter    
authc.loginUrl = /login.xhtml
roles.unauthorizedUrl = /login.xhtml

现在我想在 roles.unnauthorizeddUrl 中再添加一页,即 signUp.xhtml

我试过了

roles.unauthorizedUrl = /login.xhtml,/signUp.xhtml

但这不起作用。有没有办法在 config.xml 中声明多个未授权的 URL's?

roles.unauthorizedUrl 是必须将用户重定向到的 Url,以防用户试图访问受保护/未授权的 url。所以你只添加一个这样的 URL,否则歧义将被提升到 url 重定向到的框架。

如果您想取消保护任何 url,请使用 [urls] 部分中的以下配置

/login.xhtml = anon
/sugnUp.xhtml = anon