Skip to content

Added support for client tls #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<issueManagement>
<system>GitHub Issues</system>
Expand Down Expand Up @@ -48,7 +61,7 @@
<keywords.class>HttpRequestLibrary</keywords.class>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<powermock.version>1.6.5</powermock.version>
<httpclient.version>0.0.1</httpclient.version>
<httpclient.version>0.0.2-SNAPSHOT</httpclient.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,60 @@
@RobotKeywords
public class Session {

@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Basic Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False" })
public void createSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication
.getAuthentication(Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()));
rc.createSession(alias, url, headers, auth, verify);
}
@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Basic Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided. A java keystore may be defined and required a password <file>.jks.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n"
+ "``keypass`` the keystore password to use.\n\n"
+ "``verifyhostname`` verify the host name.\n\n"
+ "``selfsigned`` allow self signed server certificates.\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False", "keypass=None", "verifyhostname=True", "selfsigned=False" })
public void createSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication
.getAuthentication(Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()));
String password = Robot.getParamsValue(params, 7, "");
boolean verifyHost = Boolean.parseBoolean(Robot.getParamsValue(params, 8, "True").toLowerCase());
boolean selfSigned = Boolean.parseBoolean(Robot.getParamsValue(params, 9, "False").toLowerCase());
rc.createSession(alias, url, headers, auth, verify, password, verifyHost, selfSigned);
}

@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Digest Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n")
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False" })
public void createDigestSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication.getAuthentication(
Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()), Authentication.Type.DIGEST);
rc.createSession(alias, url, headers, auth, verify);
}
@RobotKeyword("Create a HTTP session to a server\n\n"
+ "``url`` Base url of the server\n\n"
+ "``alias`` Robot Framework alias to identify the session\n\n"
+ "``headers`` Dictionary of default headers\n\n"
+ "``auth`` List of username & password for HTTP Digest Auth\n\n"
+ "``timeout`` Connection timeout\n\n"
+ "\n\n"
+ "``proxies`` Dictionary that contains proxy urls for HTTP and HTTPS communication\n\n"
+ "``verify`` Whether the SSL cert will be verified. A CA_BUNDLE path can also be provided. A java keystore may be defined and required a password <file>.jks.\n\n"
+ "``debug`` Enable http verbosity option more information.\n\n"
+ "``keypass`` the keystore password to use.\n\n"
+ "``verifyhostname`` verify the host name.\n\n"
+ "``selfsigned`` allow self signed server certificates.\n\n" )
@ArgumentNames({ "alias", "url", "headers={}", "cookies=None", "auth=None", "timeout=None", "proxies=None",
"verify=False", "debug=False", "keypass=None", "verifyhostname=True", "selfsigned=False" })
public void createDigestSession(String alias, String url, String... params) {
RestClient rc = new RestClient();
Map<String, String> headers = Robot.getParamsValue(params, 0, new HashMap<String, String>());
String verify = Robot.getParamsValue(params, 5, "False");
RobotLogger.setDebugToAll(Boolean.parseBoolean(Robot.getParamsValue(params, 6, "False")));
Authentication auth = Authentication.getAuthentication(
Robot.getParamsValue(params, 2, (List<String>) new ArrayList<String>()), Authentication.Type.DIGEST);
String password = Robot.getParamsValue(params, 7, "");
boolean verifyHost = Boolean.parseBoolean(Robot.getParamsValue(params, 8, "True").toLowerCase());
boolean selfSigned = Boolean.parseBoolean(Robot.getParamsValue(params, 9, "False").toLowerCase());
rc.createSession(alias, url, headers, auth, verify, password, verifyHost, selfSigned);
}

}