SSL Client Authentication Plug-in for Parallec. One line to help you set the SSL context for Client Authentication. Import it and add the jks file and the text file containing the private key pass to userdata folder. You will be good to go with. You may also provide customized absolute or relative path to load the keystore.
###Maven/Gradle Import Along with your parallec import, also add: #####Maven
<dependency>
<groupId>io.parallec</groupId>
<artifactId>parallec-plugin-http-clientauth</artifactId>
<version>0.9.0</version>
</dependency>
#####Gradle
compile 'io.parallec:parallec-plugin-http-clientauth:0.9.0'
###Versions
- The latest production-ready version is
0.9.x
, where we use in production. - On async-http-client 2.x The Parallec plugin version using more up-to-date
async-http-client
(currently using AHC version2.0.15
) is0.20.0-SNAPSHOT
. This version requires JDK8 due to AHC 2.x and should be used with the parallec-core with the same version0.20.0-SNAPSHOT
, details please check #37.
##How to use
-
Add the .jks file and rename it to "keystore.jks" ; Add a text file only containing the passphrase for the private key and rename it to "keypass"; Put both file under userdata folder in your project directory
-
Insert this line after initializing the ParallelClient instance before using it:
ParallelClient pc= new ParallelClient();
ClientAuthAdaptor.getInstance().enableClientAuth(pc);
If need to overload the path, please call the same function with additional path parameters (absolute or relative path to project).
ParallelClient pc= new ParallelClient();
ClientAuthAdaptor.getInstance().enableClientAuth(parallec,
"/Users/yourname/git/parallec/userdata/keypass",
"/Users/yourname/git/parallec/userdata/keystore.jks"
); // mutual auth with customized path
####Change Algorithm
Default algorithm is "TLS". Review available algorithms here.
The same API with different arguments can change the algorithm too. Details please refer to the javadoc.
enableClientAuth(ParallelClient pc, String algorithm)
enableClientAuth(ParallelClient pc,
String privKeyPasshraseFilePath, String keystoreFilePath,
String algorithm, boolean verifyServerCert)
###Shutdown HttpClientFactory
The enableClientAuth will automatic create the Async HTTP Client factory which loads the key pairs. If need to close the clients, call
ClientAuthAdaptor.getInstance().shutdown();
For more details please check: src/main/java/io/parallec/plugin/http/clientauth/ClientAuthAdaptor.java
Yuanteng (Jeff) Pei
Your name here
Thanks for trying Parallec.io. Please submit a git issue for any questions you have.
Code licensed under Apache License v2.0
© 2015 eBay Software Foundation