I have a user authentication JSP that check users against some file and return info if they may or may not see selected application.
Early, I have a small number of such pages and added that user validation code to each checked page. Now, I need to add it to almost all my pages.
Is it possible to involve signon.jsp program globaly for
any page requered from server when session expired?
//-------------MyApplication.jsp ------------------------
....
// Authentication section
String sStrAllowed = null;
if(session.getAttribute("USER")==null)
{
Enumeration en = request.getParameterNames();
String sParam =null;
String sPrmValue = null;
String sTarget = "SignOn.jsp?TARGET=MyApplication.jsp";
StringBuffer sbQuery = new StringBuffer() ;
while (en.hasMoreElements())
{
sParam = en.nextElement().toString();
sPrmValue = request.getParameter(sParam);
sbQuery.append("&" + sParam + "=" + sPrmValue);
}
response.sendRedirect(sTarget + sbQuery.toString());
}
else
{
sUser = session.getAttribute("USER").toString();
sStrAllowed = session.getAttribute("STORE").toString();
}
.....
//---------------------------------------------
Early, I have a small number of such pages and added that user validation code to each checked page. Now, I need to add it to almost all my pages.
Is it possible to involve signon.jsp program globaly for
any page requered from server when session expired?
//-------------MyApplication.jsp ------------------------
....
// Authentication section
String sStrAllowed = null;
if(session.getAttribute("USER")==null)
{
Enumeration en = request.getParameterNames();
String sParam =null;
String sPrmValue = null;
String sTarget = "SignOn.jsp?TARGET=MyApplication.jsp";
StringBuffer sbQuery = new StringBuffer() ;
while (en.hasMoreElements())
{
sParam = en.nextElement().toString();
sPrmValue = request.getParameter(sParam);
sbQuery.append("&" + sParam + "=" + sPrmValue);
}
response.sendRedirect(sTarget + sbQuery.toString());
}
else
{
sUser = session.getAttribute("USER").toString();
sStrAllowed = session.getAttribute("STORE").toString();
}
.....
//---------------------------------------------