225 Java Web application by FORM based authentication | Tomcat Security Realm | Servlet Tutorial Adv

Published: 13 June 2020
on channel: tech fort
1,796
20

Java Web application by FORM based authentication(Tomcat Security Realm):
Step 1) Define/add "users" in security realm of tomcat-users.xml file
To add users, passwords, roles in myrealm of Tomcat server, we need to write following entries in Tomcat-home\conf\tomcat-users.xml file under tomcat-users tag.

To add users, passwords, roles in "myrealms"("myrealm" is the default realm name of any server) of Tomcat server, we need to write following entries in Tomcat-home\conf\tomcat-users.xml file under tomcat-users tag.

For Tomcat 6.0:
Note : Don't keep space between roles like (roles="admin-gui, manager-gui, manager-script, admin")

- In security realm the usernames , passwords & roles must be added by manually and we can not add them dynamically.

Step 2) Develop web application

71FormSecurityApp: (DDS)
------------------
|
|------login.jsp
|------login_fail.jsp
|------edit.jsp (main web resource pgm, planning ot configure security)
|------WEB-INF
|-----------web.xml

- instead of edit.jsp page we can use EditServlet.java.

login.jsp:
Step 3) Deploy and test web application.