Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package com.yoti.auth;

import com.fasterxml.jackson.annotation.JsonProperty;

public final class CreateAuthenticationTokenResponse {

@JsonProperty("access_token")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please double check that we're doing this on every property of every payload

private String accessToken;

@JsonProperty("token_type")
private String tokenType;

@JsonProperty("expires_in")
private Integer expiresIn;

@JsonProperty("scope")
private String scope;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ private static String encode(String v) {
private byte[] parseResponse(HttpURLConnection httpUrlConnection) throws ResourceException, IOException {
int responseCode = httpUrlConnection.getResponseCode();
if (responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) {
byte[] responseBody = readBody(httpUrlConnection);
byte[] responseBody = readBody(httpUrlConnection.getErrorStream());
throw new ResourceException(responseCode, httpUrlConnection.getResponseMessage(), new String(responseBody));
}
return readBody(httpUrlConnection);
return readBody(httpUrlConnection.getInputStream());
}

private byte[] readBody(HttpURLConnection httpURLConnection) throws IOException {
try (QuietCloseable<InputStream> inputStream = new QuietCloseable<>(httpURLConnection.getInputStream())) {
private byte[] readBody(InputStream httpInputStream) throws IOException {
try (QuietCloseable<InputStream> inputStream = new QuietCloseable<>(httpInputStream)) {
return readChunked(inputStream.get());
}
}
Expand Down