public class WebSecurityContext
extends java.lang.Object
构造器和说明 |
---|
WebSecurityContext() |
限定符和类型 | 方法和说明 |
---|---|
void |
dealWithCookie(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie[] cookies)
处理cookie
|
DataList<BlockIpEntity> |
getBlockIps(int page,
int count)
获取 ip 黑名单。
|
static WebSecurityContext |
getInstance() |
boolean |
httpAccessControl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
http 访问控制
这边的多线程问题很棘手,加锁会导致在攻击之下更容易宕机,不加锁会导致统计数据有问题。
|
void |
httpHeadersControl(javax.servlet.http.HttpServletResponse response)
http 请求头响应控制
|
void |
loadBlockIpList()
加载黑名单到状态服务器,集群下可能会加载多次(需要一个判空接口)。
|
boolean |
removeBlockIp(java.lang.String ip)
从黑名单缓存移除一个 ip
|
public static WebSecurityContext getInstance()
public void httpHeadersControl(javax.servlet.http.HttpServletResponse response)
response
- 响应public void dealWithCookie(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie[] cookies)
response
- 响应cookies
- cookie数组public void loadBlockIpList() throws java.lang.Exception
java.lang.Exception
public boolean httpAccessControl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
java.lang.Exception
public boolean removeBlockIp(java.lang.String ip) throws java.lang.Exception
ip
- ip 地址java.lang.Exception
- 异常public DataList<BlockIpEntity> getBlockIps(int page, int count) throws java.lang.Exception
java.lang.Exception