Skip to content

Commit

Permalink
feat: allow to modify the underlying okHttpClient from the BoxApiConn…
Browse files Browse the repository at this point in the history
…ection subclasses

Refs: #1271
  • Loading branch information
davigotxi committed Nov 12, 2024
1 parent 6ea70f7 commit 8c67b7a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/box/sdk/BoxCCGAPIConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonObject;
import java.net.URL;
import okhttp3.OkHttpClient;

/**
* Creates and manages Client Credentials Grant API connection.
Expand Down Expand Up @@ -41,6 +42,14 @@ private BoxCCGAPIConnection(BoxConfig boxConfig) {
super(boxConfig);
}

/**
* {@inheritDoc}
*/
@Override
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
return super.modifyHttpClientBuilder(httpClientBuilder);
}

/**
* Creates connection that authenticates as a Service Account
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import okhttp3.OkHttpClient;
import org.jose4j.jws.AlgorithmIdentifiers;
import org.jose4j.jws.JsonWebSignature;
import org.jose4j.jwt.JwtClaims;
Expand Down Expand Up @@ -108,6 +109,14 @@ public BoxDeveloperEditionAPIConnection(String entityId, DeveloperEditionEntityT
boxConfig.getJWTEncryptionPreferences(), accessTokenCache);
}

/**
* {@inheritDoc}
*/
@Override
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
return super.modifyHttpClientBuilder(httpClientBuilder);
}

/**
* Creates a new Box Developer Edition connection with enterprise token leveraging an access token cache.
*
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/box/sdk/BoxTransactionalAPIConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import okhttp3.OkHttpClient;

/**
* Represents an authenticated transactional connection to the Box API.
Expand All @@ -27,6 +28,14 @@ public BoxTransactionalAPIConnection(String accessToken) {
super.setAutoRefresh(false);
}

/**
* {@inheritDoc}
*/
@Override
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
return super.modifyHttpClientBuilder(httpClientBuilder);
}

/**
* Request a scoped transactional token.
*
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/box/sdk/SharedLinkAPIConnection.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.box.sdk;

import okhttp3.OkHttpClient;

/**
* This API connection uses a shared link (along with an optional password) to authenticate with the Box API. It wraps a
* preexisting BoxAPIConnection in order to provide additional access to items that are accessible with a shared link.
Expand All @@ -24,6 +26,14 @@ public SharedLinkAPIConnection(BoxAPIConnection connection, String sharedLink, S
this.sharedLinkPassword = sharedLinkPassword;
}

/**
* {@inheritDoc}
*/
@Override
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
return super.modifyHttpClientBuilder(httpClientBuilder);
}

@Override
public long getExpires() {
return this.wrappedConnection.getExpires();
Expand Down

0 comments on commit 8c67b7a

Please sign in to comment.