如果是黑名单就直接跳向错误提示页面,如果是白名单直接验证通过
//黑白名单功能实现
List<Criterion> criterions = new ArrayList<Criterion>();
criterions.add(Restrictions.eq("mac", mac));
List<BlackList> nodeBlack = blackListService.executeQuery(criterions, null);
List<WhiteList> nodeWhite = whiteListService.executeQuery(criterions, null);
if(nodeBlack!=null){
sendRedirect("../commons/blackList.html");
}
if(nodeWhite!=null){
HttpSession session = super.getSession();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = simpleDateFormat.format(new Date());
token = new MD5Code().getMD5ofStr(nowTime + UUID.randomUUID());
tokens = new Token(token);
String redirectUrl = "http://" + session.getAttribute("gw_address") + ":" + session.getAttribute("gw_port") + "/wifidog/auth?" + "token=" + token + "&url=" + session.getAttribute("url");
logger.info(redirectUrl);
session.setAttribute("gw_address", null);
session.setAttribute("gw_port", null);
session.setAttribute("url", null);
session.setAttribute("title", null);
// 保存token
tokenService.save(tokens);
getSession().setAttribute("loginType", 0);
sendRedirect(redirectUrl);
}