黑白名单的具体实现
2014-08-19 17:29
113 查看
如果是黑名单就直接跳向错误提示页面,如果是白名单直接验证通过
//黑白名单功能实现
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);
}
//黑白名单功能实现
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);
}
相关文章推荐
- DDoS攻防战(三):ip黑白名单防火墙frdev的原理与实现
- DDoS攻防战(三):ip黑白名单防火墙frdev的原理与实现
- Winform开发框架之权限管理系统改进的经验总结(3)-系统登录黑白名单的实现
- nginx+lua实现IP黑白名单机制
- 详解Android 利用Iptables实现网络黑白名单(防火墙)
- Apple Configurator用法(MDM黑白名单实现)
- DDoS攻防战(三):ip黑白名单防火墙frdev的原理与实现
- nginx/iptables动态IP黑白名单实现方案
- rspamd 里面通过lua脚本实现每用户黑白名单
- DDoS攻防战(三):ip黑白名单防火墙frdev的原理与实现
- 基于bitset实现手机号的黑白名单方案
- ASP.NET站点跨子域名单点登陆(SSO)的实现
- Java2下Applet数字签名具体实现方法
- 解析Cookie欺骗实现过程及具体应用
- fd_set具体是怎样实现的
- ASP.NET站点跨子域名单点登陆(SSO)的实现
- [导入]C#委托的具体实现方法
- ASP.NET站点跨子域名单点登陆(SSO)的实现
- 解析Cookie欺骗实现过程及具体应变方法
- dup系统调用的具体实现祥解