cookie.setPath("/");
response.addCookie(cookie);
}
private Session createOrUpdateSession(User user, SessionEntity sessionEntity) {
Session session = null;
if (sessionEntity != null) {
session = DozerHelper.map(sessionEntity, Session.class);
session.setActive(true);
} else {
String md5hash = MD5(user.getEmail() + ":" + user.getPassword());
session = new Session(md5hash, (User) user, true);
sessionEntity = DozerHelper.map(session, SessionEntity.class);
sessionEntity.setId(user.getId());
sessionEntity = sessionRepository.merge(sessionEntity);
session = DozerHelper.map(sessionEntity, Session.class);