0

我试图从登录身份验证中排除一个 JSF 页面。我在 web.xml 中添加了一个没有 auth-constraint 标记的安全约束,如下所示: https ://blog.mafr.de/2011/04/17/ exclude-pages-from-auth/

这并不能解决问题,因为我使用的是基于容器的登录配置,在我的 web.xml 中配置。

有没有一种方法可以只访问一个 JSF 页面而无需登录,同时保持当前的登录配置?

这是我的登录和安全约束配置:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Restricted Employees</web-resource-name>
        <url-pattern>/employee</url-pattern>
        <http-method>POST</http-method>
        <http-method>GET</http-method>
    </web-resource-collection>

    <auth-constraint>
        <role-name>team_leaders</role-name>
    </auth-constraint>
</security-constraint>

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Public</web-resource-name>
        <description>No login required for accepting requests</description>
        <url-pattern>/acceptRequests</url-pattern>
        <http-method>POST</http-method>
        <http-method>GET</http-method>
    </web-resource-collection>
</security-constraint>

<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.xhtml</form-login-page>
        <form-error-page>/login.xhtml</form-error-page>
    </form-login-config>
</login-config>
4

1 回答 1

0

原来 web.xml 中的配置没有被使用,并且有一个提供授权的过滤器类。它仅限于 xhtml 文件,所以这就是我对 html 文件没有问题的原因。

于 2019-02-03T11:49:53.200 回答