forked from GJWT/javaOIDCMsg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttp.java
More file actions
50 lines (42 loc) · 1.4 KB
/
Http.java
File metadata and controls
50 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package oiccli.HTTP;
import java.util.HashMap;
import java.util.Map;
import oiccli.exceptions.ValueError;
public class Http {
private String caCerts;
private Map<String, Object> requestArgs;
private KeyJar keyJar;
private FileCookieJar cookieJar;
private Object events;
private Object reqCallback;
public Http(String caCerts, boolean shouldVerifySSL, KeyJar keyjar, String clientCert) throws ValueError {
this.caCerts = caCerts;
this.requestArgs = new HashMap() {{
put("allowRedirects", false);
}};
this.keyJar = keyjar; //or KeyJar(verify_ssl=verify_ssl)
this.cookiejar = FileCookieJar();
if (caCerts != null) {
if (!shouldVerifySSL) {
throw new ValueError("conflict: ca_certs defined, but verify_ssl is False");
}
this.requestArgs.put("verify", caCerts);
} else if (shouldVerifySSL) {
this.requestArgs.put("verify", true);
} else {
this.requestArgs.put("verify", false);
}
this.events = null;
this.reqCallback = null;
if (clientCert != null) {
this.requestArgs.put("cert", clientCert);
}
}
public Map<String, String> getCookies() {
Map<String, String> cookiesMap = new HashMap<>();
for (cookieJar.getCookies().)
{
return cookiesMap;
}
}
}