Skip to content

Commit dfa80b3

Browse files
committed
adding auth support
1 parent bccbfcb commit dfa80b3

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/main/java/com/pubnub/api/PNConfiguration.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
import lombok.Getter;
99
import lombok.Setter;
1010
import lombok.experimental.Accessors;
11+
import okhttp3.Authenticator;
1112

1213
import java.net.Proxy;
14+
import java.net.ProxySelector;
1315
import java.util.UUID;
1416

1517
@Getter
@@ -116,6 +118,10 @@ public class PNConfiguration {
116118
*/
117119
@Setter
118120
private Proxy proxy;
121+
@Setter
122+
private ProxySelector proxySelector;
123+
@Setter
124+
private Authenticator proxyAuthenticator;
119125

120126
/**
121127
* if set, the SDK will alert once the number of messages arrived in one call equal to the threshold

‎src/main/java/com/pubnub/api/managers/RetrofitManager.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ private OkHttpClient createOkHttpClient(int requestTimeout, int connectTimeOut)
5959
httpClient.proxy(pubnub.getConfiguration().getProxy());
6060
}
6161

62+
if (pubnub.getConfiguration().getProxyAuthenticator() != null) {
63+
httpClient.proxySelector(pubnub.getConfiguration().getProxySelector());
64+
}
65+
66+
if (pubnub.getConfiguration().getProxyAuthenticator() != null) {
67+
httpClient.proxyAuthenticator(pubnub.getConfiguration().getProxyAuthenticator());
68+
}
69+
6270
httpClient.addInterceptor(this.signatureInterceptor);
6371

6472
return httpClient.build();

0 commit comments

Comments
 (0)