We have an SDK that uses a proxy to connect to the servers.
This requires authentication.
Follows:
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("userName", "S&nh@".toCharArray());
}
});
There is an application that uses our SDK, which also uses proxy to connect to the servers.
I'm afraid that when setting up my authentication, the client will try to connect and use my authentication.
I would like to know if there is another way to authenticate and not to default ???
The implementation follows:
final OkHttpClient client = new OkHttpClient.Builder()
.proxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.123", 1080)))
. build();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(USER, PASSWORD.toCharArray());
}
});
retrofit = new Retrofit.Builder()
.client(client)
.baseUrl(URL)
.addConverterFactory(GsonConverterFactory.create())
.build();