%@ page language="java" session = "false" %>
<%@ page import="gov.va.med.authentication.kernel.ConfigurationVO,
gov.va.med.authentication.kernel.LoginController,
weblogic.servlet.security.ServletAuthentication;"%>
<%
// Turn off cache so that a user cannot navigate back to the login page after post-login
response.setHeader("Cache-Control","no-store, no-cache, must-revalidate"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
Login Page
<%
/*
It could be argued that using code within JSP is not a good thing, but for such a small app it's
completely acceptable. If we were working with an HTML designer, the separation would be good. But then
JSTL would be needed and with that we'd introduce some version of that as a dependency, which is preferably
avoided given because we're embedded, we force these dependencies on the containing application as well.
*/
ConfigurationVO kaajeeEnv = ConfigurationVO.getInstance();
/*
Here if the protocol is 'http', I redirected the user to the same page using 'https' protocol.
*/
if(request.getParameter("relogin")!=null){
HttpSession hSess = request.getSession(false);
if(hSess == null) {
StringBuffer sbsession = new StringBuffer(request.getContextPath());
sbsession.append("/login/SessionTimeout.jsp");
response.sendRedirect(sbsession.toString());
return;
}
}
HttpSession hSess = request.getSession(true);
String desiredSchema = "https"; //or http
String usingSchema = request.getScheme();
if(kaajeeEnv.getHTTPSPortLis() != null ) {
if(!desiredSchema.equals(usingSchema)) {
StringBuffer sburl = request.getRequestURL();
java.net.URL url = new java.net.URL(sburl.toString());
hSess = request.getSession(true);
Integer portValue = new Integer(url.getPort());
hSess.setAttribute("portnumber",portValue);
String urlString = desiredSchema+"://"+ url.getHost() +":"+kaajeeEnv.getHTTPSPortLis()+url.getPath();
response.sendRedirect(response.encodeRedirectURL(urlString));
return;
}
}
%>