【发布时间】:2013-06-24 21:44:08
【问题描述】:
我在使用带有漂亮面孔的基于容器的安全性时遇到问题。至于我禁用漂亮的面孔(在 pom.xml 中删除它的存在),基于容器的安全性工作正常并且页面得到很好的保护。 但是,使用漂亮面孔后,安全性不再起作用,无需身份验证即可访问安全页面(我没有在安全页面上应用漂亮面孔过滤器)。即使我使用的是空的 pretty-config.xml(唯一的)。
我正在使用 Jboss AS
编辑:
使用此设置,无需身份验证即可访问页面 /user/*。从 pom.xml 中删除漂亮的面孔后,它运行良好。
web.xml 的一部分:
<security-role>
<description>Users</description>
<role-name>user</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>General use.</web-resource-name>
<url-pattern>/user/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>TRACE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/login-fail.xhtml</form-error-page>
</form-login-config>
</login-config>
prettyfaces-config.xml(使用空的 pretty-config.xml 时):
<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
</pretty-config>
【问题讨论】:
-
你能发布你配置的相关部分吗?
-
添加了 web.xml 和 prettyfaces-config.xml。我希望它足够
-
您在使用 PrettyFaces 注释吗?你是如何定义你的页面映射的?
-
我只使用 xml,没有注释/类。但是,即使 pretty-config 为空,我也会遇到问题(例如,在创建 prettyfaces-config.xml + 向 pom.xml 添加 prettyfaces 后,安全性就会停止工作)。
-
我更新了答案:)
标签: java prettyfaces