final Integer userId = NumberHelper.parseInteger(req.getParameter("user"));
if (userId == null) {
log.error("Bad request, parameter user is not an integer: " + req.getQueryString());
return;
}
final Registry registry = Registry.instance();
user = registry.getUserGroupCache().getUser(userId);
if (user == null) {
log.error("Bad request, user not found: " + req.getQueryString());
return;
}
PFUserContext.setUser(user);
MDC.put("user", user.getUsername());
final String decryptedParams = registry.getDao(UserDao.class).decrypt(userId, encryptedParams);
if (decryptedParams == null) {
log.error("Bad request, can't decrypt parameter q (may-be the user's authentication token was changed): " + req.getQueryString());
return;
}
final Map<String, String> params = StringHelper.getKeyValues(decryptedParams, "&");