Skip to content

Commit

Permalink
fixes #1227 add some debug statements to the JWT access in client and…
Browse files Browse the repository at this point in the history
… security modules
  • Loading branch information
stevehu committed May 11, 2022
1 parent fba3766 commit 1467ba3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions client/src/main/java/com/networknt/client/oauth/KeyRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,19 @@ public int getProxyPort() {
public void setProxyPort(int proxyPort) {
this.proxyPort = proxyPort;
}

@Override
public String toString() {
return "KeyRequest{" +
"serverUrl='" + serverUrl + '\'' +
", proxyHost='" + proxyHost + '\'' +
", proxyPort=" + proxyPort +
", serviceId='" + serviceId + '\'' +
", uri='" + uri + '\'' +
", clientId='" + clientId + '\'' +
", clientSecret='" + clientSecret + '\'' +
", enableHttp2=" + enableHttp2 +
", kid='" + kid + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public static Result<TokenResponse> getTokenFromSamlResult(SAMLBearerRequest tok
* @throws ClientException throw exception if communication with the service fails.
*/
public static String getKey(KeyRequest keyRequest) throws ClientException {
if(logger.isDebugEnabled()) logger.debug("keyRequest = " + keyRequest.toString());
return getKey(keyRequest, null);
}

Expand Down Expand Up @@ -333,6 +334,7 @@ public static String getKey(KeyRequest keyRequest, String envTag) throws ClientE
keyClient.sendAsync(request, HttpResponse.BodyHandlers.ofString());
return response.thenApply(HttpResponse::body).get(ClientConfig.get().getTimeout(), TimeUnit.MILLISECONDS);
} catch (Exception e) {
logger.error("Exception:", e);
throw new ClientException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private Map<String, List<JsonWebKey>> getJsonWebKeyMap() {
try {
logger.debug("Getting Json Web Key list from {} for serviceId {}", keyRequest.getServerUrl(), entry.getKey());
String key = OauthHelper.getKey(keyRequest);
logger.debug("Got Json Web Key list from {} for serviceId {}", keyRequest.getServerUrl(), entry.getKey());
logger.debug("Got Json Web Key = ", key);
List<JsonWebKey> jwkList = new JsonWebKeySet(key).getJsonWebKeys();
if (jwkList == null || jwkList.isEmpty()) {
throw new RuntimeException("cannot get JWK from OAuth server");
Expand Down

0 comments on commit 1467ba3

Please sign in to comment.