userObject = remote.getUserObject(individualId, firstName, lastName, userType);
userObject.setLoginName(username);
// In a certain case we will need a blank rights matrix, so prepare the remote connection now.
AuthorizationHome ah = (AuthorizationHome)CVUtility.getHomeObject("com.centraview.administration.authorization.AuthorizationHome","Authorization");
Authorization authorizationRemote = ah.create();
authorizationRemote.setDataSource(dataSource);
if (remember.equals("on")) {
// the "Remember Me" cookie contains the a string in the format
// "<userName>/<password>". This string is then encrypted.
// We should probably store the SHA1 of the password, this is a major security risk!!
// TODO: encode the SHA1 of the password in the cookie content, and not the password itself.
// and write the corresponding login method to take the SHA1 directly.
String cookieContent = username + "/" + password;
String encodedString = Base64.encode(cookieContent.getBytes());
Cookie rememberMeCookie = new Cookie("CVRMID", encodedString);
// set the expire time - to the largest int possible
rememberMeCookie.setMaxAge(2147483647);
rememberMeCookie.setPath("/");
response.addCookie(rememberMeCookie);
}
// get the real mfrm and put it on the UserObject
mfrm = authorizationRemote.getUserSecurityProfileMatrix(individualId);
up = userObject.getUserPref();
up.setModuleAuthorizationMatrix(mfrm);
userObject.setUserPref(up);
session.setAttribute("userobject",userObject);