Friday, December 2, 2016

Test Two-Way-SSL Using Postman

Introduction

This short post explains how to test two-way-ssl using postman. The same principle applies to SoapUI. For details about how to create two-way-ssl service will be explained in later post.

Assumption

  1. You have client.keystore.jks and client.truststore.jks.
  2. You have tested both file using restclient

JKS To PCS12

keytool -importkeystore 
     -srckeystore client.keystore.jks 
     -destkeystore client.p12 
     -srcstoretype JKS 
     -deststoretype PKCS12 
     -deststorepass clientpass 
     -srcstorepass clientpass 
     -srcalias mule-client 
     -destalias mule-client

Import client.p12 To KeyChain

Open KeyChain Access (MacOs)
File -> Import Items
Now Search for the alis "mule-client"

Test Using Postman

In my case, I use this url for two ssl: https://localhost:8543/twoway. When I send a POST request, postman will as certificates to send to the server as the following: Choose "localhost" one.

Test Using curl

Local Host Test


URL: https://localhost:8543/twoway

curl -k --cert client.p12:clientpass \
     -X POST -H "Content-Type: application/json" \
     -d '{"name": "Gary Liu"}' \
      https://localhost:8543/twoway

Test For CloudHub

CloudHub behave different for two-ssl. The port will be 8082, regardless what you set in the file of mule.dev.properties
URL: https://mule-worker-twowayssl-poc.cloudhub.io:8082/twoway
curl -k --cert client.p12:clientpass \
     -X POST -H "Content-Type: application/json" \
     -d '{"name": "Gary Liu"}' \
     https://mule-worker-twowayssl-poc.cloudhub.io:8082/twoway

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...