not working with weblogic default authentication using j_security_check
Recently our JSF project is migrated from tomcat to weblogic server. In
tomcat version we were using Spring security for authentication. In
weblogic we are performing authentication using weblogic
defaultauthentication mechanism.
Everything is working fine except in the case when the j_security_check
authentication fails, the view is not directed to error page defined in
form-error-page element of web.xml, instead the loginPage.jspx page is
reloaded.
Below is the snipped from my 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>
and code snippet of the login method is as below -
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();
}
Any suggestion will be helpful. Thanks.
No comments:
Post a Comment