Added SSL Validation Override and CA Selection
- Added fields to login page to a) disable ssl validation or b) select a custom Certificate Authority certificate to use with the server. - Changed visibility of widgets on login page from INVISIBLE to GONE so they don't take up space while hidden (since this was causing weird spacing issues with the new fields). - Added state to settings to store ssl validation choice or certificate data. - Added fields to various HTTP methods to disable ssl validation or set valid certificate authority if either setting is enabled.
This commit is contained in:
@@ -15,15 +15,9 @@ import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
|
||||
public class WebSocketConnection {
|
||||
private OkHttpClient client;
|
||||
private static final JSON gson = Utils.json();
|
||||
|
||||
private final OkHttpClient client =
|
||||
new OkHttpClient.Builder()
|
||||
.readTimeout(0, TimeUnit.MILLISECONDS)
|
||||
.pingInterval(1, TimeUnit.MINUTES)
|
||||
.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
private final Handler handler = new Handler();
|
||||
private int errorCount = 0;
|
||||
|
||||
@@ -38,7 +32,15 @@ public class WebSocketConnection {
|
||||
private Runnable onReconnected;
|
||||
private boolean isClosed;
|
||||
|
||||
WebSocketConnection(String baseUrl, String token) {
|
||||
WebSocketConnection(String baseUrl, boolean validateSSL, String cert, String token) {
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder()
|
||||
.readTimeout(0, TimeUnit.MILLISECONDS)
|
||||
.pingInterval(1, TimeUnit.MINUTES)
|
||||
.connectTimeout(10, TimeUnit.SECONDS);
|
||||
Utils.applySslSettings(builder, new Utils.SSLSettings(validateSSL, cert));
|
||||
|
||||
client = builder.build();
|
||||
|
||||
this.baseUrl = baseUrl;
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user