如何避免用户访问JSF中的.xhtml页面? [英] How to avoid user access to .xhtml page in JSF?

查看:273
本文介绍了如何避免用户访问JSF中的.xhtml页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JSF的新手并且首先编写简单的jsf web应用程序。

I am new to JSF and writing first simply jsf web app.

带有.jsf的URL映射到WebContent中的.xhtml文件,但为什么我可以打开.xhtml在所有jsf标记的Web浏览器中。如何保护这个?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆