Skip to content

Commit

Permalink
fixes #150 support cid uid for client_id and user_id for some jwt tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Nov 23, 2020
1 parent 1b14e09 commit a3a69f4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,14 @@ public void handleRequest(final HttpServerExchange exchange) throws Exception {
auditInfo = new HashMap<>();
exchange.putAttachment(AttachmentConstants.AUDIT_INFO, auditInfo);
}
auditInfo.put(Constants.CLIENT_ID_STRING, claims.getStringClaimValue(Constants.CLIENT_ID_STRING));
auditInfo.put(Constants.USER_ID_STRING, claims.getStringClaimValue(Constants.USER_ID_STRING));
String clientId = claims.getStringClaimValue(Constants.CLIENT_ID_STRING);
// try to get the cid as some OAuth tokens name it as cid like Okta.
if(clientId == null) clientId = claims.getStringClaimValue(Constants.CID_STRING);
auditInfo.put(Constants.CLIENT_ID_STRING, clientId);
String userId = claims.getStringClaimValue(Constants.USER_ID_STRING);
// try to get the uid as some OAuth tokens name it as uid like Okta.
if(userId == null) userId = claims.getStringClaimValue(Constants.UID_STRING);
auditInfo.put(Constants.USER_ID_STRING, userId);
auditInfo.put(Constants.SUBJECT_CLAIMS, claims);
String callerId = headerMap.getFirst(HttpStringConstants.CALLER_ID);
if(callerId != null) auditInfo.put(Constants.CALLER_ID_STRING, callerId);
Expand Down

0 comments on commit a3a69f4

Please sign in to comment.