排除登录验证一个JSF页面

问题描述 投票:0回答:1

我试图排除登录验证一个JSF页面。我添加了一个安全性约束在web.xml中没有的auth-constraint标记,如下建议:https://blog.mafr.de/2011/04/17/excluding-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>
java jsf java-ee wildfly
1个回答
0
投票

原来没有被使用在web.xml的结构中,并有一个过滤器类,它提供授权。它仅限于XHTML文件,所以这就是为什么我与HTML文件中没有问题。

© www.soinside.com 2019 - 2024. All rights reserved.