2

I need to do form based authentication in Struts 1.3.10 + Tomcat

As per my understanding once login credentials are submitted, container would cross-check credentials with tomcat-users.xml and based on that forward to success page or error page.

login.jsp

<form action="j_security_check" method="post">
    <input type="text" name="j_username"/>
    <input type="password" name="j_password"/>
    <input type="submit"/>
</form>

web.xml

<login-config>
    <form-login-check>
        <form-login-page>/login.jsp</form-login-page>
        <form-error-page>/error.jsp</form-error-page>
    </form-login-check>
</login-config>

Doubt:

if valid credentials are provided how server goes to success page ? since in login.jsp acion I have given as j_security_check not as normal action which forward to success page.

Roman C
  • 49,761
  • 33
  • 66
  • 176
needreebas
  • 71
  • 2
  • 9
  • http://stackoverflow.com/questions/24241177/tomcat-7-realm-configuration-for-form-based-authentication – Hannes Jan 30 '16 at 06:39

1 Answers1

2

The authentication is provided by the the server, so you should not be concerned how the server is doing it. The requested resource URL is stored somewhere by the server, then directs you to the login page, if your login is successful the requested resource is returned.

When a user submits their name and password, the server determines if the user name and password are those of an authorized user and, if authorized, sends the requested web resource. If the topic of authentication is new to you, please refer to the section Specifying an Authentication Mechanism.

Roman C
  • 49,761
  • 33
  • 66
  • 176