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

Upgrade okhttp3 to latest #231

Closed
wants to merge 9 commits into from
Closed
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ test {
}

dependencies {
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.9'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.0.pr3'
implementation 'commons-codec:commons-codec:1.13'
implementation 'com.auth0:java-jwt:3.10.3'

testImplementation 'org.bouncycastle:bcprov-jdk15on:1.65'
testImplementation 'org.mockito:mockito-core:2.28.2'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.9.1'
testImplementation 'com.squareup.okhttp3:mockwebserver:3.14.9'
testImplementation 'org.hamcrest:hamcrest-core:1.3'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private AuthorizeUrlBuilder(HttpUrl url, String clientId, String redirectUri) {
builder = url.newBuilder()
.addPathSegment("authorize")
.addEncodedQueryParameter("redirect_uri", redirectUri)
.addQueryParameter("client_id", clientId);
.addEncodedQueryParameter("client_id", clientId);
withParameter("response_type", "code");
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public AuthorizeUrlBuilder withParameter(String name, String value) {
*/
public String build() {
for (Map.Entry<String, String> p : parameters.entrySet()) {
builder.addQueryParameter(p.getKey(), p.getValue());
builder.addEncodedQueryParameter(p.getKey(), p.getValue());
}
return builder.build().toString();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/auth0/client/auth/LogoutUrlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private LogoutUrlBuilder(HttpUrl url, String clientId, String returnToUrl) {
.addPathSegment("logout")
.addEncodedQueryParameter("returnTo", returnToUrl);
if (clientId != null) {
builder.addQueryParameter("client_id", clientId);
builder.addEncodedQueryParameter("client_id", clientId);
}
}

Expand All @@ -66,7 +66,7 @@ public LogoutUrlBuilder useFederated(boolean federated) {
*/
public String build() {
for (Map.Entry<String, String> p : parameters.entrySet()) {
builder.addQueryParameter(p.getKey(), p.getValue());
builder.addEncodedQueryParameter(p.getKey(), p.getValue());
}
return builder.build().toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Request<List<Token>> getBlacklist(String audience) {
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/blacklists/tokens")
.addQueryParameter("aud", audience)
.addEncodedQueryParameter("aud", audience)
.build()
.toString();
CustomRequest<List<Token>> request = new CustomRequest<>(client, url, "GET", new TypeReference<List<Token>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Request<ClientGrantsPage> list(ClientGrantsFilter filter) {
.addPathSegments("api/v2/client-grants");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/auth0/client/mgmt/ClientsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Request<ClientsPage> list(ClientFilter filter) {
.addPathSegments("api/v2/clients");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/auth0/client/mgmt/ConnectionsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Request<ConnectionsPage> listAll(ConnectionFilter filter) {
.addPathSegments("api/v2/connections");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -67,7 +67,7 @@ public Request<List<Connection>> list(ConnectionFilter filter) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
//This check below is to prevent JSON parsing errors
if (!e.getKey().equalsIgnoreCase("include_totals")) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ public Request<Connection> get(String connectionId, ConnectionFilter filter) {
.addPathSegment(connectionId);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -190,7 +190,7 @@ public Request deleteUser(String connectionId, String email) {
.addPathSegments("api/v2/connections")
.addPathSegment(connectionId)
.addPathSegment("users")
.addQueryParameter("email", email)
.addEncodedQueryParameter("email", email)
.build()
.toString();
VoidRequest request = new VoidRequest(this.client, url, "DELETE");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Request<List<DeviceCredentials>> list(DeviceCredentialsFilter filter) {
.addPathSegments("api/v2/device-credentials");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Request<EmailProvider> get(FieldsFilter filter) {
.addPathSegments("api/v2/emails/provider");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/auth0/client/mgmt/GrantsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public Request<GrantsPage> list(String userId, GrantsFilter filter) {
HttpUrl.Builder builder = baseUrl
.newBuilder()
.addPathSegments("api/v2/grants")
.addQueryParameter("user_id", userId);
.addEncodedQueryParameter("user_id", userId);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}

Expand All @@ -68,7 +68,7 @@ public Request<List<Grant>> list(String userId) {
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/grants")
.addQueryParameter("user_id", userId)
.addEncodedQueryParameter("user_id", userId)
.build()
.toString();
CustomRequest<List<Grant>> request = new CustomRequest<>(client, url, "GET", new TypeReference<List<Grant>>() {
Expand Down Expand Up @@ -111,7 +111,7 @@ public Request deleteAll(String userId) {
final String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/grants")
.addQueryParameter("user_id", userId)
.addEncodedQueryParameter("user_id", userId)
.build()
.toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/auth0/client/mgmt/LogEventsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Request<LogEventsPage> list(LogEventFilter filter) {
if (KEY_QUERY.equals(e.getKey())) {
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
} else {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Request<ResourceServersPage> list(ResourceServersFilter filter) {
.addPathSegments("api/v2/resource-servers");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/auth0/client/mgmt/RolesEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Request<RolesPage> list(RolesFilter filter) {
.addEncodedPathSegments("api/v2/roles");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -160,7 +160,7 @@ public Request<UsersPage> listUsers(String roleId, PageFilter filter) {
.addEncodedPathSegments("users");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -217,7 +217,7 @@ public Request<PermissionsPage> listPermissions(String roleId, PageFilter filter
.addEncodedPathSegments("permissions");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/auth0/client/mgmt/RulesEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Request<RulesPage> listAll(RulesFilter filter) {
.addPathSegments("api/v2/rules");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -65,7 +65,7 @@ public Request<List<Rule>> list(RulesFilter filter) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
//This check below is to prevent JSON parsing errors
if (!e.getKey().equalsIgnoreCase("include_totals")) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public Request<Rule> get(String ruleId, RulesFilter filter) {
.addPathSegment(ruleId);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/auth0/client/mgmt/StatsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public Request<List<DailyStats>> getDailyStats(Date from, Date to) {
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/stats/daily")
.addQueryParameter("from", dateFrom)
.addQueryParameter("to", dateTo)
.addEncodedQueryParameter("from", dateFrom)
.addEncodedQueryParameter("to", dateTo)
.build()
.toString();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/auth0/client/mgmt/TenantsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Request<Tenant> get(FieldsFilter filter) {
.addPathSegments("api/v2/tenants/settings");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/auth0/client/mgmt/UserBlocksEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Request<UserBlocks> getByIdentifier(String identifier) {
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/user-blocks")
.addQueryParameter("identifier", identifier)
.addEncodedQueryParameter("identifier", identifier)
.build()
.toString();
CustomRequest<UserBlocks> request = new CustomRequest<>(client, url, "GET", new TypeReference<UserBlocks>() {
Expand All @@ -54,7 +54,7 @@ public Request deleteByIdentifier(String identifier) {
String url = baseUrl
.newBuilder()
.addPathSegments("api/v2/user-blocks")
.addQueryParameter("identifier", identifier)
.addEncodedQueryParameter("identifier", identifier)
.build()
.toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/auth0/client/mgmt/UsersEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public Request<List<User>> listByEmail(String email, FieldsFilter filter) {
HttpUrl.Builder builder = baseUrl
.newBuilder()
.addPathSegments("api/v2/users-by-email");
builder.addQueryParameter("email", email);
builder.addEncodedQueryParameter("email", email);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}

Expand Down Expand Up @@ -85,7 +85,7 @@ public Request<UsersPage> list(UserFilter filter) {
if (KEY_QUERY.equals(e.getKey())) {
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
} else {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public Request<User> get(String userId, UserFilter filter) {
.addPathSegment(userId);
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -241,7 +241,7 @@ public Request<LogEventsPage> getLogEvents(String userId, LogEventFilter filter)
.addPathSegment("logs");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -386,7 +386,7 @@ public Request<PermissionsPage> listPermissions(String userId, PageFilter filter
.addPathSegments("permissions");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down Expand Up @@ -473,7 +473,7 @@ public Request<RolesPage> listRoles(String userId, PageFilter filter) {
.addPathSegments("roles");
if (filter != null) {
for (Map.Entry<String, Object> e : filter.getAsMap().entrySet()) {
builder.addQueryParameter(e.getKey(), String.valueOf(e.getValue()));
builder.addEncodedQueryParameter(e.getKey(), String.valueOf(e.getValue()));
}
}
String url = builder.build().toString();
Expand Down