• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form based authentication in java server faces.

 
raghavendra pattar ramdurg
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using form based authentication in JSF .

I am not able to display the page.

I have this security constraint in my web.xml

<security-constraint>
<display-name>Example Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/jsp/WorkingZone.jsp</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/Login/login.jsp</form-login-page>
<form-error-page>/Login/error.jsp</form-error-page>
</form-login-config>
</login-config>

WorkingZone.jsp is a jsp page with JSF components.Which can only be invoked with faces context.

I am using JDBCRealm

For the valid user I am getting this error------>

HTTP Status 400 - Invalid direct reference to form login page

--------------------------------------------------------------------------------

type Status report

message Invalid direct reference to form login page

description The request sent by the client was syntactically incorrect (Invalid direct reference to form login page).

--------------------------------------------------------------------------------


How can I access my jsf page. I have tried a lot with different uniform resource locator patterns.But still the protected file is not invoked.

Please give me the solution .
 
Denise Smith
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To set up the page to login to you have to be sure to include the faces servlet in the form-login-page


<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/faces/loginDo.jsp</form-login-page>
<form-error-page>/errMsgs/loginEmsg.jsp</form-error-page>
</form-login-config>
</login-config>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic