I'm trying to set up authentication by sending headers with user info to orbeon. I am using a servlet class to test if the username and password is a valid combo, and then I am using a filter to set the headers. I have been tinkering with this for some time now and I can't figure out how to get the info to go back to orbeon, signalling that this is a valid username/password combo. My goal is to first validate just one combo, then to work on connecting it to a database.
Here is a snippet of what I have in the filter for if the authentication is correct:
* I do call doFilter before any of this executes
if (validityFlag.contentEquals("valid")) {
//This is the correct way that I can save the username
httpResponse.addHeader("Orbeon-Username", session.getAttribute("Orbeon-Username").toString());
httpResponse.addHeader("Orbeon-Roles", session.getAttribute("Orbeon-Roles").toString());
httpResponse.setStatus(200);
/*
RequestDispatcher dispatcher = httpRequest.getRequestDispatcher("/secretPage.jsp");
dispatcher.include(httpRequest, httpResponse); //forward gave scala errors, so im using include
*/
//httpResponse.sendRedirect("/orbeon/fr/");
}
As you can see, I commented out the RequestDispatcher object because I read in another user's discussion that this was not something I needed to do.
Also, here is a snipped of what I have in my servlet class:
I commented out the last line because I found that when it was included, the filter seemed to be skipped entirely.
if (username.equals(SECRET_USERNAME)
&& password.equals(SECRET_PASSWORD)) {
HttpSession session = request.getSession(true);
session.setMaxInactiveInterval(5 * 60); // 5 min
session.setAttribute("validityFlag", "valid");
session.setAttribute("Orbeon-Username", username);
session.setAttribute("Orbeon-Roles", "WALD-tax-form-runner");
response.addHeader("Orbeon-Username",
session.getAttribute("Orbeon-Username").toString());
response.addHeader("Orbeon-Roles",
session.getAttribute("Orbeon-Roles").toString());
// response.sendRedirect("/orbeon/fr/");
}
I apologize if this is too novice of a question for this forum. I would greatly appreciate any suggestions, advice, or critique!\
Thanks
Christina