Long userId = null;
List groups = null;
Visibility v = null;
LOGGER.debug("looking for UAK in request");
UAK uak = null;
try {
if ((uak = (UAK) request.getAttribute(UAK_KEY)) != null) {
LOGGER.debug("UAK found in request "+uak);
return uak;
}
LOGGER.debug("looking for UAK in session");
HttpSession s = request.getSession();
if (s!=null) {
if ((uak = (UAK) s.getAttribute(UAK_KEY)) != null) {
LOGGER.debug("UAK found in Session "+uak);
return uak;
} else {
if (s.getAttribute(Parameters.SESSION_USER_REGISTRED) != null) {
userName = (String)s.getAttribute(Parameters.SESSION_USER_NAME);
userPass = (String)s.getAttribute(Parameters.SESSION_USER_PASS);
machineIdent = (String)s.getAttribute(Parameters.SESSION_USER_MACHINE_IDENT);
userKey = (String)s.getAttribute(Parameters.SESSION_USER_KEY);
pluginVersion = (String)s.getAttribute(Parameters.SESSION_PLUGIN_VERSION);
userId = (Long)s.getAttribute(Parameters.SESSION_USER_ID);
groups = (List)s.getAttribute(Parameters.SESSION_USER_GROUPS);
v = (Visibility)s.getAttribute(Parameters.SESSION_PUBLISH_VISIBILITY_RIGHT);
}
}
}
if (userName==null || userPass==null || machineIdent==null || userKey==null || userId == null || groups == null || v == null || pluginVersion == null) {
// we try to get information from the request
LOGGER.debug("No UAK found in Request/Session and no user registered : Creating UAK from request paramters.");
Map p = ServletHelper.getParametersAsString(request);
uak = getUAK(p);
LOGGER.debug("UAK created from request parameters : " + uak);
} else {
LOGGER.debug("No UAK found in Request/Session, but user registered : Creating UAK from user registration information.");
uak = new UAK(userName, userPass, machineIdent, userId, groups, v, pluginVersion, userKey);
}
return uak;
} finally {
// store UAK found in request