Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1227 add some debug statements to the JWT access in client and… #1228

Merged
merged 1 commit into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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