From 8d7ef09b91a340aaa6a745a2986ae06e6234524b Mon Sep 17 00:00:00 2001 From: Steve Hu Date: Sun, 18 Oct 2020 17:50:41 -0400 Subject: [PATCH] fixes #142 get callerId from the header and put it into the auditInfo for metrics (#143) --- .../src/main/java/com/networknt/openapi/JwtVerifyHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openapi-security/src/main/java/com/networknt/openapi/JwtVerifyHandler.java b/openapi-security/src/main/java/com/networknt/openapi/JwtVerifyHandler.java index 7357c737..63c9f3e7 100644 --- a/openapi-security/src/main/java/com/networknt/openapi/JwtVerifyHandler.java +++ b/openapi-security/src/main/java/com/networknt/openapi/JwtVerifyHandler.java @@ -100,6 +100,8 @@ public void handleRequest(final HttpServerExchange exchange) throws Exception { auditInfo.put(Constants.CLIENT_ID_STRING, claims.getStringClaimValue(Constants.CLIENT_ID_STRING)); auditInfo.put(Constants.USER_ID_STRING, claims.getStringClaimValue(Constants.USER_ID_STRING)); auditInfo.put(Constants.SUBJECT_CLAIMS, claims); + String callerId = headerMap.getFirst(HttpStringConstants.CALLER_ID); + if(callerId != null) auditInfo.put(Constants.CALLER_ID_STRING, callerId); if(config != null && (Boolean)config.get(ENABLE_VERIFY_JWT_SCOPE_TOKEN) && OpenApiHelper.openApi3 != null) { Operation operation = null; OpenApiOperation openApiOperation = (OpenApiOperation)auditInfo.get(Constants.OPENAPI_OPERATION_STRING);