mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 12:17:41 +08:00
Remove X_FORWARDED_FOR header support from Web Client #788
X_FORWARDED_FOR now is not taken into account on authentication
This commit is contained in:
parent
ffec1a6cd7
commit
9741c9481b
@ -128,26 +128,7 @@ public class ConnectionImpl extends EventRouter implements Connection {
|
||||
@Nullable
|
||||
protected String getUserRemoteAddress() {
|
||||
VaadinRequest currentRequest = VaadinService.getCurrentRequest();
|
||||
|
||||
String userRemoteAddress = null;
|
||||
|
||||
if (currentRequest != null) {
|
||||
String xForwardedFor = currentRequest.getHeader("X_FORWARDED_FOR");
|
||||
if (StringUtils.isNotBlank(xForwardedFor)) {
|
||||
String[] strings = xForwardedFor.split(",");
|
||||
String userAddressFromHeader = StringUtils.trimToEmpty(strings[strings.length - 1]);
|
||||
|
||||
if (StringUtils.isNotEmpty(userAddressFromHeader)) {
|
||||
userRemoteAddress = userAddressFromHeader;
|
||||
} else {
|
||||
userRemoteAddress = currentRequest.getRemoteAddr();
|
||||
}
|
||||
} else {
|
||||
userRemoteAddress = currentRequest.getRemoteAddr();
|
||||
}
|
||||
}
|
||||
|
||||
return userRemoteAddress;
|
||||
return currentRequest != null ? currentRequest.getRemoteAddr() : null;
|
||||
}
|
||||
|
||||
protected String makeClientInfo() {
|
||||
|
Loading…
Reference in New Issue
Block a user