简体   繁体   English

Spring Web Security 许可索引页

[英]Spring Web Security permit index page

I want to allow anonymous access to my index page, which means the URL will be either localhost:8080/MyProject/ or localhost:8080/MyProject/index.xhtml .我想允许匿名访问我的索引页面,这意味着 URL 将是localhost:8080/MyProject/localhost:8080/MyProject/index.xhtml I have read through this but the case is different with mine.我已经通读了这篇文章,但我的情况不同。 I tried to configure it like this:<>我试着这样配置它:<>

http.authorizeRequests().antMatchers("/javax.faces.resource/**", "/", "/index.xhtml").permitAll().anyRequest().authenticated();

With the statement above, the URL localhost:8080/MyProject/index.xhtml will allow anonymous access but localhost:8080/MyProject/ will still denied the access.使用上面的语句,URL localhost:8080/MyProject/index.xhtml将允许匿名访问,但localhost:8080/MyProject/仍将拒绝访问。 Help?帮助?

Try this:尝试这个:

.antMatchers("/*").permitAll() or .antMatchers("/MyProject/*").permitAll() .antMatchers("/*").permitAll().antMatchers("/MyProject/*").permitAll()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM