From 37bfb1ef2358e51a422b21a475f731b989359c52 Mon Sep 17 00:00:00 2001 From: Steve Hu Date: Wed, 28 Feb 2018 13:12:23 -0500 Subject: [PATCH] fixes #31 add subject_claims and access_claims in auditInfo attachment --- .../src/main/java/com/networknt/security/JwtVerifyHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swagger-security/src/main/java/com/networknt/security/JwtVerifyHandler.java b/swagger-security/src/main/java/com/networknt/security/JwtVerifyHandler.java index db1289ce..7dadc0ed 100644 --- a/swagger-security/src/main/java/com/networknt/security/JwtVerifyHandler.java +++ b/swagger-security/src/main/java/com/networknt/security/JwtVerifyHandler.java @@ -87,6 +87,7 @@ 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); if(config != null && (Boolean)config.get(ENABLE_VERIFY_SCOPE) && SwaggerHelper.swagger != null) { Operation operation = null; SwaggerOperation swaggerOperation = (SwaggerOperation)auditInfo.get(Constants.SWAGGER_OPERATION_STRING); @@ -130,6 +131,7 @@ public void handleRequest(final HttpServerExchange exchange) throws Exception { JwtClaims scopeClaims = JwtHelper.verifyJwt(scopeJwt); secondaryScopes = scopeClaims.getStringListClaimValue("scope"); auditInfo.put(Constants.SCOPE_CLIENT_ID_STRING, scopeClaims.getStringClaimValue(Constants.CLIENT_ID_STRING)); + auditInfo.put(Constants.ACCESS_CLAIMS, scopeClaims); } catch (InvalidJwtException | MalformedClaimException e) { logger.error("InvalidJwtException", e); Status status = new Status(STATUS_INVALID_SCOPE_TOKEN);