如何避免用户访问 JSF 中的 .xhtml 页面? [英] How to avoid user access to .xhtml page in JSF?
本文介绍了如何避免用户访问 JSF 中的 .xhtml 页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 JSF 的新手,首先编写了简单的 jsf Web 应用程序.
I am new to JSF and writing first simply jsf web app.
带有 .jsf 的 URL 映射到 WebContent 中的 .xhtml 文件,但为什么我可以在带有所有 jsf 标签的 Web 浏览器中打开 .xhtml.如何保护它?
URL with .jsf are mapping to .xhtml files in WebContent but why I can open .xhtml in web browser with all jsf tags. How to protect this?
推荐答案
您可以向 web.xml
添加安全约束,阻止对 *.xhtml
的所有请求.
You could add a security constraint to your web.xml
blocking all requests to *.xhtml
.
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
这篇关于如何避免用户访问 JSF 中的 .xhtml 页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文