<form-error-page>使用j_security_check无法使用weblogic默认身份验证</form-error-page>

时间:2013-08-21 18:00:16

标签: jsf weblogic oracle-adf j-security-check

最近我们的JSF项目从tomcat迁移到weblogic服务器。在tomcat版本中,我们使用Spring安全性进行身份验证。在weblogic中,我们使用容器管理的身份验证机制执行身份验证。

一切正常,除非j_security_check身份验证失败,视图不会定向到web.xml的form-error-page元素中定义的错误页面,而是重新加载loginPage.jspx页面。

以下是从我的web.xml剪下来的

<login-config>  
    <auth-method>FORM</auth-method>     
    <realm-name>MySecurityRealm</realm-name>
    <form-login-config>
        <form-login-page>/faces/loginPage.jspx</form-login-page>
        <form-error-page>/faces/errorPage.jspx</form-error-page>            
    </form-login-config>
</login-config>

和登录方法的代码片段如下 -

public String login() throws IOException, ServletException {
    ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
    HttpSession session = (HttpSession) context.getSession(false);
    session.removeAttribute("oracle.adf.share.http.HttpSessionScopeAdapter");
    RequestDispatcher dispatcher = ((ServletRequest) context.getRequest()).getRequestDispatcher("/j_security_check");
    dispatcher.forward(((ServletRequest) context.getRequest()), (ServletResponse) context.getResponse());
    FacesContext.getCurrentInstance().completeResponse();
}

任何建议都会有所帮助。感谢。

0 个答案:

没有答案