Permalink
Browse files

Started trustStore management (not finished)

Also, dor now returns the last value, instead of false, if all values
are falsey. This allows the user to dictate the exact type of the falsey
value, instead of forcing a boolean.
  • Loading branch information...
LadyCailin committed Sep 26, 2017
1 parent f0c9015 commit b7607a5809cb42adf3aa6b4cc96b7a9ab025c28e
@@ -4,6 +4,7 @@
import java.net.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -23,6 +24,9 @@
private String rawParameter;
private File downloadTo;
private boolean blocking = false;
private boolean disableCertChecking = false;
private boolean useDefaultTrustStore = true;
private LinkedHashMap<String, String> trustStore = new LinkedHashMap<>();
/**
*
@@ -266,4 +270,70 @@ public boolean getBlocking() {
return this.blocking;
}
/**
* Sets whether or not cert checking is disabled. If this is true, NO
* certificate checking is done, and all certificates will be considered valid.
* If this is true, {@link #setUseDefaultTrustStore(boolean)} and {@link #setTrustStore(java.util.Map)}
* are ignored.
* @param check
* @return
*/
public RequestSettings setDisableCertChecking(boolean check) {
this.disableCertChecking = check;
return this;
}
/**
* Returns whether or not the trust store should be disabled. Default
* is false.
* @return
*/
public boolean getDisableCertChecking() {
return this.disableCertChecking;
}
/**
* Sets whether or not to use the default trust store. If false, then only certificates registered using
* {@link #setTrustStore(java.util.Map)} will be accepted. If this is false, and {@link #setTrustStore(java.util.Map)}
* is false, this effectively prevents any ssl connections.
* @param useDefaultTrustStore
* @return
*/
public RequestSettings setUseDefaultTrustStore(boolean useDefaultTrustStore) {
this.useDefaultTrustStore = useDefaultTrustStore;
return this;
}
/**
* Returns whether or not the default trust store should be used.
* @return
*/
public boolean getUseDefaultTrustStore() {
return this.useDefaultTrustStore;
}
/**
* Sets the trust store. Values should be in the form: "02 79 AB D6 97 19 A2 CB E8 79 11 B2 7F AF 8D": "SHA-256"
* where the key is the fingerprint, and the value is the encryption scheme. Note that the map is cloned, and
* the original map is not used.
* @param trustStore The trust store to use
* @return
*/
public RequestSettings setTrustStore(LinkedHashMap<String, String> trustStore) {
this.trustStore = new LinkedHashMap<>(trustStore);
return this;
}
/**
* Returns the trust store in use. Note that the map is cloned, and the original map is not used.
* @return
*/
public LinkedHashMap<String, String> getTrustStore() {
return new LinkedHashMap<>(trustStore);
}
}
Oops, something went wrong.

0 comments on commit b7607a5

Please sign in to comment.