mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 21:55:39 +00:00
bug6099: use only client IP for bearer token-based authentication blocking;
client IP is determined from *last* element of X-Forwarded-For which the AWS ALB will append by default, defaulting to the HttpServletRequest's getRemoteAddr().
This commit is contained in:
@@ -29,7 +29,8 @@ public abstract class HttpRequestUtils {
|
||||
final String xForwardedFor = req.getHeader(X_FORWARDED_FOR_HEADER);
|
||||
final String result;
|
||||
if (Util.hasLength(xForwardedFor)) {
|
||||
result = xForwardedFor.split(" +")[0];
|
||||
final String[] ips = xForwardedFor.split(" +");
|
||||
result = ips[ips.length-1];
|
||||
} else {
|
||||
result = req.getRemoteAddr();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user