Skip to content

Commit a8cc6d9

Browse files
aq-ikhwa-techludomikula
authored andcommitted
Add handling for geolocation data for audit logs
1 parent e5afe8f commit a8cc6d9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/api-service/lowcoder-infra/src/main/java/org/lowcoder/infra/event/AbstractEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public abstract class AbstractEvent implements LowcoderEvent
1717
protected final String userId;
1818
protected final String sessionHash;
1919
protected final Boolean isAnonymous;
20+
private final String ipAddress;
2021
protected Map<String, Object> details;
2122

2223
public Map<String, Object> details()

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/util/ApiCallEventPublisher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Object handleAPICallEvent(ProceedingJoinPoint joinPoint) throws Throwable
6464
}
6565
MultiValueMap<String, String> headers = writableHttpHeaders(request.getHeaders());
6666
headers.remove("Cookie");
67-
headers.remove("X-Real-IP");
67+
String ipAddress = headers.remove("X-Real-IP").stream().findFirst().get();
6868
APICallEvent event = APICallEvent.builder()
6969
.userId(orgMember.getUserId())
7070
.orgId(orgMember.getOrgId())
@@ -75,6 +75,7 @@ public Object handleAPICallEvent(ProceedingJoinPoint joinPoint) throws Throwable
7575
.requestUri(request.getURI().getPath())
7676
.headers(headers)
7777
.queryParams(request.getQueryParams())
78+
.ipAddress(ipAddress)
7879
.build();
7980
event.populateDetails();
8081
applicationEventPublisher.publishEvent(event);

0 commit comments

Comments
 (0)