Using Security Constraint in Web - XML File
Using Security Constraint in Web - XML File
<tomcat-users>
----------------------
-------------------------
<role rolename = “fsl”/>
<role rolename = “sls”/>
<role rolename = “bck”/>
<user name = “fcms” password =”fcms” roles =”fls, sls, bck” />
<plug-in className="org.apache.struts.action.SecurePlugIn">
<set-property property="httpPort" value="8080"/>
<set-property property="httpsPort" value="8443"/>
<set-property property="enable" value="true"/>
<set-property property="addSession" value="true"/>
</plug-in>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<action-mappings type="org.apache.struts.config.SecureActionConfig">
Controlling From Front End: This model is useful only when we are using the sessions
through out the application.
By getting the session object the JSP page by writing a scriplet. If it is executing without
any URL copying it will continue. If we copy the URL in to another browser, then session
object become null, if session object is null then we are forwarding it to login page.
To work using above solution : add the following code in the JSP page
function validate()
{
if(document.getElementById(‘user’).value==”null”)
parent.location.href(‘index.html’);
}
<body onload=”validate();”>
APPLIING FILTERS:
I think this is also another approach. Presently testing using filters sir
We Completely worked on Controlling From Frond End , it is almost successful for all
type users except for slssvr. For this user if we copy the url and pasting to another
browser it is displaying the page differently.
Using Security Constraint : it is always ask for user name and password that we gave in
tomcat-users.xml . if we copy url and pasted in another page.
And we are trying to implement SSL for Servlets/JSP based web application also.