1:补充向阀门中添加特殊属性的业务
2:修改request获取ip的方式(前面接的有nginx直接用request.getRemoteAddr无法获取到)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -22,6 +23,11 @@ public class NtcCollectRadiusLog extends LogEntity<NtcCollectRadiusLog> {
|
||||
protected String framedIp;
|
||||
@ApiModelProperty(value="用户名", required=true)
|
||||
protected String account;
|
||||
|
||||
protected String searchNasIp;//ISN接入的IP
|
||||
protected String searchFramedIp;//服务器下发的用户地址
|
||||
protected String searchAccount;//用户名
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
@@ -46,6 +52,27 @@ public class NtcCollectRadiusLog extends LogEntity<NtcCollectRadiusLog> {
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchNasIp() {
|
||||
return searchNasIp;
|
||||
}
|
||||
public void setSearchNasIp(String searchNasIp) {
|
||||
this.searchNasIp = searchNasIp;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchFramedIp() {
|
||||
return searchFramedIp;
|
||||
}
|
||||
public void setSearchFramedIp(String searchFramedIp) {
|
||||
this.searchFramedIp = searchFramedIp;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchAccount() {
|
||||
return searchAccount;
|
||||
}
|
||||
public void setSearchAccount(String searchAccount) {
|
||||
this.searchAccount = searchAccount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -174,9 +174,24 @@ public class AuditLogThread implements Runnable {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
public static AuditLogThread getNewSaveRequestLogThread(HttpServletRequest request) {
|
||||
AuditLogThread thread = new AuditLogThread();
|
||||
thread.setRemoteAddr(request.getRemoteAddr());
|
||||
thread.setRemoteAddr(getIpAddr(request));
|
||||
thread.setRequestURI(request.getRequestURI());
|
||||
if (request.getMethod().toLowerCase().equals("get")) {
|
||||
thread.setQueryString(request.getQueryString());
|
||||
|
||||
Reference in New Issue
Block a user