Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Websphere上JSF 1.2中的HTTP身份验证_Jsf_Jsf 1.2 - Fatal编程技术网

Websphere上JSF 1.2中的HTTP身份验证

Websphere上JSF 1.2中的HTTP身份验证,jsf,jsf-1.2,Jsf,Jsf 1.2,我正在Webshere7.0上使用JSF1.2+Tomahawk 1.1.13 My web.xml: <welcome-file-list> <welcome-file>/search.faces</welcome-file> </welcome-file-list> <security-constraint> <display-name>Websphere Security Constraint<

我正在Webshere7.0上使用JSF1.2+Tomahawk 1.1.13

My web.xml:

<welcome-file-list>
    <welcome-file>/search.faces</welcome-file>
</welcome-file-list>

<security-constraint>
    <display-name>Websphere Security Constraint</display-name>
    <web-resource-collection>
        <web-resource-name>Default</web-resource-name>
        <description />
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
</security-constraint>

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

/搜索人脸
Websphere安全约束
违约
/*
类型
/login.jsp
/login.jsp
my login.jsp:

<form method="post" action="j_security_check">

    <jsp:include page="head.jsp" />

    <t:panelGrid columns="2" border="1"
        columnClasses="unfixedCol,fixedCol"
        style="style=text-align:top; margin-top:20px; margin-bottom:20px;">

        <t:panelGroup>
            Login
        </t:panelGroup>
        <t:panelGroup>
            <h:inputText id="j_username" autocomplete="off" size="20" />
        </t:panelGroup>

        <t:panelGroup>
            Password
        </t:panelGroup>
        <t:panelGroup>
            <h:inputSecret id="j_password" autocomplete="off" size="20" />
        </t:panelGroup>

        <f:facet name="footer">
            <t:panelGroup colspan="4"
                style="text-align:right; background-color:#d9e2f2;">
                <h:commandButton type="submit" value="Submit" /> &nbsp; 
                <h:commandButton type="reset" value="Reset" />
            </t:panelGroup>
        </f:facet>

    </t:panelGrid>

    <jsp:include page="foot.jsp" />

</form>

登录
暗语
当我访问acsess/localhost:9080/App/并输入正确的凭据时,一切似乎都正常,我登录了,但这会带来问题:

  • 我可以在不进行安全检查的情况下访问应用程序jsp页面(我可以在不进行检查的情况下访问/localhost:9080/App/search.jsp,但当我访问/localhost:9080/App/-时,会进行安全检查)。尝试了不同的url模式

  • 当我尝试使用FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal()获取HTTP会话用户时-当我记录id时,始终存在空值。为什么

  • 检查了所有指南,包括一些stackowerflow问题,但没有意识到我的问题在哪里


    感谢您对我们的应用程序的帮助,我们定义如下:

    web.xml

    <security-constraint>
        <display-name>Security Constraint</display-name>
        <web-resource-collection>
            <web-resource-name>Protected Area</web-resource-name>
            <url-pattern>*.jsf</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
        </web-resource-collection>
    </security-constraint>
    
    希望这有帮助

    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>OUR_AUTH_NAME_DEFINED_IN_login-config.xml</realm-name>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/login.jsp?invalidUser=true</form-error-page>
        </form-login-config>
    </login-config>