<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lakmini Wathsala on Medium]]></title>
        <description><![CDATA[Stories by Lakmini Wathsala on Medium]]></description>
        <link>https://medium.com/@wathsalakoralege?source=rss-20da591f96b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GChiRV5-Ac_rXfPg.jpg</url>
            <title>Stories by Lakmini Wathsala on Medium</title>
            <link>https://medium.com/@wathsalakoralege?source=rss-20da591f96b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 18:15:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wathsalakoralege/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Analyzing TCP dumps using TRANSUM Protocol via Wireshark]]></title>
            <link>https://wathsalakoralege.medium.com/analyzing-tcp-dumps-using-transum-protocol-via-wireshark-e97a10610394?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e97a10610394</guid>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[transum]]></category>
            <category><![CDATA[tcpdump]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 15:18:52 GMT</pubDate>
            <atom:updated>2022-12-20T15:18:52.379Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post, I will guide you to analyze TCP dumps using the TRANSUM protocol. This is very useful when you analyze latency/delay in the request/response flows.</p><p>Hope you have already captured a TCP dump for the analysis.</p><p>👉 <strong>Step 1</strong>: Open the TCP dump via Wireshark(File → Open → select the relevant TCP dump).</p><p>👉 <strong>Step 2</strong>: Enable the TRANSUM protocol.</p><p>Navigate to Analyze → Enabled Protocols → Search for “TRANSUM”. Tick the TRANSUM Protocol and click OK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GKtXuoDeVKgRwJUUNtJSFQ.png" /></figure><p>👉 <strong>Step 3</strong>: TRANSUM RTE DATA field will be added as a new field.</p><p>In order to view this field need to select a row of the TCP dump relevant to the TDS protocol(ex: RPC call) or some Application Data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bU6Xxj2U-TBSo4zR532_rQ.png" /></figure><p>👉 <strong>Step 4</strong>: Add the relevant sub fields as columns.</p><p>Right click on the sub field and click ‘Apply as Column’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hMOvpnf6YTfd09BfPPzBA.png" /></figure><p>After adding few TRANSUM RTE columns:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NbqC5AwEfMlTXJiGeZzqQ.png" /></figure><p>👉 <strong>Step 5</strong>(Optional): Add a profile with TRANSUM protocol.</p><p>In the bottom right corner of the Wireshark UI, there will be a profile. Right click on that and select ‘New’ to create a new profile with the above changes. Change the name of the profile and click OK. So that we can select the newly created profile when we need TRANSUM protocol for our analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*44o0CXMGz4tlXXztw0JMMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j8TCf_trO6tXPlabpI7enA.png" /></figure><p>So we are done with enabling TRANSUM protocol. 🌻 🌻 🌻</p><p>Let me guide you on a bit how we can utilize this in our analysis.</p><p>TRANSUM is providing a breakdown of the overall response time of service to identify slow response times from components such as web, application, and database services by detailing the response times of network and service elements. The main objective of TRANSUM is to allow quickly identify the cause of slow response times.</p><p>Between client and service application messages will be flowed, which are called Application Protocol Data Units or APDUs. There are two types of APDU:</p><ul><li>Request APDU flows from client to service</li><li>Response APDU flows from service to client</li></ul><p>Please refer to the following diagram to analyze the response times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*2sA4QDVCHYtEHSLKd7IVww.png" /></figure><p><strong>APDU Response Time</strong><br>The time taken from sending the first Request packet to receiving the last Response packet.</p><p><strong>Service Time</strong><br>The time between receiving the last Request packet and sending the first Response packet can be assumed as the time taken to complete processing.</p><p><strong>Spread Time</strong><br>Time to transfer the multiple request packets and the multiple response packets across the network.</p><p>This model is accurate within the following limitations.</p><ul><li>The APDUs within a stream follow a request-response-request-response pattern — flip-flop mode of operation</li><li>There is no additional level of multiplexing running on top of TCP</li></ul><p>Hope this blog post finds useful for analyzing TCP dumps! 🎄 🎄 🎄 Merry Christmas 🎄🎄🎄</p><p><strong>References</strong></p><p>[1] <a href="https://www.youtube.com/watch?v=QfxWBYSYYKc">https://www.youtube.com/watch?v=QfxWBYSYYKc</a><br>[2] <a href="https://www.cellstream.com/2017/06/18/the-transum-tool-is-now-in-wireshark-2-4/">https://www.cellstream.com/2017/06/18/the-transum-tool-is-now-in-wireshark-2-4/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e97a10610394" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[APIM v4.1.0 revoke the token when invoking an API]]></title>
            <link>https://wathsalakoralege.medium.com/apim-v4-1-0-revoke-the-token-when-invoking-an-api-fc47b05e3e18?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc47b05e3e18</guid>
            <category><![CDATA[revoke]]></category>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[policy]]></category>
            <category><![CDATA[latest]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Thu, 30 Jun 2022 03:08:42 GMT</pubDate>
            <atom:updated>2022-06-30T03:08:42.736Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings to everyone! 💐</p><p>Recently I have come across a requirement of revoking the access token per API request. Here I will share the steps to achieve the same as it can be one of your requirements as well. For this guide, I will refer to the WSO2 latest API Manager release of 4.1.0 with the latest updates.</p><p>🎀 <strong>Prerequisites</strong>:</p><p>WSO2 API Manager v4.1.0 pack — <a href="https://wso2.com/api-manager/#">https://wso2.com/api-manager/#</a> with the latest updates(Mediation/Policy handling has been changed from the GA release)</p><p>🎀 <strong>Configuration</strong>:</p><p>In &lt;APIM-HOME&gt;/repository/conf/deployment.toml file the following changes need to be done.</p><ol><li>This is to preserve authorization header in the messages — <a href="https://apim.docs.wso2.com/en/latest/reference/faq/#how-can-i-add-authentication-headers-to-messages-going-out-of-the-api-gateway-to-the-backend">https://apim.docs.wso2.com/en/latest/reference/faq/#how-can-i-add-authentication-headers-to-messages-going-out-of-the-api-gateway-to-the-backend</a></li></ol><pre>[apim.oauth_config]<br>enable_outbound_auth_header=true</pre><p>2. This will be used to handle the ‘/revoke’ response with content-type of ‘text/html’ of the blocking client — <a href="https://apim.docs.wso2.com/en/latest/design/api-policies/regular-gateway-policies/configuring-message-builders-formatters/#default-message-builders-and-formatters">https://apim.docs.wso2.com/en/latest/design/api-policies/regular-gateway-policies/configuring-message-builders-formatters/#default-message-builders-and-formatters</a></p><pre>[message_builder]<br>text_html = &quot;org.apache.axis2.builder.ApplicationXMLBuilder&quot;</pre><p>3. This will enable XPath 2.0 which needs for xpath function to be used in the mediation.</p><pre>[synapse_properties]<br>&#39;synapse.xpath.dom.failover.enabled&#39;=true</pre><p>🎀 <strong>Steps</strong>:</p><ul><li>With the above configurations restart the APIM server.</li><li>Create, publish and deploy a new API[1],[2],[3].</li><li>Subscribe this API with an Application[4]. You will need the consumer key and secret pair of this Application.</li><li>Save the below policy content to a .xml file(ex: revokeToken.xml). Replace the &lt;Base64 encoded{consumerKey:consumerSecret}&gt; accordingly.</li></ul><pre>&lt;header name=”Authorization” scope=”transport” value=”Basic &lt;Base64 encoded{consumerKey:consumerSecret}&gt;”/&gt;</pre><pre>Ex: &lt;header name=”Authorization” scope=”transport” value=”Basic ajFYUE8yVGdCck92dFBVWk0yd0Y2V0tSa21RYTpReVdLODY2djd2eEdkWTRMb3ZMaF8zOVppNTBh”/&gt;</pre><p>Policy content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a822328935a6d74053833a9666fbabb/href">https://medium.com/media/5a822328935a6d74053833a9666fbabb/href</a></iframe><p>Add this policy to the newly created API by navigating to relevant API → API Configurations → Policies → Add New Policy[5]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pUJlYnjdOvzXAlkviL9GUg.png" /><figcaption>Create new policy window</figcaption></figure><ul><li>After adding the policy we can engage this policy in our required resources by drag and drop the policy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EiIAWZrRzdyOhgWNomu6_g.png" /><figcaption>Adding policy to the resource</figcaption></figure><ul><li>Then Save and Deploy the changes.</li></ul><p>That’s it with the configurations! 🍾 🔆</p><p>When invoking the API for the first time with a new token you will be able to successfully invoke it. With the same token the second time onwards(even within the validity period) you will not be allowed to invoke the API since the token has been already revoked in the previous API invocation. You will be ended with the following response.</p><pre>ERROR - JWTValidator Invalid JWT token. XXXXX&quot;:&quot;RS256&quot;}<br>WARN - APIAuthenticationHandler API authentication failure due to Invalid Credentials</pre><p>Hope this will useful!! ✌️👋</p><p><strong>References</strong>:</p><p>[1] <a href="https://apim.docs.wso2.com/en/latest/design/create-api/create-rest-api/create-a-rest-api/">https://apim.docs.wso2.com/en/latest/design/create-api/create-rest-api/create-a-rest-api/</a><br>[2] <a href="https://apim.docs.wso2.com/en/latest/deploy-and-publish/publish-on-dev-portal/publish-an-api/">https://apim.docs.wso2.com/en/latest/deploy-and-publish/publish-on-dev-portal/publish-an-api/</a><br>[3] <a href="https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/deploy-api/deploy-an-api/">https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/deploy-api/deploy-an-api/</a><br>[4] <a href="https://apim.docs.wso2.com/en/latest/consume/manage-subscription/subscribe-to-an-api/">https://apim.docs.wso2.com/en/latest/consume/manage-subscription/subscribe-to-an-api/</a><br>[5] <a href="https://apim.docs.wso2.com/en/latest/design/api-policies/create-policy/#creating-an-api-specific-policy">https://apim.docs.wso2.com/en/latest/design/api-policies/create-policy/#creating-an-api-specific-policy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc47b05e3e18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS ECS + WSO2 APIM with ELK]]></title>
            <link>https://wathsalakoralege.medium.com/aws-ecs-wso2-apim-with-elk-5da7c285a2de?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5da7c285a2de</guid>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[elk]]></category>
            <category><![CDATA[fargate]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Mon, 20 Dec 2021 16:49:57 GMT</pubDate>
            <atom:updated>2021-12-20T16:49:57.109Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7FcG8Dkz1sA_ZdpICJ92YQ.jpeg" /><figcaption>Courtesy: <a href="https://en.wikipedia.org/wiki/File:Scrum_ASM_Clermont-Saracens.jpg">https://en.wikipedia.org/wiki/File:Scrum_ASM_Clermont-Saracens.jpg</a></figcaption></figure><h3>👐 Deploying WSO2 APIM in AWS ECS cluster</h3><p>WSO2 APIM is a fully open-source API Management solution that can be deployed on-premise, cloud, or hybrid solution. Here we are focusing on APIM deployment in AWS ECS-Fargate Cluster running with docker images.</p><h3>❓What is ELK??</h3><p>“ELK” stands for three open source projects: Elasticsearch, Logstash, and Kibana. Elasticsearch is a distributed, open-source search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured. Logstash is also a free and open server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to a “stash” like Elasticsearch. Kibana is a free and open user interface that lets users visualize data with charts and graphs in Elasticsearch.</p><p>Additionally, there are lightweight, single-purpose data shippers into the ELK Stack equation which is called Beats.</p><h3>🚦 ELK with WSO2 APIM</h3><p>There can be a requirement of analyzing WSO2 logs from a 3rd party or having these logs in a common place. This can be achieved with different options in AWS-based deployment ex: ELK + Beats, AWS FireLens, AWS cloudwatch logs, etc. From this blog post, I will be going through the Option ELK + Beats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*ivW-QcQ4JW-uN1l7QOjtdg.png" /></figure><p>As shown in the above diagram, the API Manager will publish logs to a predefined directory and that directory is mounted into Filebeat. Then Filebeat will stream the new logs to Logstash. In Logstash we can have filters and based on the predefined filters it will decide what logs should be fed into ElasticSearch. When passing logs to ElasticSearch, Logstash has the capability to parameterize the data, so those parameters can be used to query them accordingly. Kibana will be fetching data from ElasticSearch and visualizing them according to the user&#39;s needs. Any custom dashboard can be designed using the defined parameters.</p><h3>🌱 Implementation</h3><h4>✋ Install WSO2 APIM and configure it in the cluster</h4><ul><li>Push the relevant docker image of WSO2 APIM v4.0.0 (from <a href="https://docker.wso2.com/">https://docker.wso2.com/</a>) to the ECR.</li></ul><pre># login to wso2 docker registry<br>docker login docker.wso2.com</pre><pre>#pull updated wso2am image (X=Latest update level)<br>docker pull docker.wso2.com/wso2am:4.0.0.X</pre><pre>#tag docker image with ECR hostname<br>docker tag docker.wso2.com/wso2am:4.0.0.X &lt;aws_account_id&gt;.dkr.ecr.us-east-1.amazonaws.com/wso2am:4.0.0.X</pre><pre>#login to aws ECR<br>aws ecr get-login-password — region us-east-1 | docker login — username AWS — password-stdin &lt;aws_account_id&gt;.dkr.ecr.us-east-1.amazonaws.com</pre><pre>#push image to ECR<br>docker push &lt;aws_account_id&gt;.dkr.ecr.us-east-1.amazonaws.com/wso2am:4.0.0.X</pre><ul><li>That image will be used(as the value for <strong>Image*</strong>) in the AWS ECS Fargate cluster while creating the task definition(in ‘Add Container’).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z3ZVlimCMbawkcflQOiO6g.png" /></figure><p>And we need to add a mount point in the same container to mount the ‘/repository/logs’ directory.</p><ul><li>For that, first, we need to create an EFS(Elastic File System) <a href="https://docs.aws.amazon.com/efs/latest/ug/gs-step-two-create-efs-resources.html">https://docs.aws.amazon.com/efs/latest/ug/gs-step-two-create-efs-resources.html</a></li><li>Then we need to add a volume with that EFS in the task definition.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUwtXHddwOY8kIwoAAOnbA.png" /></figure><ul><li>Then the created volume can be selected from the drop-down menu of ‘Mount points’ and map with the container path while adding the container.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8V6jgdEE1AxE43Cbj5uZgQ.png" /></figure><p>The summary of the container will be as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puG-uwvXFmw2Em8swWwL4A.png" /></figure><blockquote>Please refer to the blog post — <a href="https://mcvidanagama.medium.com/deploy-wso2-api-manager-in-a-aws-ecs-fargate-cluster-b97c7275f861">https://mcvidanagama.medium.com/deploy-wso2-api-manager-in-a-aws-ecs-fargate-cluster-b97c7275f861</a> on deploying APIM in the Fargate cluster.</blockquote><h4>✋ Create an EC2 instance for EFS</h4><p>Please refer <a href="https://docs.aws.amazon.com/efs/latest/ug/gs-step-one-create-ec2-resources.html">https://docs.aws.amazon.com/efs/latest/ug/gs-step-one-create-ec2-resources.html</a> on creating an EC2 instance for the previously created EFS. And grant permission to ‘wso2carbon’ user of ‘wso2’ group for the instance.</p><pre># groupadd wso2<br># useradd wso2carbon<br># sudo chown -R wso2carbon:wso2 /mnt/efs/fs1/</pre><h4>✋ Create an EC2 instance for ELK</h4><p>Create an EC2 instance for ELK servers referring to <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html</a></p><p>Please refer to the below sample commands to download the servers in a Linux-based EC2 instance.</p><pre>wget <a href="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.0-linux-x86_64.tar.gz">https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.0-linux-x86_64.tar.gz</a></pre><pre>tar -zxvf elasticsearch-7.14.0-linux-x86_64.tar.gz</pre><blockquote>ELK Stack<br>Filebeat, Logstash, ElasticSearch, and Kibana can be downloaded from their <a href="https://www.elastic.co/downloads/">website</a>.</blockquote><ul><li><a href="https://www.elastic.co/downloads/elasticsearch">Download Elasticsearch</a></li><li><a href="https://www.elastic.co/downloads/kibana">Download Kibana Free | Get Started Now</a></li><li><a href="https://www.elastic.co/downloads/beats/filebeat">Download Filebeat * Lightweight Log Analysis | Elastic</a></li><li><a href="https://www.elastic.co/downloads/logstash">Download Logstash | Elastic</a></li></ul><h4>✋ <strong>Configure and start the servers</strong></h4><p>🎈<strong>WSO2 APIM</strong></p><ul><li>Create a directory called ‘wso2_logs’ manually in the EC2 instance for ELK servers and mount the EFS to this instance.</li></ul><pre>$ sudo mount -t efs -o tls &lt;efs-id&gt;.efs.us-east-1.amazonaws.com:/ /home/ec2-user/wso2_logs</pre><ul><li>Execute the below command to enable EFS features in the EC2 instance for ELK servers.</li></ul><pre>yum install -y amazon-efs-utils</pre><ul><li>Restart the server(task) and make sure that log files are writing to the /home/ec2-user/wso2_logs location of the EC2 instance of ELK servers.</li></ul><p>🎈<strong>Filebeat<br></strong>All the configuration required for this needs to be done in ‘filebeat.yml’ file. Let’s configure log type and point the path to ‘wso2carbon.log’ file as a Filebeat input. If there is a requirement to feed all the log files then instead of specifying the log file name, ‘*’ can be used. Change the path according to your file system.</p><pre>filebeat.inputs: <br>  - type: log <br>    enabled: true<br>    paths:<br>      - /home/ec2-user/wso2_logs/wso2carbon.log</pre><p>Then start the component by executing the ‘<em>filebeat</em>‘ script.</p><pre>./filebeat</pre><p>🎈<strong>Logstash</strong><br>It is needed to configure a GROK filter and save it as ‘logstash-beat.conf’. With the below sample filter, it is passing all the logs. However you can write your own GROK filter according to the requirement.</p><pre>input {<br> beats {<br> type =&gt; &quot;beats&quot;<br> host =&gt; &quot;&lt;?&gt;&quot;<br> port =&gt; 5044<br> }<br>}<br>output {<br> elasticsearch {<br> hosts =&gt; [&quot;&lt;host&gt;:9200&quot;]<br> }<br> stdout { <br> codec =&gt; rubydebug <br> }<br>}<br>filter {<br> <br> grok {<br> match =&gt; [ &quot;message&quot;, &quot;TID: \[%{INT:TID}\] \[\] \[%{TIMESTAMP_ISO8601:timestamp}\]\s+%{WORD:loglevel}\s+{%{JAVACLASS:java_class}}%{GREEDYDATA:FlowMessage}&quot; ]<br> tag_on_failure =&gt; [&quot;failed-to-parse&quot;]<br> }<br> <br>}</pre><p>Start the component.</p><pre>./logstash -f ../config/logstash-beat.conf</pre><p>🎈<strong>ElasticSearch</strong><br>Just start the component with default configurations. We need to start the ElasticSearch server before starting the Kibana server.</p><pre>./elasticsearch</pre><p>🎈<strong>Kibana</strong><br>Change the “server.host:” of kibana.yml with the private IP address of the EC2 instance. Finally, start the Kibana server.</p><pre>./kibana</pre><h3>🌾 Monitoring the logs</h3><p>With http(s)://your_kibana_host/5061 you can visit the Kibana server. After some data (logs and statistics) has been pushed to ElasticSearch you will be able to view the data by making a filter. At first, let’s make the index pattern as “logstash-*” and it will show all the available variables including the custom variables on the Kibana dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*zd6fvnNnrFQJ1VZb" /></figure><p>Then you can create the required dashboard by choosing the needed variables.</p><p>And we are DONE!!! 🎉 🎊 🎉 🌸 🌸Happy Stacking!!!🌸 🌸</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5da7c285a2de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Access WSO2 API Manager Devportal/Publisher through a custom proxy path]]></title>
            <link>https://wathsalakoralege.medium.com/access-wso2-api-manager-devportal-publisher-through-a-custom-proxy-path-848e54539b18?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/848e54539b18</guid>
            <category><![CDATA[custom-proxy-path]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Sun, 19 Dec 2021 11:27:50 GMT</pubDate>
            <atom:updated>2021-12-19T11:27:50.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*L1a0vvHmfaMpVSBDIQ8_VA.jpeg" /><figcaption>Courtesy: <a href="https://unsplash.com/s/photos/path">https://unsplash.com/s/photos/path</a></figcaption></figure><p>Greetings to everyone!! Today I’m going to share with you how to access WSO2 APIM devportal/publisher portals through a custom proxy path. Here I’m using Apache HTTP Server(Apache/2.4.48) as the proxy server.</p><p>Let’s say devportal/publisher console apps are hosted in the knnect.lk domain as follows. And “apim” is the “proxy context paths” of API Manager.</p><p><a href="https://knnect.lk/apim/devportal/">https://knnect.lk/apim/devportal/</a><br><a href="https://knnect.lk/apim/publisher/">https://knnect.lk/apim/publisher/</a></p><h4>🔯 <strong>Steps for WSO2 APIM configuration:</strong></h4><ol><li>Get the latest update level of WSO2 APIM — ex: This feature is available APIM 3.1.0.70 update level onwards.</li></ol><p>2. Create a keystore with the CN of the ‘server.hostname’(knnect.lk), import that public key and proxy key(ex: knnect.lk.pem) to the client-truststore.jks file, and configure the same keystore in the deployment.toml as guided below.</p><p>🎏 Create a new key store.</p><pre>keytool -genkey -alias wso2carbon -keyalg RSA -keystore wso2carbon.jks -keyalg RSA -keysize 2048 -validity 9999 -dname &quot;CN=knnect.lk, O=WSO2, L=CL, ST=WP, C=LK, OU=APIM&quot; -ext &quot;SAN=DNS:knnect.lk&quot;</pre><p>🎏 Export the public key.</p><pre>keytool -export -alias wso2carbon -keystore wso2carbon.jks -file publickey.pem</pre><p>🎏 Import the public key to the client-truststore.jks with alias ‘gateway_certificate_alias’</p><pre>keytool -import -alias gateway_certificate_alias -file publickey.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>🎏 If that alias is already available remove that entry first.</p><pre>keytool -delete -alias gateway_certificate_alias -keystore client-truststore.jks</pre><p>🎏 Import the key of the Apache server to the client-truststore.jks</p><pre>keytool -import -alias proxykey -file /usr/local/etc/httpd/certs/knnect.lk.pem -keystore client-truststore.jks -storepass wso2carbon</pre><p>🎏 Update the deployment.toml file with the details of the newly created key store.</p><pre>[keystore.primary]<br>file_name =  &quot;wso2carbon.jks&quot;<br>type =  &quot;JKS&quot;<br>password =  &quot;wso2carbon&quot;<br>alias =  &quot;wso2carbon&quot;<br>key_password =  &quot;wso2carbon&quot;</pre><p>Please find the locations of the wso2carbon.jks and client-truststore.jks in WSO2 APIM.</p><ul><li>&lt;APIM-HOME&gt;/repository/resources/security/client-truststore.jks</li><li>&lt;APIM-HOME&gt;/repository/resources/security/wso2carbon.jks</li></ul><p>Please refer to the documentation [1] for more details.</p><p>3. Additional file-based configurations.</p><p>📓&lt;APIM-HOME&gt;/repository/conf/deployment.toml</p><pre>[server]<br>hostname = &quot;knnect.lk&quot;<br>node_ip = &quot;127.0.0.1&quot;<br>#offset=0<br>mode = &quot;single&quot; #single or ha<br>base_path = &quot;${carbon.protocol}://${carbon.host}:${carbon.management.port}/apim&quot;<br>#discard_empty_caches = false<br>server_role = &quot;default&quot;<br>proxy_context_path = &quot;/apim&quot;</pre><pre>[transport.https.properties]<br>proxyPort = 443</pre><pre>[[apim.gateway.environment]]<br>...<br>http_endpoint = &quot;http://knnect.lk:${http.nio.port}&quot;<br>https_endpoint = &quot;https://knnect.lk:${https.nio.port}&quot;</pre><pre>[apim.devportal]<br>url = &quot;https://knnect.lk/apim/devportal&quot;</pre><pre>[transport.https.properties]<br>proxyPort = 443</pre><p>📓 &lt;APIM-HOME&gt;/repository/resources/conf/templates/repository/conf/tomcat/carbon/WEB-INF/web.xml.j2</p><pre>&lt;context-param&gt;<br>      &lt;param-name&gt;contextPath&lt;/param-name&gt;<br>      &lt;param-value&gt;apim&lt;/param-value&gt;<br>    &lt;/context-param&gt;</pre><p>📓 &lt;APIM-HOME&gt;/repository/deployment/server/jaggeryapps/devportal/site/public/theme/settings.js</p><pre>app: {<br>        context: &#39;/apim/devportal&#39;, <br>        proxy_context_path: &#39;/apim&#39;,</pre><p>📓 &lt;APIM-HOME&gt;/repository/deployment/server/jaggeryapps/publisher/site/public/conf/settings.js</p><pre>app: {<br>        context: &#39;/apim/publisher&#39;, <br>        proxy_context_path: &#39;/apim&#39;,</pre><h4>🔯 Steps for Apache configuration:</h4><ol><li>Install and start Apache server. Please refer to documentation [3] for more details.</li></ol><pre>brew install httpd</pre><pre>brew services start httpd</pre><blockquote>Hope you are already having the certificate key pair for the proxy which needs to be configured under ‘SSLCertificateFile’ and ‘SSLCertificateKeyFile’. If not please follow the below steps to generate a self-signed certificate in <a href="https://getgrav.org/blog/macos-monterey-apache-ssl">https://getgrav.org/blog/macos-monterey-apache-ssl</a></blockquote><blockquote>Install mkcert to serve as our certificate authority (CA), and also nss to ensure firefox can use a certificate authority server.</blockquote><blockquote>brew install mkcert nss</blockquote><blockquote>Next, we have to install the server and run it (enter your password when prompted):</blockquote><blockquote>mkcert -install</blockquote><blockquote>Let’s create a appropriate location for the certificates:</blockquote><blockquote>cd /opt/homebrew/etc/httpd<br>mkdir certs &amp;&amp; cd certs</blockquote><blockquote>Now, all we have to do is generate a certificate for any domain we wish to use. For example, you could create one for “knnect.lk” with:</blockquote><blockquote>mkcert knnect.lk</blockquote><blockquote>These commands will create .pem and -key.pem files for each domain.</blockquote><p>2. Please find the Apache file-based configurations.</p><p>📓 httpd-ssl.conf</p><pre>Listen 443</pre><pre>SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES<br>SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES</pre><pre>SSLHonorCipherOrder on </pre><pre>SSLProtocol all -SSLv3<br>SSLProxyProtocol all -SSLv3</pre><pre>SSLPassPhraseDialog  builtin</pre><pre>SSLSessionCache        &quot;shmcb:/usr/local/var/run/httpd/ssl_scache(512000)&quot;<br>SSLSessionCacheTimeout  300<br></pre><pre>&lt;VirtualHost *:443&gt;</pre><pre>    DocumentRoot &quot;/usr/local/var/www&quot;<br>    ServerName knnect.lk:443<br>    ServerAdmin admin@wso2.com<br>    ErrorLog &quot;/usr/local/var/log/httpd/error_log&quot;<br>    TransferLog &quot;/usr/local/var/log/httpd/access_log&quot;</pre><pre>    SSLEngine on<br>    SSLProxyEngine On<br>    SSLCertificateFile &quot;/usr/local/etc/httpd/certs/knnect.lk.pem&quot;<br>    SSLCertificateKeyFile &quot;/usr/local/etc/httpd/certs/knnect.lk-key.pem&quot;</pre><pre>    &lt;FilesMatch &quot;\.(cgi|shtml|phtml|php)$&quot;&gt;<br>        SSLOptions +StdEnvVars<br>    &lt;/FilesMatch&gt;<br>    &lt;Directory &quot;/usr/local/var/www/cgi-bin&quot;&gt;<br>        SSLOptions +StdEnvVars<br>    &lt;/Directory&gt;<br></pre><pre>    BrowserMatch &quot;MSIE [2-5]&quot; \<br>            nokeepalive ssl-unclean-shutdown \<br>            downgrade-1.0 force-response-1.0<br></pre><pre>    CustomLog &quot;/usr/local/var/log/httpd/ssl_request_log&quot; \<br>            &quot;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&quot;%r\&quot; %b&quot;</pre><pre>    ProxyPreserveHost On<br>    ProxyRequests Off<br>    ProxyVia Off<br>    &lt;Proxy *&gt;<br>         Require all granted<br>    &lt;/Proxy&gt;<br>    </pre><pre>    ProxyPass &quot;/apim/devportal&quot;  &quot;https://knnect.lk:9443/devportal/&quot;</pre><pre>    ProxyPass &quot;/apim/publisher&quot;  &quot;https://knnect.lk:9443/publisher/&quot;</pre><pre>    ProxyPass &quot;/apim/&quot;  &quot;https://knnect.lk:9443/&quot;<br>    ProxyPassReverse &quot;/apim/&quot;  &quot;https://knnect.lk:9443/&quot;</pre><pre>    ProxyPass &quot;/authenticationendpoint/&quot;  &quot;https://knnect.lk/apim/authenticationendpoint/&quot;<br>    ProxyPassReverse &quot;/authenticationendpoint/&quot;  &quot;https://knnect.lk/apim/authenticationendpoint/&quot;</pre><pre>    ProxyPass &quot;/oauth2/&quot;  &quot;https://knnect.lk/apim/oauth2/&quot;<br>    ProxyPassReverse &quot;/oauth2/&quot;  &quot;https://knnect.lk/apim/oauth2/&quot;</pre><pre>    ProxyPass &quot;/carbon/&quot;  &quot;https://knnect.lk/apim/carbon/&quot;<br>    ProxyPassReverse &quot;/carbon/&quot;  &quot;https://knnect.lk/apim/carbon/&quot;</pre><pre>    ProxyPass &quot;/commonauth/&quot;  &quot;https://knnect.lk/apim/commonauth/&quot;<br>    ProxyPassReverse &quot;/commonauth/&quot;  &quot;https://knnect.lk/apim/commonauth/&quot;</pre><pre>    ProxyPass &quot;/commonauth&quot;  &quot;https://knnect.lk/apim/commonauth/&quot;<br>    ProxyPassReverse &quot;/commonauth&quot;  &quot;https://knnect.lk/apim/commonauth/&quot;</pre><pre>&lt;/VirtualHost&gt;</pre><p>📓 httpd.conf</p><pre>...<br>LoadModule xml2enc_module lib/httpd/modules/mod_xml2enc.so<br>LoadModule proxy_html_module lib/httpd/modules/mod_proxy_html.so<br>LoadModule proxy_module lib/httpd/modules/mod_proxy.so<br>LoadModule proxy_connect_module lib/httpd/modules/mod_proxy_connect.so<br>LoadModule proxy_http_module lib/httpd/modules/mod_proxy_http.so<br>...<br>&lt;IfModule proxy_html_module&gt;<br>Include /usr/local/etc/httpd/extra/proxy-html.conf<br>&lt;/IfModule&gt;<br>...<br>Include /usr/local/etc/httpd/extra/httpd-ssl.conf<br>...</pre><p>Please refer to documentation [2] for more information.</p><blockquote>You can check the syntax (after configuring the aforementioned files) using the below command in MAC OS.</blockquote><blockquote>/usr/local/bin/httpd -t</blockquote><p>3. Start/Restart the service the effect the configuration changes. Map Your IP address to localhost.</p><pre>brew services start httpd<br>brew services restart httpd</pre><blockquote>To map the IP address to the domain name edit the “/etc/hosts” file accordingly.</blockquote><blockquote><em>127.0.0.1 knnect.lk</em></blockquote><p>4. Start/Restart Apache server</p><pre>sudo apachectl start<br>sudo apachectl restart</pre><p>And, yes that’s it.. 🎉 🎉 We have successfully configured the WSO2 API Manager with Apache HTTP server for a custom proxy path.</p><p>Hope you find the blog post useful ❕❕ 🎄 🎄 🎄 Merry Christmas 🎄🎄🎄</p><h4>References:</h4><p>[1] <a href="https://apim.docs.wso2.com/en/3.2.0/install-and-setup/setup/security/configuring-keystores/configuring-keystores-in-wso2-api-manager/">https://apim.docs.wso2.com/en/3.2.0/install-and-setup/setup/security/configuring-keystores/configuring-keystores-in-wso2-api-manager/</a><br>[2] <a href="https://apim.docs.wso2.com/en/3.2.0/install-and-setup/setup/setting-up-proxy-server-and-the-load-balancer/adding-a-custom-proxy-path/">https://apim.docs.wso2.com/en/3.2.0/install-and-setup/setup/setting-up-proxy-server-and-the-load-balancer/adding-a-custom-proxy-path/</a><br>[3] <a href="https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions">https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=848e54539b18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configure Azure AD as a SAML Federated Identity Provider in WSO2 API Manager]]></title>
            <link>https://wathsalakoralege.medium.com/configure-azure-ad-as-a-saml-federated-identity-provider-in-wso2-api-manager-ebfa005ab755?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebfa005ab755</guid>
            <category><![CDATA[azure-ad]]></category>
            <category><![CDATA[400]]></category>
            <category><![CDATA[wso2-api-manager]]></category>
            <category><![CDATA[aml]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Tue, 14 Sep 2021 03:58:44 GMT</pubDate>
            <atom:updated>2021-09-14T03:58:44.787Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone! In this medium, I will be guiding on integrating Azure Active Directory with WSO2 API Manager v4.0.0 as a SAML federated identity provider. With this integration WSO2 APIM will have the SAML SSO(Single Sign-On) capabilities via Azure Active Directory.</p><p>The steps are provided for configuring the API Manager Developer Portal using the SAML2 protocol. The same steps can be followed to configure the Publisher and Admin portals as well for the SAML federation.</p><h4>✅ <strong>Setting Up Azure AD</strong></h4><p>🔷 1.Configuring the Office 365 App 🔷</p><p>First of all, let’s create an Office 365 account to make the process easier. For that click <a href="https://products.office.com/en-us/business/compare-office-365-for-business-plans">here</a>, and select the account type. You can create a trial account which is valid for 30 days. I have selected the ‘Office 365 Business Premium’ type. Then sign up to get an account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oETczmQQyWdWCEFuYW-6MQ.png" /><figcaption><a href="https://www.microsoft.com/en-us/microsoft-365/business/compare-all-microsoft-365-business-products">https://www.microsoft.com/en-us/microsoft-365/business/compare-all-microsoft-365-business-products</a> — To create the Office 365 account</figcaption></figure><p>🔷 2.Associate a Microsoft Azure AD subscription with the Office 365 account that you created.🔷</p><p>Log in to the <a href="https://portal.azure.com/#home">Microsoft Azure management portal</a> with your existing Office 365 credentials to see the Microsoft Azure Dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hk3mO9-2ovVEbqLEaZkHsw.png" /><figcaption><a href="https://portal.azure.com/#home">https://portal.azure.com/#home</a> — Azure dashbord</figcaption></figure><p>🔷 3. Add new users 🔷</p><p>You can add users to your organization from both Office 365 (<a href="https://portal.office.com/adminportal/#/users">https://portal.office.com/adminportal/#/users</a>) and Azure AD (<a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview">https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview</a>)</p><p>When creating the users, you should use the same domain which you registered your account. <br>Ex: My account domain is lakminiw123.onmicrosoft.com <br>So in my case, when creating users they need to have a format such as <a href="/service/mailto:user@lakminiw123.onmicrosoft.com">user@lakminiw123.onmicrosoft.com</a>.</p><blockquote>Make sure you copy down the default password which has been set for each user. At the initial login, the users will be asked to reset their password therefore having this value is important.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dB9V3Lw5aAl7Q0Af9rFxjg.png" /><figcaption><a href="https://portal.office.com/adminportal/#/users">https://portal.office.com/adminportal/#/users</a> — Add new user with Office 365</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MPqE6SOyAkNX9Affp-oiA.png" /><figcaption><a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview">https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview</a> — To create users with Azure AD — I</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHm0uIOPYlMAPKhS7oDQPA.png" /><figcaption><a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/UsersManagementMenuBlade/MsGraphUsers">https://portal.azure.com/#blade/Microsoft_AAD_IAM/UsersManagementMenuBlade/MsGraphUsers</a> — To create users with Azure AD — II</figcaption></figure><p>🔷 4. App Registration 🔷</p><p>✋ i. Add application</p><p>In the Overview section of your Organization(<a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview">https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview</a>), click ‘Add’ → ‘Enterprise Applications’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qPVbosaVeVOM-qsIcMsg1g.png" /><figcaption><a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview">https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview</a> — To add Enterprise application — I</figcaption></figure><p>You will be redirected to the ‘Browse Azure AD Gallery’ page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r3rn3e-GSifAScm0h2P4hA.png" /><figcaption>To add Enterprise application — II</figcaption></figure><p>Click the above-pointed banner to navigate to the legacy app gallery and then select ‘Non-gallery application’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2dVZu3k82ijdEt3uCDw5Zg.png" /><figcaption>To add Enterprise application — III</figcaption></figure><p>Thereafter you can create an application after adding an application name and click on ‘Add’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mry3BOTQRXwtevG8G_Taww.png" /><figcaption>To add Enterprise application — IV</figcaption></figure><p>✋ ii. Configure the App with APIM server</p><p>Then you will be redirected to the Overview page of your newly created Application. Click ‘Single sign-on’ to configure the SAML IDP configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Htwf5QybscIsWvH5EflIQ.png" /><figcaption>Enterprise application Overview to Single sign-on — I</figcaption></figure><p>Select ‘SAML’ as the Single sign-on method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3K-EjiG-Qq24wO6hJ051kg.png" /><figcaption>Enterprise application Overview to Single sign-on — II</figcaption></figure><p>Then you will be redirected to ‘SAML-based Sign-on’ page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ck8c-nfj3RknigUHZU0SrQ.png" /><figcaption>SAML-based Sign-on configuration -I</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTeww7pfDurt6QhMZ4ZFvQ.png" /><figcaption>SAML-based Sign-on configuration -II</figcaption></figure><p>Ok, let’s configure the application to communicate with the APIM server during the SAML-based federation. Add the following values under the ‘Basic SAML Configuration’ section, Save and exit.</p><ul><li>Identifier (Entity ID): <em>wso2apimv400</em></li><li>Reply URL (Assertion Consumer Service URL): <a href="https://localhost:9443/commonauth"><em>https://localhost:9443/commonauth</em></a></li><li>Sign-on URL: <a href="https://localhost:9443/samlsso"><em>https://localhost:9443/samlsso</em></a></li></ul><p>Your configuration for this application should look like the one below(You may need to refresh the page to view the new configurations).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x8ca5_v4HY6X10kw7rH3kQ.png" /><figcaption>Basic SAML configuration view after editing</figcaption></figure><p>✋ ii. Configure Claims</p><p>Then let’s configure the claims which will be passed in the SAML response to APIM Server during the federation. The default claims are as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UiYvqNo6hbrUuAz3CZWzQ.png" /><figcaption>Configuring user attributes and claims</figcaption></figure><p>If there is any requirement to capture the AD user’s assigned role you need to add the attribute ‘memberOf’. This will be used to carry out the role mappings when configuring the IDP at the APIM end.</p><blockquote>Name: memberOf <br>Namespace: <a href="http://schemas.xmlsoap.org/ws/2005/05/identity/claims">http://schemas.xmlsoap.org/ws/2005/05/identity/claims</a><br>Value: user.assignedroles</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfkT8qo76BsSW2w-NgSbHA.png" /><figcaption>Adding memberOf attribute in the purpose of adding roles from AD</figcaption></figure><p>After you have completed this, save your changes.</p><p>✋ iii. Adding custom roles</p><p>Next, we are going to add custom roles. This step is needed only if there is a requirement to pass the roles from Azure AD to APIM, given that this should be followed after adding the ‘memberOf’ attribute in the previous step ‘ii. Configure Claims’.</p><p>Select your newly created app from the ‘All applications’ list after navigating to <a href="https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade">https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade</a>. Then select ‘App roles’ → ‘Create app role’ and add the relevant details and Save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uOBK1vKYlw6czN_gyky-wg.png" /><figcaption>Adding app roles</figcaption></figure><p>Now we can proceed to the next step to assign these roles for the users in AD.</p><p>✋ iv. Adding Users to your gallery application</p><p>In this step, we are going to assign users from our active directory into our Azure application. Unless we have users authorized to this application they would not be able to perform the login using federation.</p><p>From ‘All applications’ of ‘Enterprise applications’ select your application(<a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/StartboardApplicationsMenuBlade/AllApps">https://portal.azure.com/#blade/Microsoft_AAD_IAM/StartboardApplicationsMenuBlade/AllApps</a>). Then select the ‘Users and groups’ section of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lamidljXCKMiZL_Jd6Dcaw.png" /><figcaption>Adding users to the app — I</figcaption></figure><p>Then click ‘Add user/group’ and assign users and roles(if applicable) for the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gra7qOmKGs7mqRdEpZTW8g.png" /><figcaption>Adding users to the app — II</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4bfRGGIe-LqWE-X6CO6pQ.png" /><figcaption>Adding users to the app — III</figcaption></figure><p>Now we have completed the configurations needed for the federation on the Microsoft Azure end.</p><p>✋ v. Summary of all needed configurations from the Azure side</p><p>Please refer to the ‘SAML-based Sign-on configuration -II’ image and click on the ‘View step-by-step instructions’ of the 4th section of SAML-based Sign-on’ page. There you will be able to figure out the following pieces of information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*88CyPbvM2fYHgxGzRi_bjQ.png" /><figcaption>Extarct from the step-by-step instructions</figcaption></figure><p>🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩</p><p>Please refer to the following information of my sample application relevant to Section 1, 2, 3, and 4 of ‘SAML-based Sign-on’ page.</p><ul><li><strong>Azure Enterprise Application name</strong>: APIM4SAML</li><li><strong>Identifier (Entity ID)</strong>: wso2apimv400</li><li><strong>SAML Single Sign-on Service URL</strong>: <a href="https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2">https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2</a></li><li><strong>SAML Entity ID</strong>: <a href="https://sts.windows.net/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/">https://sts.windows.net/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/</a></li><li><strong>Sign-Out URL</strong>: <a href="https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2">https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2</a></li><li><strong>SAML signing certificate</strong>: APIM4SAML.cer(Base64 encoded certitifcate)</li><li>Claims:<br><strong>Required claim</strong> — Unique User Identifier (Name ID) : user.userprincipalname [nameid-format:emailAddress]<br><strong>Other claims</strong>:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/729387f79fd21763c22b94f27bbf80b8/href">https://medium.com/media/729387f79fd21763c22b94f27bbf80b8/href</a></iframe><ul><li><strong>Roles</strong>:<br>📍 <strong>Option 1</strong>:<br> No roles on the Azure AD side so you may need to define the roles within the WSO2 side. <br>📍 <strong>Option 2</strong>:<br> Roles and relevant claims are available in the Azure AD(need to follow ‘ii. Configure Claims’ with ‘memeberOf’ attributes and ‘iii. Adding custom roles’ of ‘4. App Registration’)</li></ul><p>🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩 🛩</p><h4>✅ Setting Up API Manager v4.0.0</h4><p>🔶 1. Enable email as username 🔶</p><p>Add the following configuration in deployment.toml file located in &lt;APIm-HOME&gt;/repository/conf/ directory.</p><pre>[tenant_mgt]<br>enable_email_domain= true</pre><pre>[user_store]<br>type = “database_unique_id”<br>username_java_regex = ‘^[\S]{3,100}$’<br>username_java_script_regex = ‘^[\S]{3,100}$’</pre><blockquote>In the very first start-up of the WSO2 APIM server (when you have plugged an empty database and run the APIM for the first time), the server will read the super_admin username and password from the deployment.toml file and save it in the DB. Configuring the email address as the username in an already running APIM server is not the production recommended way. Therefore, make sure to configure it before you begin working with WSO2 APIM.<br><br>Please refer to WSO2 official documentation for more details on maintaining logins and passwords of WSO2:<br><a href="https://apim.docs.wso2.com/en/latest/install-and-setup/setup/security/logins-and-passwords/maintaining-logins-and-passwords/">https://apim.docs.wso2.com/en/latest/install-and-setup/setup/security/logins-and-passwords/maintaining-logins-and-passwords/</a></blockquote><p>The aforementioned configurations are needed since Azure AD is using the email as the username by default. To use the email as the username in WSO2 API Manager we need to enable it as it is not enabled by default. Additionally, since Azure AD username has more than 30 characters and it is not valid with the default WSO2 regex of “^[\S]{3,30}$”, we need to update the user store regex configurations as well. Otherwise, we will end up with errors while provisioning the Azure AD user to the Primary user store.</p><blockquote>Another configuration need to be added in the deployment.toml file if you are going with <strong>Option 2</strong>. It will be under ‘iv. Expand the “Local &amp; Outbound Authentication Configuration” section, follow one of the below options and login to devportal’.</blockquote><p>🔶 2. Register and configure an Identity Provider in the API Manager server to communicate with Azure AD and to perform Federated authentication. 🔶</p><p>✋ i. Login to the Carbon Management Console <a href="https://localhost:9443/carbon">https://localhost:9443/carbon</a> of the APIM server using the admin credentials.</p><p>✋ ii. Navigate to the “Identity Providers” section from the left side pane under the Main menu, click on “Add”.</p><p>✋ iii. Under “Basic information” provide the below details.</p><ul><li>Identity Provider Name: <em>Azure_SAML_IDP</em></li><li>Display Name: <em>Azure SAML IDP</em></li><li>Description: <em>IDP for Azure SAML Federation</em></li><li>Alias: <a href="https://localhost:9443/oauth2/token"><em>https://localhost:9443/oauth2/token</em></a></li><li>In “Choose IDP certificate type:” <em>select “Upload IDP certificate” and upload the APIM4SAML.pem</em>(in .pem format).</li></ul><p>📓<strong> Note:</strong> If your certificate is exported with Base64 encoding, then rename the extension .cer to .pem. The file is already in .pem format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXfUEAnpHxy_7n0_R3t5fg.png" /><figcaption>APIM — IDP configurations</figcaption></figure><p>✋ iv. Expand the “Claim Configuration” accordion to map and configure the Azure AD claims with API Manager.</p><p>Click on “Define Custom Claim Dialect” and then “Add Claim Mapping” to add custom mappings. Input the following mappings following one of the below options relates the previously mentioned options of role configurations in ‘. Overlook of all needed configurations from the Azure side’ of ‘4. App Registration’.</p><p>📍<strong>Option 1:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a02eff2ffb43d74cd13b751ef363d0fe/href">https://medium.com/media/a02eff2ffb43d74cd13b751ef363d0fe/href</a></iframe><p>Set ‘<a href="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name">http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name</a>’ as the User ID Claim URI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A2EO0rr6d4fU5DdIvM8Big.png" /><figcaption>APIM — Claim mappings for Option 1</figcaption></figure><p>📍<strong>Option 2:</strong></p><p>In addition to the configurations in <strong>Option 1</strong>, add another claim mapping for roles. All the needed claim mappings for the <strong>Option 2</strong> is as below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc1706bceb118e84f2fa96ed708f8f76/href">https://medium.com/media/bc1706bceb118e84f2fa96ed708f8f76/href</a></iframe><p>Set ‘<a href="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name">http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name</a>’ as the User ID Claim URI and ‘<a href="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/memberOf">http://schemas.xmlsoap.org/ws/2005/05/identity/claims/memberOf</a>’ as the Role Claim URI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4TM_SLTSQ6MX6I6ORha3Gg.png" /><figcaption>APIM claim mappings for Option 2</figcaption></figure><p>Further, you need to add role mappings as well to map the IDP roles with local roles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvszeH34Dn6JrrQpjAygUg.png" /><figcaption>Role mappings for Option 2</figcaption></figure><p>✋ v. Expand the “Federated Authenticators” section and then expand the “SAML2 Web SSO Configuration” to configure the Federated SAML2 Authenticator. Input the following in the respective fields.</p><ul><li>Enable SAML2 Web SSO: <em>true</em></li><li>Service Provider Entity ID: <em>wso2apimv400</em> &lt;Identifier (Entity ID) of “Basic SAML Configuration” in Azure AD&gt;</li><li>NameID Format: <em>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</em></li><li>Identity Provider Entity ID: <a href="https://sts.windows.net/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/"><em>https://sts.windows.net/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/</em></a><em> </em>&lt;SAML Entity ID of “Configure &lt;AppName&gt; for single sign on” of Azure AD&gt;</li><li>SSO URL: <a href="https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2"><em>https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2</em></a>&lt;SAML Single Sign-on Service URL of “Configure &lt;AppName&gt; for single sign on” of Azure AD&gt;</li><li>Logout Url: <a href="https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2"><em>https://login.microsoftonline.com/a74f37bd-de4d-4eb1-954d-445a2ca2a6e8/saml2</em></a><em> </em>&lt;Sign-Out URL of “Configure &lt;AppName&gt; for single sign on” of Azure AD &gt;</li></ul><p>Keep the other existing configurations as it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pHPs-0HqKXmdiEoRMDdmRA.png" /><figcaption>APIM — SAML configurations — I</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXbbZ7jHveVJmW8XCNvbug.png" /><figcaption>APIM — SAML configurations — II</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1B1DX4OfCpOA6SDkqOt9pQ.png" /><figcaption>APIM — SAML configurations — III</figcaption></figure><p>✋ vi. Expand the “Just-In-Time Provisioning” accordion and tick the “Always Provision to User Store Domain” with “PRIMARY” and enable “Provision silently” to provision the Azure AD users to the API Manager while logging into the portals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCdrXhcNx9Kr8rgXRhjHCA.png" /><figcaption>APIM — Just in Time provisioning</figcaption></figure><p>✋ vii. Click “Register” to register the IDP.</p><p>🔶 3. Configure Service Provider(These steps are applied for the Publisher and Admin portal as well) 🔶</p><p>✋ i. Start the API Manager server and navigate to the Devportal for the very first time, <a href="https://localhost:9443/devportal/">https://localhost:9443/devportal/</a>. This will automatically generate and configure a Service Provider related to the Devportal and can be viewed from the Carbon Management Console.</p><p>✋ ii. Login to the Carbon Management Console with admin credentials and navigate to the “Service Providers” section from the left side pane under the Main menu and click on “List”.</p><p>✋ iii. Edit the auto-generated Service Provider related to the devportal, “apim_devportal”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G_k-rtMI3TpOar1q9cnd7Q.png" /><figcaption>APIM — service providers</figcaption></figure><p>✋ iv. Expand the “Local &amp; Outbound Authentication Configuration” section, follow one of the below options and login to devportal.</p><p>☂️ <strong>Option A</strong> (To use only federated authentication):</p><p>Select ‘Federated Authentication’ and select the relevant IDP from the drop-down Ex: ‘Azure_SAML_IDP’. Additionally enable the “Assert Identity using mapped local subject identifier” and “Use user store domain in roles” and Update the Service Provider configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgH95h_h0lo9S6v_C3NTAw.png" /><figcaption>APIM — Service Providers configuration for Option A</figcaption></figure><p>Go to the Devportal <a href="https://localhost:9443/devportal/">https://localhost:9443/devportal/</a> and click ‘SIGN-IN’. You will be redirected to the Sign In page of the Azure AD. Then enter your credentials to log in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*dc3KX9fBxABBYD0vyOVNFQ.png" /><figcaption>IDP Sign In</figcaption></figure><p>After entering the auto-generated password, you will be asked to update the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*rnhxd6sttMkvZb5l0kpJNA.png" /><figcaption>IDP update password for initial login</figcaption></figure><p>☂️ <strong>Option B</strong> (To use both basic authentication and federated authentication):</p><p>Tick the “Advanced Configuration”. Then in “Advanced Authentication Configuration for apim_devportal” section tick “Use subject identifier from this step” and “Use attributes from this step”.<br>In that step select “basic” from the drop-down menu of “Local Authenticators” and click “Add Authenticator”. <br>In the same step select “Azure_SAML_IDP” from the drop-down menu of “Federated Authenticators” and click “Add Authenticator”. <br>Click “Update” in the “Advanced Authentication Configuration for apim_devportal” window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*37AkHw0jRHmrUP0SnRv-VA.png" /><figcaption>APIM — Service Providers configuration I for Option B</figcaption></figure><p>Then, enable the “Assert Identity using mapped local subject identifier” and “Use user store domain in roles” and Update the Service Provider configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gwb3Hw_jLKMU0F41iBiq7w.png" /><figcaption>APIM — Service Providers configuration II for Option B</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*kIEm4pPsAQr3_0sG" /><figcaption>/authenticationendpoint/login page</figcaption></figure><p>Go to the Devportal <a href="https://localhost:9443/devportal/">https://localhost:9443/devportal/</a> click ‘SIGN-IN’.<br>If the above configurations are successfully performed, you will be redirected to the “/authenticationendpoint/login.do” page where you can select two different sign-in options, i.e. from the basic authentication and IDP authentication.</p><p>And If you select IDP authentication by clicking “Sign In With AZURE_SAML_IDP” you will be redirected to Azure AD’s login page. Then enter the credentials of the Azure AD user and continue same as <strong>Option 1</strong>.<br>With that, the identity federation and provision of the Azure AD users to the WSO2 API Manager will be performed.</p><p>📓 <strong>Note</strong>: At the initial login flow of a user of Azure AD in both the above approaches, can be ended up with successful or unsuccessful login depending on the selected <strong>Option 1</strong> or <strong>Option 2</strong>.</p><p>There will be no issues with <strong>Option 1</strong> and will be able to successfully log in even at the very first login.<br>👉 However, with <strong>Option 2</strong> at the very first login of a user, that flow will end up with a ‘403’ error page since the user is not having the relevant roles/permission to log in to WSO2 portals. To overcome this, please follow the below steps.</p><p>⭐️ Login to the Carbon Management console of WSO2 API Manager using admin credentials and list the Users (Main → “Users and Roles” → List → “Users”). If the federated SAML flow is successful and JIT Provisioning performed without any errors, you will be able to see your Azure AD User in the prompted list.</p><p>⭐️ Since there are no Roles from the Azure AD side and the requirement is to configure it from the WSO2 side, only the “Internal/everyone” role will be assigned for the provisioned user by default. So the other required roles can be assigned after clicking “Assign Roles” of the provisioned user. After APIM 4.0.0.27 update level, these manually adding roles will persist even after re-login of the provisioned user.</p><p>⭐️ In order to affect this change you need to apply the below configurations in the deployment.toml file.</p><pre>[idp_role_management]<br>return_only_mapped_local_roles = true<br>return_manually_added_local_roles = true</pre><p>👉 In order to successfully login into the Devportal, there is another workaround that may not feasible for all the use-cases. It is, “Login” and “Subscribe” permissions can be added to the “Internal/everyone” role then add a role mapping via the /admin portal <a href="https://portals.dev.strategicsourcing.mdfcommerce.com/admin/">https://localhost:9443/admin/</a>. (ex: add mapping to “Internal/everyone” with “Internal/subscriber” or else add the relevant scopes.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/0*WttAag-KKF_pIYmt" /><figcaption>Login permission</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/0*LjF5s5Fi8Alo7QFr" /><figcaption>Subscribe permission</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2cEumV-Ik_Jqzx843iBxg.png" /><figcaption>APIM scope assignment via /admin portal</figcaption></figure><blockquote>Please refer to the WSO2 official documentation for more details on this:<br><a href="https://apim.docs.wso2.com/en/latest/administer/managing-users-and-roles/managing-user-roles/#adding-role-mappings">https://apim.docs.wso2.com/en/latest/administer/managing-users-and-roles/managing-user-roles/#adding-role-mappings</a></blockquote><blockquote>Please refer to the WSO2 official documentation for general information on configuring WSO2 IS as Federated IDP with SAML:<br><a href="https://apim.docs.wso2.com/en/latest/install-and-setup/setup/sso/configuring-identity-server-as-external-idp-using-saml/">https://apim.docs.wso2.com/en/latest/install-and-setup/setup/sso/configuring-identity-server-as-external-idp-using-saml/</a></blockquote><blockquote>Please refer to the WSO2 official documentation for general information on configuring OKTA as Federated IDP with SAML:<br><a href="https://apim.docs.wso2.com/en/latest/install-and-setup/setup/sso/okta-as-an-external-idp-using-saml/">https://apim.docs.wso2.com/en/latest/install-and-setup/setup/sso/okta-as-an-external-idp-using-saml/</a></blockquote><blockquote>Please refer to the WSO2 official documentation for more details on managing Service Providers and Identity Providers via the WSO2 admin services:<br><a href="https://apim.docs.wso2.com/en/latest/reference/wso2-admin-services/">https://apim.docs.wso2.com/en/latest/reference/wso2-admin-services/</a></blockquote><blockquote>Respective Admin services that you will have to use are,<br>Manage Service Providers : IdentityApplicationManagementService<br>Manage Identity providers : IdentityProviderMgtService</blockquote><p>Voila 🎊 🎊 we have successfully integrated Azure AD as a SAML-based federated IDP with WSO2 APIM.</p><p>Hope you find the blog post useful!! 😃 🤗 🌸 🌸 Happy Learning!! 🌸 🌸</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebfa005ab755" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Invoking Mutual SSL secured API: WSO2 APIM 3.2.0]]></title>
            <link>https://wathsalakoralege.medium.com/invoking-mutual-ssl-secured-api-wso2-apim-3-2-0-b10c8169b773?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b10c8169b773</guid>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[320]]></category>
            <category><![CDATA[updated]]></category>
            <category><![CDATA[mutual-ssl]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Sun, 28 Mar 2021 12:52:22 GMT</pubDate>
            <atom:updated>2021-03-28T12:52:22.920Z</atom:updated>
            <content:encoded><![CDATA[<p>You may already aware of the user scenarios based on WSO2 API Manager Mutual SSL which I have addressed <a href="https://medium.com/@wathsalakoralege/wso2-apim-based-mutual-ssl-4e1d6b8f3469">here</a>. With this blog post, I’m going to share how we can invoke an API that has been secured by Mutual SSL-Inbound authentication (between the client and APIM).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*U3iuZ3zkgJrIcpOF1a_JZQ.jpeg" /><figcaption>Source: <a href="https://www.freevector.com/vector/ssl-icon">https://www.freevector.com/vector/ssl-icon</a></figcaption></figure><p>To invoke this kind of APIs, we need to pass the relevant client certificates from the client to GW(APIM) to perform the certificate validation. There are two main options to pass the certificates. 🤘🤘</p><ol><li>Pass the certificate directly through the client(ex: cURL, Postman)</li><li>Pass the certificate as a Header(ex: in a containerized platform via the LB)</li></ol><p>✅ ✅ For both these options, there is a common configuration on the APIM side.</p><ul><li>Add the client certificate in the ‘Runtime Configurations’ → ‘Transport Level Security’ from the Publisher node.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*5zzGkOfyCTbUguzkQHV9qQ.png" /><figcaption>Upload certificate UI</figcaption></figure><ul><li>Make sure that if any of the mechanisms have been selected in ‘Runtime Configurations’ → ‘Application Level Security’ for the particular API, those should be configured as Optional(Or else do not select any mechanism Oauth2, Basic, API Key)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Q4NT9ThZ76bhS-24r8T1g.png" /><figcaption>Part of Runtime configurations of an API</figcaption></figure><ul><li>Save the Runtime Configurations and Publish the API.</li><li>This will add the client certificate to ‘client-truststore.jks’ of the GW node.</li></ul><p>✏️ Example command to check the certificate alias:</p><pre>keytool -v -list -keystore client-truststore.jks | grep &quot;&lt;alias&gt;&quot;</pre><ul><li>And at the same time, an entry will be added to the ‘AM_API_CLIENT_CERTIFICATE’ table of apim_db which having the following format.</li></ul><pre>CREATE TABLE IF NOT EXISTS AM_API_CLIENT_CERTIFICATE (<br>  TENANT_ID INT(11) NOT NULL,<br>  ALIAS VARCHAR(45) NOT NULL,<br>  API_ID INTEGER NOT NULL,<br>  CERTIFICATE BLOB NOT NULL,<br>  REMOVED BOOLEAN NOT NULL DEFAULT 0,<br>  TIER_NAME VARCHAR (512),<br>  FOREIGN KEY (API_ID) REFERENCES AM_API (API_ID) ON DELETE CASCADE ON UPDATE CASCADE,<br>  PRIMARY KEY (ALIAS,TENANT_ID, REMOVED)<br>);</pre><ul><li>After this process, you will be to invoke this API. 👊 ✌️</li></ul><p>Here comes the invocation options…👇</p><p>🚩 <strong>Option 1: Pass the certificate directly through the client</strong></p><p>Here I will take the Postman as a sample client.</p><ul><li>Upload the certificate and key to the Postman client by navigating to Settings → Certificate</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*6fBcCk0Q_Kp7v-Ed6oLUag.png" /><figcaption>Click Settings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYzUQfPbV8kvtx73iHbTuw.png" /><figcaption>To add the certificate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QMuAQ_YUZwLm4DlUuGhhRA.png" /><figcaption>After adding the certificate</figcaption></figure><ul><li>Invoke the API</li></ul><p>If the client does not have the relevant certificate or if the relevant certificate is not properly uploaded to ‘Runtime Configurations’ → ‘Transport Level Security’ of the API (hence missing entry in ‘AM_API_CLIENT_CERTIFICATE’ table), the following error message will be thrown.</p><pre>&lt;ams:fault xmlns:ams=&quot;<a href="http://wso2.org/apimanager/security">http://wso2.org/apimanager/security</a>&quot;&gt;<br>    &lt;ams:code&gt;900901&lt;/ams:code&gt;<br>    &lt;ams:message&gt;Invalid Credentials&lt;/ams:message&gt;<br>    &lt;ams:description&gt;Invalid Credentials. Make sure you have provided the correct security credentials&lt;/ams:description&gt;<br>&lt;/ams:fault&gt;</pre><p>🚩 <strong>Option 2: Pass the certificate as a Header</strong></p><p>If the SSL connection between the client and the GW is terminated by the LB/reverse proxy, the following prerequisites need to be met from the LB/reverse proxy.</p><ul><li>Disable the mutual SSL connection which initializing from the client.</li><li>Pass the client SSL certificate to the Gateway in an HTTP Header via the LB.</li></ul><p>This option involves few configurations to be done on the APIM side. What are those?? 🤔 🤔</p><ul><li>Add the mutual_ssl configurations in the ‘deployment.toml’ file of the GW nodes. By default, the WSO2 API Manager retrieves the client certificate from the “X-WSO2-CLIENT-CERTIFICATE” header. If needed we can have a custom header as well.</li></ul><pre>[apimgt.mutual_ssl] <br>certificate_header = &quot;&lt;Header Name&gt;&quot;<br># This property needs to be true if MutualSSL connection established # between load balancer and gateway. <br>enable_client_validation = false </pre><pre>#This property needs to be true if the certificate should be decoded # at the GW, when it is passed from the load balancer to the GW in <br># encoded manner.<br>client_certificate_encode = true</pre><ul><li>Invoke the API with the configured ‘certificate_header’ and base64 encoded client certificate.<br>Sample commands:</li></ul><pre>To encode the certificate:<br>cat domain.crt | base64</pre><pre>To invoke the API:<br>curl — location — request GET ‘https://localhost:8243/test/1.0/foo&#39; — header ‘accept: applicaition/json’ — header ‘Authorization: Bearer 0ee9aa70-d631–3401-b152–521b431036ca’ — header ‘SSL-CLIENT-CERT: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURsakNDQW40Q0NRRDc2MUpWekluMGNUQU5CZ2txaGtpRzl3MEJBUXNGQURDQmpERUxNQWtHQTFVRUJoTUMKVTB3eEVEQU9CZ05WQkFnTUIxZGxjM1JsY200eEVEQU9CZ05WQkFjTUIwTnZiRzl0WW04eERUQUxCZ05WQkFvTQpCRmRUVHpJeEN6QUpCZ05WQkFzTUFrTlRNUkl3RUFZRFZRUUREQWxzYjJOaGJHaHZjM1F4S1RBbkJna3Foa2lHCjl3MEJDUUVXR25kaGRHaHpZV3hoYTI5eVlXeGxaMlZBWjIxaGFXd3VZMjl0TUI0WERUSXhNREV4TkRBME16VXoKTlZvWERUSXlNREV4TkRBME16VXpOVm93Z1l3eEN6QUpCZ05WQkFZVEFsTk1NUkF3RGdZRFZRUUlEQWRYWlhOMApaWEp1TVJBd0RnWURWUVFIREFkRGIyeHZiV0p2TVEwd0N3WURWUVFLREFSWFUwOHlNUXN3Q1FZRFZRUUxEQUpEClV6RVNNQkFHQTFVRUF3d0piRzlqWVd4b2IzTjBNU2t3SndZSktvWklodmNOQVFrQkZocDNZWFJvYzJGc1lXdHYKY21Gc1pXZGxRR2R0WVdsc0xtTnZiVENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQgpBTWMrRjhJblZmMzAwZ2FraTh2QUZ6cUFTSGNQV0xZalQ4dmMwOUs1TzZHRjgzaXpUa2F0UDFtYW1ydWlKL2VRCk1KL2VLVGhJdzR3MWEzS3Y4cjJwc3d2bWRjdjAzZnhRNis2aFh3Ykh5VUtHWFFwbVhtL3d5VE01NzRlR1cybXAKM2toTjlIdFV0SU5uS3BzSENLcFI3MFhGKzNrTTZleHJJNnRJUUpxdTdKM2t1OEdqRVI3R1Vma2trYXI1OGs3eApibEpIWG5URkdjWXJNSXAvcS9YUENqR0pGajhub2tNbjhnL0dWTExCVGFXSWJVa3E2ejRJYjk1dHNOd2thU1dhCnh6U2t3K3JIVkZLWnpPTlV1WTdKTk16Zkp6RkllZG5lY0U3c2Y0WnFIRlF6aUpVbW9qWklDMXp5bFdZdzQ4OEUKNUZvaU9xTWpHYTlUMXhXMUpOWTBab01DQXdFQUFUQU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFSZTdrcWZlbwpjd1htazRLWlBKMmlnaGY2VU9jc2dYSEZqMnVpQTNhSWMrd2xwREJpdkdCbDJHM2gxQXl6UFNtcVpYaUcvTGttCkg1dm43VUpGQXlQRVBlQ25HdWduTk5kZGpnSFp0SEdJLzdXcm1LTHdIOEU3TWdmSWJ6dk5Hd3ZXWmRrZi9DblcKNjNDYzhhTzJQMDhYd0dHU25JSDg2cWF6NEtvZUF1aFlCdHZyekNObERraTFjZ1E1bHczU0djU3dxMlB0eEd4cApvS0xWOUJYUzlVdUNJRDRrYjFqRUo3YlplTis0Z0pDbTVGTldUbWdhWXFDcjdERWIwRkhpWitLVnBsZzJZZ3ZYCkM2Z2ZrRm9NYTVJREwvWGVja0J0dFlITzFKcWUyMElRKy9kVHB4ZWE4RjE5aDVmeDRZWVlsRFhLWS8wRmxiRXoKZ1l2UGFIUnVKWnFlV1E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==’ -k</pre><p>If the configuration is the same as below, we do not want to worry about the certificate encoding. 💁 💁</p><pre>[apimgt.mutual_ssl]<br>certificate_header = &quot;&lt;Header Name&gt;&quot;<br>enable_client_validation = false<br>client_certificate_encode = false</pre><p>We can successfully invoke the API with the ‘certificate_header’ with an unencoded certificate that does not include any header, footer, and newlines as below example. 🏆🏆</p><pre>curl --location --request GET &#39;https://localhost:8243/test/1.0/foo&#39; --header &#39;accept: applicaition/json&#39; --header &#39;Authorization: Bearer 0ee9aa70-d631-3401-b152-521b431036ca&#39; --header &#39;SSL-CLIENT-CERT: MIIDljCCAn4CCQD761JVzIn0cTANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMCU0wxEDAOBgNVBAgMB1dlc3Rlcm4xEDAOBgNVBAcMB0NvbG9tYm8xDTALBgNVBAoMBFdTTzIxCzAJBgNVBAsMAkNTMRIwEAYDVQQDDAlsb2NhbGhvc3QxKTAnBgkqhkiG9w0BCQEWGndhdGhzYWxha29yYWxlZ2VAZ21haWwuY29tMB4XDTIxMDExNDA0MzUzNVoXDTIyMDExNDA0MzUzNVowgYwxCzAJBgNVBAYTAlNMMRAwDgYDVQQIDAdXZXN0ZXJuMRAwDgYDVQQHDAdDb2xvbWJvMQ0wCwYDVQQKDARXU08yMQswCQYDVQQLDAJDUzESMBAGA1UEAwwJbG9jYWxob3N0MSkwJwYJKoZIhvcNAQkBFhp3YXRoc2FsYWtvcmFsZWdlQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMc+F8InVf300gaki8vAFzqASHcPWLYjT8vc09K5O6GF83izTkatP1mamruiJ/eQMJ/eKThIw4w1a3Kv8r2pswvmdcv03fxQ6+6hXwbHyUKGXQpmXm/wyTM574eGW2mp3khN9HtUtINnKpsHCKpR70XF+3kM6exrI6tIQJqu7J3ku8GjER7GUfkkkar58k7xblJHXnTFGcYrMIp/q/XPCjGJFj8nokMn8g/GVLLBTaWIbUkq6z4Ib95tsNwkaSWaxzSkw+rHVFKZzONUuY7JNMzfJzFIednecE7sf4ZqHFQziJUmojZIC1zylWYw488E5FoiOqMjGa9T1xW1JNY0ZoMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEARe7kqfeocwXmk4KZPJ2ighf6UOcsgXHFj2uiA3aIc+wlpDBivGBl2G3h1AyzPSmqZXiG/LkmH5vn7UJFAyPEPeCnGugnNNddjgHZtHGI/7WrmKLwH8E7MgfIbzvNGwvWZdkf/CnW63Cc8aO2P08XwGGSnIH86qaz4KoeAuhYBtvrzCNlDki1cgQ5lw3SGcSwq2PtxGxpoKLV9BXS9UuCID4kb1jEJ7bZeN+4gJCm5FNWTmgaYqCr7DEb0FHiZ+KVplg2YgvXC6gfkFoMa5IDL/XeckBttYHO1Jqe20IQ+/dTpxea8F19h5fx4YYYlDXKY/0FlbEzgYvPaHRuJZqeWQ==&#39; -k</pre><p>❇️ ❇️ ❇️ Additionally to debug the issues, we can enable the debug logs for ‘org.wso2.carbon.apimgt.gateway.handlers.security.authenticator.MutualSSLAuthenticator’ class.</p><pre>Ex: DEBUG — MutualSSLAuthenticator Mutual SSL authentication has not happened in the transport level for the API admin-test-1.0, hence API invocation is not allowed</pre><p>Hope this was helpful...🤗🤗 👋</p><p>[1] <a href="https://apim.docs.wso2.com/en/3.1.0/learn/api-security/api-authentication/secure-apis-using-mutual-ssl/#securing-apis-with-mutual-ssl">https://apim.docs.wso2.com/en/3.1.0/learn/api-security/api-authentication/secure-apis-using-mutual-ssl/#securing-apis-with-mutual-ssl</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b10c8169b773" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple understanding of WSO2 Micro Gateway]]></title>
            <link>https://wathsalakoralege.medium.com/a-simple-understanding-of-wso2-micro-gateway-6003921eb2f2?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6003921eb2f2</guid>
            <category><![CDATA[microgateway]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[apim]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 16:56:00 GMT</pubDate>
            <atom:updated>2020-06-29T16:56:00.744Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*GNvsiphnh01x450B.jpg" /><figcaption>Source: <a href="https://www.jrebel.com/blog/performance-problems-with-microservices">https://www.jrebel.com/blog/performance-problems-with-microservices</a></figcaption></figure><p>WSO2 API Microgateway is a lightweight, developer-centric, simplified version of API gateway. This is ideal as a gateway for microservices. From this blog post, I will provide a basic understanding and approach for the general use cases of the MGW.</p><p>There are mainly two components for MGW; toolkit and the gateway runtime. The toolkit is to initialize and build MGW projects. When building the project an executable file will be generated and that file will be the input for the gateway runtime in order to expose the API. The toolkit-config.toml file defines the Microgateway toolkit configurations and is located in the &lt;MGW-TK_HOME&gt;/conf directory. The micro-gw.conf file defines the Microgateway runtime configurations and is located in the &lt;MGW-RUNTIME-HOME&gt;/conf directory.</p><p>First of all, we need to install and setup both the toolkit and the gateway runtime. For more information please refer to the documentation [1].</p><h3>So how can we initialize and build a project with APIs?</h3><p>We can build a project with an Open API definition, by importing an API or group of APIs from the APIM side.</p><ol><li><strong>With an Open API definition</strong></li></ol><ul><li>To initialize the project:</li></ul><pre>micro-gw init &lt;Project_Name&gt; -f<br>Ex: micro-gw init petstore -f</pre><ul><li>Copy the swagger file into the &lt;Project_Name&gt;/api_definitions directory. Please refer to the sample swagger in the documentation [2].</li></ul><pre>cp petstore_swagger3.yaml petstore/api_definitions/</pre><ul><li>Build the project</li></ul><pre>micro-gw build &lt;Project_Name&gt;<br>Ex: micro-gw build petstore</pre><p>Results:</p><pre>JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home<br>Generating sources…[DONE]<br>…………………………………………………………………………<br>There are 3 updates available for the product &#39;wso2am-micro-gw-toolkit-macos-3.1.0&#39;.<br>…………………………………………………………………………<br>Compiling source<br>wso2/petstore:3.1.0<br>wso2/jms:0.7.0 [central.ballerina.io -&gt; home repo] [==========&gt;] 4634315/4634315<br>Creating balos<br>target/balo/petstore-2019r3-java8–3.1.0.balo<br>Running tests<br>wso2/petstore:3.1.0<br>No tests found<br>Generating executables<br>target/bin/petstore.jar<br>BUILD SUCCESSFUL<br>Target: /Users/lakmini/Documents/petstore/target/petstore.jar</pre><ul><li>Run the project</li></ul><pre>wso2am-micro-gw-macos-3.1.0/bin/gateway petstore/target/petstore.jar</pre><p>Results (server started with default ports 9090 HTTP and 9095 HTTPS):</p><pre>JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home<br>[ballerina/http] started HTTP/WS listener 0.0.0.0:9090<br>2020–06–15 19:59:36,519 INFO [wso2/gateway] - HTTP listener is active on port 9090<br>[ballerina/http] started HTTPS/WSS listener 0.0.0.0:9095<br>2020–06–15 19:59:36,521 INFO [wso2/gateway] - HTTPS listener is active on port 9095<br>[ballerina/http] started HTTPS/WSS listener 0.0.0.0:9096</pre><p><strong>2. By importing an API from APIM side</strong></p><pre>micro-gw init &lt;Project_Name&gt; -f<br>micro-gw import -a &lt;API_NAme -v &lt;API_version&gt; &lt;Project_Name&gt;<br>micro-gw build &lt;Project_Name&gt;</pre><pre>Ex: <br>micro-gw init MyProject -f<br>micro-gw import -a MyTestAPI -v 1.0 MyProject<br>micro-gw build MyProject</pre><ul><li>Need to upload the valid certificate (or chain of the certificates) of the backend (if existing) to the truststore of the runtime. Please refer to the documentation [4] for more details. Otherwise, there will be errors like below.</li></ul><pre>2020–06–17 11:34:07,807 ERROR [wso2/marketing] - Error in client response : error {ballerina/http}SslError message=SSL connection failed:unable to find valid certification path to requested target run.mocky.io/46.252.181.104:443</pre><p><strong>3. By importing a group of APIs from APIM side</strong></p><ul><li>Create a label from the APIM side and apply that label for the relevant APIs. Please refer to the documentation [3] for more details.</li><li>Initiate, import APIs and build the project</li></ul><pre>micro-gw init &lt;Project_Name&gt; -f<br>micro-gw import -l &lt;Label_Name&gt; &lt;Project_Name&gt;<br>micro-gw build &lt;Project_Name&gt;</pre><pre>Ex: <br>micro-gw init marketing -f<br>micro-gw import -l MARKETING_STORE marketing<br>micro-gw build marketing</pre><h3>OK! We build the project. How can we invoke the API?</h3><p>In order to invoke the API, different security schemes can be used. For example oauth2, API key, JWT, etc. To achieve this purpose, it is needed to update the ‘<strong>securitySchemes’ </strong>and further update the<strong> ‘security’ </strong>section<strong> </strong>of the API resources depending on the requirement like per resource or globally in the API definition file resides under ‘&lt;Project_Name&gt;/gen/api_definitions’ directory after importing the API from APIM side.</p><p>Sample configurations:</p><pre>openapi: 3.0.1<br>info:<br>  title: Test<br>  version: &quot;1.0&quot;<br>servers:<br>- url: /<br><strong>security:<br>- default: []</strong><br>paths:<br>  /*:<br>    get:<br>      responses:<br>        200:<br>          description: OK<br>      <strong>security:<br>      - ApiKeyAuth: []</strong><br>       x-auth-type: Application &amp; Application User<br>       x-throttling-tier: Unlimited<br>       x-wso2-application-security:<br>         security-types:<br>         - oauth2<br>         optional: false<br>    put:<br>      responses:<br>        200:<br>          description: OK<br>      <strong>security:<br>      - default: []</strong><br>      x-auth-type: Application &amp; Application User<br>      x-throttling-tier: Unlimited<br>      x-wso2-application-security:<br>        security-types:<br>        - oauth2<br>        optional: false</pre><pre>..........</pre><pre>components:<br>  <strong>securitySchemes:<br>    default:<br>      type: oauth2<br>      flows:<br>        implicit:<br>          authorizationUrl: </strong><a href="https://test.com/"><strong>https://test.com</strong></a><br>    <strong>ApiKeyAuth:</strong>        # arbitrary name for the security scheme<br>      <strong>type: apiKey</strong><br>      <strong>in: header</strong>       # can be &quot;header&quot; or &quot;query&quot;<br>      <strong>name: X-API-KEY</strong>  # name of the header, query parameter or cookie<br>    appId:             # you can define several apikey security schemas<br>      type: apiKey<br>      in: header<br>      name: X-APP-ID</pre><ul><li>Invoke the API with API-Key</li></ul><p>If a resource has been configured to use API key as the security schema that resource can be invoked with an API key (GET /* resource as in the above configuration).</p><pre>TOKEN=$(curl -X get &quot;https://&lt;Hostname&gt;:&lt;Default_9095_port&gt;/apikey&quot; -H &quot;Authorization:Basic &lt;Base64 encoded(username:password)&gt;&quot; -k)</pre><pre>curl -X GET &quot;https://&lt;Hostname&gt;:&lt;Default_9095_port&gt;/&lt;base_path_of_the_API&gt;/&lt;Resource_path&gt;&quot; -H &quot;accept: application/xml&quot; -H &quot;api_key:$TOKEN&quot; -k</pre><pre>Ex: TOKEN=$(curl -X get &quot;<a href="https://localhost:9095/apikey">https://localhost:9095/apikey</a>&quot; -H &quot;Authorization:Basic YWRtaW46YWRtaW4=&quot; -k)</pre><pre>curl -X GET &quot;https://localhost:9095/test/1.0&quot; -H &quot;accept: application/xml&quot; -H &quot;api_key:$TOKEN&quot; -k</pre><ul><li>Invoke the API with oauth2 token</li></ul><p>If a resource has been configured to use oauth2 as the security schema that resource can be invoked with an oauth2 token (Let’s say if the above GET /* resource configured for <strong>security: — default: [] </strong>given that securitySchema section has already configured oauth2 as the default schema).</p><pre>curl -X GET &quot;<a href="https://localhost:9095/test/1.0/*">https://localhost:9095/test/1.0/*</a>&quot; -H “accept: */*&quot; -H &quot;Authorization: Bearer e27c4a36–8072–3d9c-9b5f-64a9aed08b77&quot; -k</pre><p>If the configured security schema for the resource and the method used to invoke the API is different, it is not allowed to invoke the API successfully. Sample error:</p><pre>{&quot;fault&quot;:{&quot;code&quot;:900917, &quot;message&quot;:&quot;Invalid Authentication scheme&quot;, &quot;description&quot;:&quot;Invalid Authentication scheme. API can not be used with this authentication scheme&quot;}}</pre><h3>Import and invoke API with backend secured basic authentication</h3><p>Moreover, if it is needed to invoke the API with a basic authenticated backend [5], we have to update the API-definition and start the runtime accordingly.</p><p>Sample configuration:</p><pre>x-wso2-basePath: /testApi/1.0<br><strong>x-wso2-production-endpoints: &quot;#/x-wso2-endpoints/myEndpoint&quot;</strong><br>....<br><strong>x-wso2-endpoints:<br> - myEndpoint:<br>    urls:<br>    - </strong><a href="http://www.mocky.io/v2/5cfe1b5f320000650045ee70"><strong>http://www.mocky.io/v2/5cfe1b5f320000650045ee70</strong></a><strong><br>    securityConfig:<br>      type: basic<br>      username: admin</strong></pre><p>When starting the runtime, it is needed to pass the password value as it is not configured in the API-definition due to security concerns.</p><pre>wso2am-micro-gw-macos-3.1.0/bin/gateway &lt;Pathe_to_the_executable_file&gt; — &lt;Endpoint_Name&gt;_&lt;Endpoint_Type&gt;_&lt;securityConfig_Type&gt;_password=&lt;Password&gt;</pre><pre>Ex: wso2am-micro-gw-macos-3.1.0/bin/gateway MyProject/target/MyProject.jar - myEndpoint_prod_basic_password=admin</pre><ul><li><strong>Enabling Debug logs and Trace logs for troubleshooting purposes:</strong></li><li>Debug logs</li></ul><pre>wso2am-micro-gw-macos-3.1.0/bin/gateway petstore/target/petstore.jar — b7a.log.level=DEBUG</pre><p>Results:</p><pre>JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home<br>2020–06–15 20:46:14,031 DEBUG [ballerina/http/caching] - Created HTTP caching client: object http:HttpCachingClient<br>2020–06–15 20:46:14,039 DEBUG [ballerina/http/caching] - Created HTTP caching client: object http:HttpCachingClient<br>2020–06–15 20:46:14,042 DEBUG [ballerina/http/caching] - Created HTTP caching client: object http:HttpCachingClient</pre><ul><li>Trace logs</li></ul><pre>wso2am-micro-gw-macos-3.1.0/bin/gateway petstore/target/petstore.jar - b7a.http.tracelog.console=true</pre><p>Results:</p><pre>JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home<br>ballerina: HTTP trace log enabled<br>[ballerina/http] started HTTP/WS listener 0.0.0.0:9090<br>2020–06–15 20:46:31,080 INFO [wso2/gateway] - HTTP listener is active on port 9090<br>[ballerina/http] started HTTPS/WSS listener 0.0.0.0:9095<br>2020–06–15 20:46:31,082 INFO [wso2/gateway] - HTTPS listener is active on port 9095<br>[ballerina/http] started HTTPS/WSS listener 0.0.0.0:9096<br>[2020–06–15 20:46:42,575] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] OUTBOUND SETTINGS: ack=false settings={MAX_HEADER_LIST_SIZE=8192}<br>[2020–06–15 20:46:42,581] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] INBOUND SETTINGS: ack=false settings={ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1073741824}<br>[2020–06–15 20:46:42,583] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] OUTBOUND SETTINGS: ack=true<br>[2020–06–15 20:46:42,584] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] INBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=1073676289<br>[2020–06–15 20:46:42,589] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] INBOUND HEADERS: streamId=1 headers=DefaultHttp2Headers[:method: GET, :path: /petstore/v1/pet/1, :scheme: https, :authority: localhost:9095, user-agent: curl/7.54.0, accept: application/xml, api_key: eyJhbGciOiJSUzI1NiIsICJ0eXAiOiJqd3QiLCAia2lkIjoiYmFsbGVyaW5hIn0.eyJzdWIiOiJhZG1pbiIsICJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo5MDk1L2FwaWtleSIsICJpYXQiOjE1OTIyMzE1ODUsICJqdGkiOiJiMWI3MTMyNy0zZmViLTRjODgtYTE5My05ZTJiZjVkZjQ5NzkiLCAia2V5dHlwZSI6IlBST0RVQ1RJT04iLCAiYWxsb3dlZEFQSXMiOltdfQ.EG7vi9a_fygV_EFBgZazvq1NitxZIRJ_WnM0Vc-9g7285C5On1rMqgMeTm_qS_nYNRIma1yhCqGzRGvUJNJXwtQlXhcg4EyUlsljrTXe6FK8jjqru4c7T3-ilObVtUGBotqirAvpMaqUXI-YFB4gFNdNW-iYj2zFUw-ChMGPVIETQ1Yi8p9uiPr23wykx54bU-dkPVaz6jZUUuZmX9dy0sOoEj5AjDyzLZBGVjUrSqZX2WfVr1b3jnjA-ZU4QPYJCDnEGuRdprs-yjsTTyP9NGe9l6ft8gK0y_CVSNsQeuBZhAGEWySz3D16X4XbPmWplV5w0Yxw4rnskDNLXxlOrw] padding=0 endStream=true<br>[2020–06–15 20:46:42,625] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] INBOUND SETTINGS: ack=true<br>[2020–06–15 20:46:44,028] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: n/a, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] DEREGISTER<br>[2020–06–15 20:46:44,031] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: n/a, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] USER_EVENT: SslHandshakeCompletionEvent(SUCCESS)<br>[2020–06–15 20:46:44,032] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: n/a, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] READ COMPLETE<br>[2020–06–15 20:46:44,033] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: n/a, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] UNREGISTERED<br>[2020–06–15 20:46:44,033] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0] REGISTERED<br>[2020–06–15 20:46:44,042] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] OUTBOUND: DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)<br>GET /v2/pet/1 HTTP/1.1<br>accept: application/xml<br>api_key: eyJhbGciOiJSUzI1NiIsICJ0eXAiOiJqd3QiLCAia2lkIjoiYmFsbGVyaW5hIn0.eyJzdWIiOiJhZG1pbiIsICJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo5MDk1L2FwaWtleSIsICJpYXQiOjE1OTIyMzE1ODUsICJqdGkiOiJiMWI3MTMyNy0zZmViLTRjODgtYTE5My05ZTJiZjVkZjQ5NzkiLCAia2V5dHlwZSI6IlBST0RVQ1RJT04iLCAiYWxsb3dlZEFQSXMiOltdfQ.EG7vi9a_fygV_EFBgZazvq1NitxZIRJ_WnM0Vc-9g7285C5On1rMqgMeTm_qS_nYNRIma1yhCqGzRGvUJNJXwtQlXhcg4EyUlsljrTXe6FK8jjqru4c7T3-ilObVtUGBotqirAvpMaqUXI-YFB4gFNdNW-iYj2zFUw-ChMGPVIETQ1Yi8p9uiPr23wykx54bU-dkPVaz6jZUUuZmX9dy0sOoEj5AjDyzLZBGVjUrSqZX2WfVr1b3jnjA-ZU4QPYJCDnEGuRdprs-yjsTTyP9NGe9l6ft8gK0y_CVSNsQeuBZhAGEWySz3D16X4XbPmWplV5w0Yxw4rnskDNLXxlOrw<br>x-http2-stream-id: 1<br>host: petstore.swagger.io<br>user-agent: ballerina<br>connection: keep-alive<br>[2020–06–15 20:46:44,046] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] OUTBOUND: DefaultLastHttpContent(data: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 0, cap: 0), decoderResult: success), 0B<br>[2020–06–15 20:46:44,046] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] FLUSH<br>[2020–06–15 20:46:44,331] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] INBOUND: DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)<br>HTTP/1.1 200 OK<br>Access-Control-Allow-Headers: Content-Type, api_key, Authorization<br>Access-Control-Allow-Methods: GET, POST, DELETE, PUT<br>Access-Control-Allow-Origin: *<br>Content-Type: application/xml<br>Date: Mon, 15 Jun 2020 15:16:44 GMT<br>Server: Jetty(9.2.9.v20150224)<br>transfer-encoding: chunked<br>Connection: keep-alive<br>[2020–06–15 20:46:44,333] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] INBOUND: DefaultHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 274, cap: 274/274, unwrapped: PooledUnsafeDirectByteBuf(ridx: 606, widx: 611, cap: 669)), decoderResult: success), 274B<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;&lt;Pet&gt;&lt;category&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;string&lt;/name&gt;&lt;/category&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;doggie&lt;/name&gt;&lt;photoUrls&gt;&lt;photoUrl&gt;string&lt;/photoUrl&gt;&lt;/photoUrls&gt;&lt;status&gt;available&lt;/status&gt;&lt;tags&gt;&lt;tag&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;string&lt;/name&gt;&lt;/tag&gt;&lt;/tags&gt;&lt;/Pet&gt;<br>[2020–06–15 20:46:44,335] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] INBOUND: EmptyLastHttpContent, 0B<br>[2020–06–15 20:46:44,336] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] READ COMPLETE<br>[2020–06–15 20:46:44,342] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] OUTBOUND HEADERS: streamId=1 headers=DefaultHttp2Headers[:status: 200, access-control-allow-headers: Content-Type, api_key, Authorization, access-control-allow-methods: GET, POST, DELETE, PUT, access-control-allow-origin: *, content-type: application/xml, date: Mon, 15 Jun 2020 15:16:44 GMT, server: Jetty(9.2.9.v20150224)] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false<br>[2020–06–15 20:46:44,346] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] OUTBOUND DATA: streamId=1 padding=0 endStream=false length=274 data=274B<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;&lt;Pet&gt;&lt;category&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;string&lt;/name&gt;&lt;/category&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;doggie&lt;/name&gt;&lt;photoUrls&gt;&lt;photoUrl&gt;string&lt;/photoUrl&gt;&lt;/photoUrls&gt;&lt;status&gt;available&lt;/status&gt;&lt;tags&gt;&lt;tag&gt;&lt;id&gt;1&lt;/id&gt;&lt;name&gt;string&lt;/name&gt;&lt;/tag&gt;&lt;/tags&gt;&lt;/Pet&gt;<br>[2020–06–15 20:46:44,347] TRACE {http.tracelog.downstream} - [id: 0xd2c05b02, L:/127.0.0.1:9095 - R:/127.0.0.1:63431] OUTBOUND DATA: streamId=1 padding=0 endStream=true length=0 data= 0B<br>[2020–06–15 20:47:44,578] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] USER_EVENT: SslCloseCompletionEvent(SUCCESS)<br>[2020–06–15 20:47:44,579] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] READ COMPLETE<br>[2020–06–15 20:47:44,836] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] READ COMPLETE<br>[2020–06–15 20:47:44,836] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] INACTIVE<br>[2020–06–15 20:47:44,837] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] CLOSE<br>[2020–06–15 20:47:44,838] TRACE {http.tracelog.upstream} - [id: 0x32fc79c0, correlatedSource: 0xd2c05b02, host:/192.168.8.100:63432 - remote:petstore.swagger.io/54.165.222.185:443] UNREGISTERED</pre><p>Hope you find the blog post useful! As you are now own the basic understanding now you can look into the MGW deeply!!</p><p><strong>References:</strong></p><p>[1] <a href="https://docs.wso2.com/display/MG310/Install+and+Setup">https://docs.wso2.com/display/MG310/Install+and+Setup</a></p><p>[2] <a href="https://github.com/wso2/product-microgateway/blob/master/samples/petstore_swagger3.yaml">https://github.com/wso2/product-microgateway/blob/master/samples/petstore_swagger3.yaml</a></p><p>[3] <a href="https://apim.docs.wso2.com/en/latest/learn/api-microgateway/grouping-apis-with-labels/">https://apim.docs.wso2.com/en/latest/learn/api-microgateway/grouping-apis-with-labels/</a></p><p>[4] <a href="https://docs.wso2.com/display/MG310/Importing+Certificates+to+the+API+Microgateway+Truststore">https://docs.wso2.com/display/MG310/Importing+Certificates+to+the+API+Microgateway+Truststore</a></p><p>[5] <a href="https://apim.docs.wso2.com/en/latest/learn/design-api/endpoints/endpoint-security/basic-auth/#secure-endpoint-with-basic-auth">https://apim.docs.wso2.com/en/latest/learn/design-api/endpoints/endpoint-security/basic-auth/#secure-endpoint-with-basic-auth</a></p><p>[6] <a href="https://docs.wso2.com/display/MG310/Troubleshooting#Troubleshooting-proj-duplication">https://docs.wso2.com/display/MG310/Troubleshooting</a></p><p>[7] <a href="https://docs.wso2.com/display/MG310/FAQs">https://docs.wso2.com/display/MG310/FAQs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6003921eb2f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSO2 APIM based Mutual SSL]]></title>
            <link>https://wathsalakoralege.medium.com/wso2-apim-based-mutual-ssl-4e1d6b8f3469?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e1d6b8f3469</guid>
            <category><![CDATA[apim]]></category>
            <category><![CDATA[mutual-ssl]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Sat, 27 Jun 2020 16:57:06 GMT</pubDate>
            <atom:updated>2020-06-27T16:57:06.161Z</atom:updated>
            <content:encoded><![CDATA[<p>From this blog post, I will try to brief what are the prominent features included in WSO2 API Manager based on Mutual SSL. Since I observed some conflicts in Mutual SSL understanding and configurations, it was encouraged for this effort.</p><p><strong>SSL (Secure Socket Layer)</strong> is the standard technology used for enabling secured communication between a client and server to ensure data security &amp; integrity. For ensuring the security of the data being transferred between a client and server, SSL can be implemented either one-way or two-way.</p><p>In one way SSL, only the client validates the server to ensure that it receives data from the intended server. For implementing a one-way SSL, the server shares its public certificate with the clients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*udX-mVEGFgIZH7NID3ymBQ.png" /></figure><p>In this way, we can conclude the handshake messages used by both client and server to establish the encrypted channel before message exchanging as below.</p><ol><li>Client sends ClientHello message proposing SSL options.</li><li>Server responds with ServerHello message selecting the SSL options.</li><li>Server sends Certificate message, which contains the server&#39;s certificate.</li><li>Server concludes its part of the negotiation with ServerHelloDone message.</li><li>The client sends session key information (encrypted with server’s public key) in ClientKeyExchange message.</li><li>Client sends ChangeCipherSpec message to activate the negotiated options for all future messages it will send.</li><li>The client sends Finished message to let the server check the newly activated options.</li><li>Server sends ChangeCipherSpec message to activate the negotiated options for all future messages it will send.</li><li>The server sends Finished message to let the client check the newly activated options.</li></ol><p>In the two-way SSL (Mutual SSL), both client and server authenticate each other to ensure that both parties involved in the communication are trusted. Both parties share their public certificates and then validation is performed based on that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*EubsLMdOvxWUosglkcGonQ.png" /></figure><p>Here also we can conclude the handshake messages used by both client and server to establish the encrypted channel before message exchanging as below.</p><ol><li>The client sends ClientHello message proposing SSL options.</li><li>The server responds with ServerHello message selecting the SSL options.</li><li>The server sends Certificate message, which contains the server&#39;s certificate.</li><li>The server requests the client’s certificate in CertificateRequest message, so that the connection can be mutually authenticated.</li><li>The server concludes its part of the negotiation with ServerHelloDone message.</li><li>The client responds with Certificate message, which contains the client&#39;s certificate.</li><li>The client sends session key information (encrypted with server’s public key) in ClientKeyExchange message.</li><li>The client sends a CertificateVerify message to let the server know it owns the sent certificate.</li><li>Client sends ChangeCipherSpec message to activate the negotiated options for all future messages it will send.</li><li>The client sends Finished message to let the server check the newly activated options.</li><li>Server sends ChangeCipherSpec message to activate the negotiated options for all future messages it will send.</li><li>The server sends Finished message to let the client check the newly activated options.</li></ol><p>Example after enabling SSL debug logs (In Ubuntu: nohup ./wso2server.sh -Djavax.net.debug=ssl:handshake &amp;):</p><pre>Using SSLEngineImpl.<br>Allow unsafe renegotiation: false<br>Allow legacy hello messages: true<br>Is initial handshake: true<br>Is secure renegotiation: false<br>Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1<br>Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1<br>Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1<br>Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1<br>Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1<br>Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1<br>Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1<br>Ignoring unsupported cipher suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 for TLSv1.1<br>Ignoring unsupported cipher suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 for TLSv1.1<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1 Handshake, length = 293<br>check handshake state: client_hello[1]<br>update handshake state: client_hello[1]<br>upcoming handshake states: server_hello[2]<br>*** <strong>ClientHello</strong>, TLSv1.2<br>RandomCookie: GMT: 897048464 bytes = { 235, 126, 51, 182, 147, 10, 153, 185, 133, 185, 71, 48, 92, 145, 40, 83, 217, 136, 83, 175, 97, 156, 20, 240, 166, 62, 36, 25 }<br>Session ID: {94, 175, 175, 7, 6, 68, 142, 45, 255, 87, 153, 236, 213, 125, 255, 64, 220, 160, 243, 135, 11, 17, 7, 107, 255, 149, 36, 87, 246, 32, 188, 183}<br>Cipher Suites: [TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_DH_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DH_RSA_WITH_AES_256_CBC_SHA256, TLS_DH_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DH_RSA_WITH_AES_256_CBC_SHA, TLS_DH_DSS_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_DH_DSS_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_DH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_DH_RSA_WITH_AES_128_CBC_SHA256, TLS_DH_DSS_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_DH_RSA_WITH_AES_128_CBC_SHA, TLS_DH_DSS_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]<br>Compression Methods: { 0 }<br>Extension server_name, server_name: [type=host_name (0), value=192.168.8.101]<br>Extension ec_point_formats, formats: [uncompressed, ansiX962_compressed_prime, ansiX962_compressed_char2]<br>Extension elliptic_curves, curve names: {secp256r1, secp521r1, unknown curve 28, unknown curve 27, secp384r1, unknown curve 26, secp256k1, sect571r1, sect571k1, sect409k1, sect409r1, sect283k1, sect283r1}<br>Unsupported extension type_35, data: <br>Extension signature_algorithms, signature_algorithms: SHA512withRSA, Unknown (hash:0x6, signature:0x2), SHA512withECDSA, SHA384withRSA, Unknown (hash:0x5, signature:0x2), SHA384withECDSA, SHA256withRSA, SHA256withDSA, SHA256withECDSA, SHA224withRSA, SHA224withDSA, SHA224withECDSA, SHA1withRSA, SHA1withDSA, SHA1withECDSA<br>Unsupported extension type_13172, data: <br>***<br>%% Initialized: [Session-12, SSL_NULL_WITH_NULL_NULL]<br>matching alias: wso2carbon<br>Standard ciphersuite chosen: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256<br>%% Negotiating: [Session-12, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256]<br>*** <strong>ServerHello</strong>, TLSv1.2<br>RandomCookie: GMT: 1571729637 bytes = { 137, 86, 54, 154, 76, 247, 158, 62, 85, 134, 2, 143, 74, 170, 21, 48, 192, 251, 222, 132, 242, 119, 199, 212, 160, 195, 111, 124 }<br>Session ID: {94, 175, 177, 229, 204, 238, 10, 148, 246, 247, 93, 116, 40, 13, 1, 75, 125, 147, 25, 45, 50, 121, 20, 216, 157, 167, 79, 61, 68, 42, 141, 24}<br>Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256<br>Compression Method: 0<br>Extension renegotiation_info, renegotiated_connection: &lt;empty&gt;<br>***<br>Cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256<br>update handshake state: server_hello[2]<br>upcoming handshake states: server certificate[11]<br>upcoming handshake states: server_key_exchange[12](optional)<br>upcoming handshake states: certificate_request[13](optional)<br>upcoming handshake states: server_hello_done[14]<br>upcoming handshake states: client certificate[11](optional)<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>Certificate</strong> chain<br>chain [0] = [<br>[<br> Version: V3<br> Subject: CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US<br> Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11</pre><pre>Key: Sun RSA public key, 2048 bits<br> modulus: 19049296766410219965113059550253073150157820443657864104004676207726193654461950115645745279320134751408624117470981180372194928225695953081013032599576993268550361790110613358270730467477076484222212606589554590173309384388977329346674298830195238331879794351264115399907472880236580933941802706762817712485341248880031821538970083369065737253391633147785048475653024194434652208057444151666400537584953268265192996642559133427898438556878384604452936792935532437313812326127264414343774887909483101263513387117201488508589569627005696586937864733503494525495180362440893689653813597370754173262818732992190707314633<br> public exponent: 65537<br> Validity: [From: Wed Jul 19 12:22:51 IST 2017,<br> To: Sat Jul 17 12:22:51 IST 2027]<br> Issuer: CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US<br> SerialNumber: [ 0282d0fd]</pre><pre>Certificate Extensions: 1<br>[1]: ObjectId: 2.5.29.14 Criticality=false<br>SubjectKeyIdentifier [<br>KeyIdentifier [<br>0000: B5 2F 24 21 8C 50 F1 45 6F 56 B6 52 76 0C A2 75 ./$!.P.EoV.Rv..u<br>0010: EF 4E 1F 15 .N..<br>]<br>]</pre><pre>]<br> Algorithm: [SHA256withRSA]<br> Signature:<br>0000: 17 E4 E6 6A AC 55 4A E9 14 26 13 65 98 4E C5 34 …j.UJ..&amp;.e.N.4<br>0010: 51 A4 65 EA A1 6D 46 D3 96 CE C4 7C 6C E3 63 DA Q.e..mF…..l.c.<br>0020: C7 0F 2B 00 9D 3A 3E DC BD 8E A3 35 0A 04 4F A6 ..+..:&gt;….5..O.<br>0030: AB D9 6B 69 4F 40 14 2A 66 B1 E4 74 31 34 EA AE ..kiO@.*f..t14..<br>0040: 0D 1B 40 EA 30 7F 0D 4F EB 4D 91 70 5E F5 84 EB ..@.0..O.M.p^…<br>0050: 7B 71 09 09 27 EC BE CC 2D 2D 50 D9 EC 60 EF 4C .q..’… — P..`.L<br>0060: 72 A8 8C 98 D0 BD D5 42 CD 18 FA 5C 7E 53 AE EC r……B…\.S..<br>0070: 1E 7D BE 01 27 3F 40 3E D9 E5 C8 92 2F 8C 79 35 ….’?@&gt;…./.y5<br>0080: 85 DA 33 AB 23 A7 89 56 5D D1 03 B1 2C 06 DC 76 ..3.#..V]…,..v<br>0090: DF 78 E9 C8 4D 75 0B C2 9B A6 94 3A 9B AD A7 C5 .x..Mu…..:….<br>00A0: E8 82 BD 0A 06 71 32 DD 4F 1E B3 67 00 7C D6 5A …..q2.O..g…Z<br>00B0: 12 43 D4 F1 56 B9 6D 4E 97 8E 7C BC CC 64 27 5C .C..V.mN…..d’\<br>00C0: 25 F1 3C AA 7B B0 CA 60 3B DD E7 3C 1B 7F 96 25 %.&lt;….`;..&lt;…%<br>00D0: F5 A9 FC 97 33 BC 44 A2 D5 A8 C6 69 BA 1D 9C 7C ….3.D….i….<br>00E0: A1 64 3C 53 96 A2 5E 36 79 44 A0 D6 08 2A B8 66 .d&lt;S..⁶yD…*.f<br>00F0: E5 E5 EB 05 6C 53 3D 62 13 AD 6C B8 EE 72 5A 2F ….lS=b..l..rZ/</pre><pre>]<br>***<br>update handshake state: certificate[11]<br>upcoming handshake states: server_key_exchange[12](optional)<br>upcoming handshake states: certificate_request[13](optional)<br>upcoming handshake states: server_hello_done[14]<br>upcoming handshake states: client certificate[11](optional)<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** ECDH ServerKeyExchange<br>Signature Algorithm SHA512withRSA<br>Server key: Sun EC public key, 256 bits<br> public x coord: 44778816970088541569851315587661753613931545764553647511844644979829125842598<br> public y coord: 32161938990122657605849408761749283148837204309706737601271544141376707308080<br> parameters: secp256r1 [NIST P-256, X9.62 prime256v1] (1.2.840.10045.3.1.7)<br>update handshake state: server_key_exchange[12]<br>upcoming handshake states: certificate_request[13](optional)<br>upcoming handshake states: server_hello_done[14]<br>upcoming handshake states: client certificate[11](optional)<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>CertificateRequest</strong><br>Cert Types: RSA, DSS, ECDSA<br>Supported Signature Algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA224withECDSA, SHA224withRSA, SHA224withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA<br>Cert Authorities:<br>&lt;CN=Equifax Secure Global eBusiness CA-1, O=Equifax Secure Inc., C=US&gt;<br>&lt;CN=SecureTrust CA, O=SecureTrust Corporation, C=US&gt;<br>&lt;CN=Entrust Root Certification Authority — EC1, OU=”© 2012 Entrust, Inc. — for authorized use only”, OU=See <a href="http://www.entrust.net/legal-terms">www.entrust.net/legal-terms</a>, O=”Entrust, Inc.”, C=US&gt;<br>&lt;OU=Security Communication RootCA1, O=SECOM Trust.net, C=JP&gt;<br>&lt;CN=DigiCert Global Root CA, OU=<a href="http://www.digicert.com/">www.digicert.com</a>, O=DigiCert Inc, C=US&gt;<br>&lt;CN=GeoTrust Primary Certification Authority, O=GeoTrust Inc., C=US&gt;<br>&lt;OU=Security Communication RootCA2, O=”SECOM Trust Systems CO.,LTD.”, C=JP&gt;<br>&lt;OU=VeriSign Trust Network, OU=”© 1998 VeriSign, Inc. — For authorized use only”, OU=Class 3 Public Primary Certification Authority — G2, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;OU=ePKI Root Certification Authority, O=”Chunghwa Telecom Co., Ltd.”, C=TW&gt;<br>&lt;CN=AffirmTrust Commercial, O=AffirmTrust, C=US&gt;<br>&lt;CN=Certum Trusted Network CA, OU=Certum Certification Authority, O=Unizeto Technologies S.A., C=PL&gt;<br>&lt;CN=XRamp Global Certification Authority, O=XRamp Security Services Inc, OU=<a href="http://www.xrampsecurity.com/">www.xrampsecurity.com</a>, C=US&gt;<br>&lt;CN=Sonera Class2 CA, O=Sonera, C=FI&gt;<br>&lt;CN=America Online Root Certification Authority 1, O=America Online Inc., C=US&gt;<br>&lt;CN=GeoTrust Primary Certification Authority — G2, OU=© 2007 GeoTrust Inc. — For authorized use only, O=GeoTrust Inc., C=US&gt;<br>&lt;OU=Equifax Secure Certificate Authority, O=Equifax, C=US&gt;<br>&lt;CN=COMODO ECC Certification Authority, O=COMODO CA Limited, L=Salford, ST=Greater Manchester, C=GB&gt;<br>&lt;CN=DigiCert High Assurance EV Root CA, OU=<a href="http://www.digicert.com/">www.digicert.com</a>, O=DigiCert Inc, C=US&gt;<br>&lt;CN=GeoTrust Universal CA, O=GeoTrust Inc., C=US&gt;<br>&lt;CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA — R3&gt;<br>&lt;CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE&gt;<br>&lt;OU=Starfield Class 2 Certification Authority, O=”Starfield Technologies, Inc.”, C=US&gt;<br>&lt;CN=Thawte Timestamping CA, OU=Thawte Certification, O=Thawte, L=Durbanville, ST=Western Cape, C=ZA&gt;<br>&lt;CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB&gt;<br>&lt;CN=UTN-USERFirst-Hardware, OU=<a href="http://www.usertrust.com/">http://www.usertrust.com</a>, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US&gt;<br>&lt;CN=Chambers of Commerce Root, OU=<a href="http://www.chambersign.org/">http://www.chambersign.org</a>, O=AC Camerfirma SA CIF A82743287, C=EU&gt;<br>&lt;CN=VeriSign Class 3 Public Primary Certification Authority — G3, OU=”© 1999 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=GlobalSign Root CA, OU=Root CA, O=GlobalSign nv-sa, C=BE&gt;<br>&lt;CN=UTN-USERFirst-Object, OU=<a href="http://www.usertrust.com/">http://www.usertrust.com</a>, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US&gt;<br>&lt;CN=AffirmTrust Networking, O=AffirmTrust, C=US&gt;<br>&lt;CN=AffirmTrust Premium, O=AffirmTrust, C=US&gt;<br>&lt;CN=Baltimore CyberTrust Code Signing Root, OU=CyberTrust, O=Baltimore, C=IE&gt;<br>&lt;CN=America Online Root Certification Authority 2, O=America Online Inc., C=US&gt;<br>&lt;CN=LuxTrust Global Root, O=LuxTrust s.a., C=LU&gt;<br>&lt;CN=GeoTrust Primary Certification Authority — G3, OU=© 2008 GeoTrust Inc. — For authorized use only, O=GeoTrust Inc., C=US&gt;<br>&lt;CN=Chambers of Commerce Root — 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at <a href="http://www.camerfirma.com/address">www.camerfirma.com/address</a>), C=EU&gt;<br>&lt;CN=SwissSign Silver CA — G2, O=SwissSign AG, C=CH&gt;<br>&lt;CN=Entrust Root Certification Authority — G2, OU=”© 2009 Entrust, Inc. — for authorized use only”, OU=See <a href="http://www.entrust.net/legal-terms">www.entrust.net/legal-terms</a>, O=”Entrust, Inc.”, C=US&gt;<br>&lt;CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US&gt;<br>&lt;CN=DigiCert Assured ID Root CA, OU=<a href="http://www.digicert.com/">www.digicert.com</a>, O=DigiCert Inc, C=US&gt;<br>&lt;OU=Go Daddy Class 2 Certification Authority, O=”The Go Daddy Group, Inc.”, C=US&gt;<br>&lt;CN=AddTrust External CA Root, OU=AddTrust External TTP Network, O=AddTrust AB, C=SE&gt;<br>&lt;CN=T-TeleSec GlobalRoot Class 3, OU=T-Systems Trust Center, O=T-Systems Enterprise Services GmbH, C=DE&gt;<br>&lt;CN=UTN-USERFirst-Client Authentication and Email, OU=<a href="http://www.usertrust.com/">http://www.usertrust.com</a>, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US&gt;<br>&lt;CN=Class 2 Primary CA, O=Certplus, C=FR&gt;<br>&lt;CN=GeoTrust Global CA, O=GeoTrust Inc., C=US&gt;<br>&lt;CN=SwissSign Platinum CA — G2, O=SwissSign AG, C=CH&gt;<br>&lt;CN=GlobalSign, O=GlobalSign, OU=GlobalSign ECC Root CA — R5&gt;<br>&lt;CN=Starfield Root Certificate Authority — G2, O=”Starfield Technologies, Inc.”, L=Scottsdale, ST=Arizona, C=US&gt;<br>&lt;CN=VeriSign Class 2 Public Primary Certification Authority — G3, OU=”© 1999 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=Entrust.net Certification Authority (2048), OU=© 1999 Entrust.net Limited, OU=<a href="http://www.entrust.net/CPS_2048">www.entrust.net/CPS_2048</a> incorp. by ref. (limits liab.), O=Entrust.net&gt;<br>&lt;CN=thawte Primary Root CA, OU=”© 2006 thawte, Inc. — For authorized use only”, OU=Certification Services Division, O=”thawte, Inc.”, C=US&gt;<br>&lt;CN=Go Daddy Root Certificate Authority — G2, O=”GoDaddy.com, Inc.”, L=Scottsdale, ST=Arizona, C=US&gt;<br>&lt;CN=VeriSign Class 1 Public Primary Certification Authority — G3, OU=”© 1999 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=VeriSign Class 3 Public Primary Certification Authority — G4, OU=”© 2007 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=localhost, OU=apim, O=wso2, L=colombo, ST=western, C=sl&gt;<br>&lt;CN=Entrust Root Certification Authority, OU=”© 2006 Entrust, Inc.”, OU=<a href="http://www.entrust.net/CPS">www.entrust.net/CPS</a> is incorporated by reference, O=”Entrust, Inc.”, C=US&gt;<br>&lt;CN=Certum CA, O=Unizeto Sp. z o.o., C=PL&gt;<br>&lt;CN=AddTrust Qualified CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE&gt;<br>&lt;CN=Buypass Class 2 Root CA, O=Buypass AS-983163327, C=NO&gt;<br>&lt;CN=SwissSign Gold CA — G2, O=SwissSign AG, C=CH&gt;<br>&lt;CN=USERTrust ECC Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US&gt;<br>&lt;CN=UTN — DATACorp SGC, OU=<a href="http://www.usertrust.com/">http://www.usertrust.com</a>, O=The USERTRUST Network, L=Salt Lake City, ST=UT, C=US&gt;<br>&lt;CN=QuoVadis Root CA 2, O=QuoVadis Limited, C=BM&gt;<br>&lt;CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US&gt;<br>&lt;CN=Deutsche Telekom Root CA 2, OU=T-TeleSec Trust Center, O=Deutsche Telekom AG, C=DE&gt;<br>&lt;OU=Class 1 Public Primary Certification Authority, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=USERTrust RSA Certification Authority, O=The USERTRUST Network, L=Jersey City, ST=New Jersey, C=US&gt;<br>&lt;OU=VeriSign Trust Network, OU=”© 1998 VeriSign, Inc. — For authorized use only”, OU=Class 2 Public Primary Certification Authority — G2, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=VeriSign Class 3 Public Primary Certification Authority — G5, OU=”© 2006 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA — R2&gt;<br>&lt;CN=QuoVadis Root CA 3, O=QuoVadis Limited, C=BM&gt;<br>&lt;CN=Starfield Services Root Certificate Authority — G2, O=”Starfield Technologies, Inc.”, L=Scottsdale, ST=Arizona, C=US&gt;<br>&lt;CN=Swisscom Root CA 2, OU=Digital Certificate Services, O=Swisscom, C=ch&gt;<br>&lt;CN=Actalis Authentication Root CA, O=Actalis S.p.A./03358520967, L=Milan, C=IT&gt;<br>&lt;OU=Class 3 Public Primary Certification Authority, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=QuoVadis Root Certification Authority, OU=Root Certification Authority, O=QuoVadis Limited, C=BM&gt;<br>&lt;CN=Class 3P Primary CA, O=Certplus, C=FR&gt;<br>&lt;CN=Equifax Secure eBusiness CA-1, O=Equifax Secure Inc., C=US&gt;<br>&lt;CN=Buypass Class 3 Root CA, O=Buypass AS-983163327, C=NO&gt;<br>&lt;OU=Security Communication EV RootCA1, O=”SECOM Trust Systems CO.,LTD.”, C=JP&gt;<br>&lt;CN=thawte Primary Root CA — G2, OU=”© 2007 thawte, Inc. — For authorized use only”, O=”thawte, Inc.”, C=US&gt;<br>&lt;CN=Swisscom Root EV CA 2, OU=Digital Certificate Services, O=Swisscom, C=ch&gt;<br>&lt;CN=VeriSign Universal Root Certification Authority, OU=”© 2008 VeriSign, Inc. — For authorized use only”, OU=VeriSign Trust Network, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=AddTrust Class 1 CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE&gt;<br>&lt;CN=GlobalSign, O=GlobalSign, OU=GlobalSign ECC Root CA — R4&gt;<br>&lt;CN=Global Chambersign Root — 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at <a href="http://www.camerfirma.com/address">www.camerfirma.com/address</a>), C=EU&gt;<br>&lt;CN=COMODO RSA Certification Authority, O=COMODO CA Limited, L=Salford, ST=Greater Manchester, C=GB&gt;<br>&lt;CN=thawte Primary Root CA — G3, OU=”© 2008 thawte, Inc. — For authorized use only”, OU=Certification Services Division, O=”thawte, Inc.”, C=US&gt;<br>&lt;<a href="/service/mailto:EMAILADDRESS=premium-server@thawte.com">EMAILADDRESS=premium-server@thawte.com</a>, CN=Thawte Premium Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA&gt;<br>&lt;CN=GTE CyberTrust Global Root, OU=”GTE CyberTrust Solutions, Inc.”, O=GTE Corporation, C=US&gt;<br>&lt;CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US&gt;<br>&lt;CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US&gt;<br>&lt;CN=T-TeleSec GlobalRoot Class 2, OU=T-Systems Trust Center, O=T-Systems Enterprise Services GmbH, C=DE&gt;<br>&lt;CN=Sonera Class1 CA, O=Sonera, C=FI&gt;<br>&lt;OU=VeriSign Trust Network, OU=”© 1998 VeriSign, Inc. — For authorized use only”, OU=Class 1 Public Primary Certification Authority — G2, O=”VeriSign, Inc.”, C=US&gt;<br>&lt;CN=KEYNECTIS ROOT CA, OU=ROOT, O=KEYNECTIS, C=FR&gt;<br>&lt;CN=localhost, O=WSO2, L=Mountain View, ST=CA, C=US&gt;<br>update handshake state: unknown[13]<br>upcoming handshake states: server_hello_done[14]<br>upcoming handshake states: client certificate[11](optional)<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>ServerHelloDone</strong><br>update handshake state: server_hello_done[14]<br>upcoming handshake states: client certificate[11](optional)<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>HTTPS-Listener I/O dispatcher-1, WRITE: TLSv1.2 Handshake, length = 13114<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1.2 Handshake, length = 883<br>check handshake state: certificate[11]<br>update handshake state: certificate[11]<br>upcoming handshake states: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>Certificate</strong> chain<br>chain [0] = [<br>[<br> Version: V3<br> Subject: CN=localhost, OU=apim, O=wso2, L=colombo, ST=western, C=sl<br> Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11</pre><pre>Key: Sun RSA public key, 2048 bits<br> modulus: 17740675243138577469162108521335593582979234625380118363754447028698871041088533420674779367993173908664420345123289390790384960944847831968551569499580921105972130370978196868516422101326891945532802593129704811290380726687881510969585737724521570635054466348545446285890360145019956090325041975417221301388736091509416402258150188620042077655676129838344602616989891934292900427255679659266346671095520625366541625611235997691079417331883724755972635862950424610425303662669267656728836350318254069028075849178433183978316578512607425343472455891337155502613377630457105236056673285746858693921584817229473188105443<br> public exponent: 65537<br> Validity: [From: Mon May 04 11:20:41 IST 2020,<br> To: Thu Apr 29 11:20:41 IST 2021]<br> Issuer: CN=localhost, OU=apim, O=wso2, L=colombo, ST=western, C=sl<br> SerialNumber: [ 7e699fe3]</pre><pre>Certificate Extensions: 1<br>[1]: ObjectId: 2.5.29.14 Criticality=false<br>SubjectKeyIdentifier [<br>KeyIdentifier [<br>0000: 53 49 DC 1E 16 43 F7 3B F0 DE B0 5C 30 CD C1 60 SI…C.;…\0..`<br>0010: E9 F9 30 04 ..0.<br>]<br>]</pre><pre>]<br> Algorithm: [SHA256withRSA]<br> Signature:<br>0000: 76 B4 F3 61 C2 83 98 57 46 73 7B CC D4 0F 5F BF v..a…WFs…._.<br>0010: 24 F5 99 A2 5B CC D8 A8 46 A4 50 0C 36 53 0A EC $…[…F.P.6S..<br>0020: 4B A4 46 10 AA 3D C1 72 A6 5C E9 A0 B2 E1 8D 7F K.F..=.r.\……<br>0030: 1F 11 55 FA 06 18 88 47 67 73 44 BC 25 C6 26 3A ..U….GgsD.%.&amp;:<br>0040: E6 B3 4A 92 0D E2 F9 C7 B1 51 2E 60 D2 E8 A6 D1 ..J……Q.`….<br>0050: 7C 0F FC D4 32 2F E1 03 36 98 C1 5B 3C D7 58 17 ….2/..6..[&lt;.X.<br>0060: 5C 44 E5 5D 14 F5 4A 4D 43 90 48 D9 7E 90 24 8F \D.]..JMC.H…$.<br>0070: A1 19 F7 CC 88 F6 73 B1 7F 1B A6 43 17 7B ED 8F ……s….C….<br>0080: F6 27 C5 CF CD 92 02 19 E5 3C 74 C6 A7 77 68 7A .’…….&lt;t..whz<br>0090: 00 C8 B5 D9 04 56 23 44 DD 72 6A CB B3 FE B8 04 …..V#D.rj…..<br>00A0: C3 01 CD DE 17 79 D7 04 29 0D 49 2C 49 C4 25 29 …..y..).I,I.%)<br>00B0: 60 8E A7 ED 38 56 5D 72 91 0E 7A 20 8E BE DF CE `…8V]r..z ….<br>00C0: 26 33 16 5F D9 6D 0A ED 55 11 D6 0C 4F 19 96 24 &amp;3._.m..U…O..$<br>00D0: 9D 83 9F 1D 06 8A C9 10 85 A2 EC B6 FB D4 27 66 …………..’f<br>00E0: 28 64 60 56 9C CD 52 F8 3E 6F 9E 69 0B 95 B3 DD (d`V..R.&gt;o.i….<br>00F0: 8E 51 5B 41 E8 C9 10 CB F6 7D BC 98 31 0B 2D 79 .Q[A……..1.-y</pre><pre>]<br>***<br>Found trusted certificate:<br>[<br>[<br> Version: V3<br> Subject: CN=localhost, OU=apim, O=wso2, L=colombo, ST=western, C=sl<br> Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11</pre><pre>Key: Sun RSA public key, 2048 bits<br> modulus: 17740675243138577469162108521335593582979234625380118363754447028698871041088533420674779367993173908664420345123289390790384960944847831968551569499580921105972130370978196868516422101326891945532802593129704811290380726687881510969585737724521570635054466348545446285890360145019956090325041975417221301388736091509416402258150188620042077655676129838344602616989891934292900427255679659266346671095520625366541625611235997691079417331883724755972635862950424610425303662669267656728836350318254069028075849178433183978316578512607425343472455891337155502613377630457105236056673285746858693921584817229473188105443<br> public exponent: 65537<br> Validity: [From: Mon May 04 11:20:41 IST 2020,<br> To: Thu Apr 29 11:20:41 IST 2021]<br> Issuer: CN=localhost, OU=apim, O=wso2, L=colombo, ST=western, C=sl<br> SerialNumber: [ 7e699fe3]</pre><pre>Certificate Extensions: 1<br>[1]: ObjectId: 2.5.29.14 Criticality=false<br>SubjectKeyIdentifier [<br>KeyIdentifier [<br>0000: 53 49 DC 1E 16 43 F7 3B F0 DE B0 5C 30 CD C1 60 SI…C.;…\0..`<br>0010: E9 F9 30 04 ..0.<br>]<br>]</pre><pre>]<br> Algorithm: [SHA256withRSA]<br> Signature:<br>0000: 76 B4 F3 61 C2 83 98 57 46 73 7B CC D4 0F 5F BF v..a…WFs…._.<br>0010: 24 F5 99 A2 5B CC D8 A8 46 A4 50 0C 36 53 0A EC $…[…F.P.6S..<br>0020: 4B A4 46 10 AA 3D C1 72 A6 5C E9 A0 B2 E1 8D 7F K.F..=.r.\……<br>0030: 1F 11 55 FA 06 18 88 47 67 73 44 BC 25 C6 26 3A ..U….GgsD.%.&amp;:<br>0040: E6 B3 4A 92 0D E2 F9 C7 B1 51 2E 60 D2 E8 A6 D1 ..J……Q.`….<br>0050: 7C 0F FC D4 32 2F E1 03 36 98 C1 5B 3C D7 58 17 ….2/..6..[&lt;.X.<br>0060: 5C 44 E5 5D 14 F5 4A 4D 43 90 48 D9 7E 90 24 8F \D.]..JMC.H…$.<br>0070: A1 19 F7 CC 88 F6 73 B1 7F 1B A6 43 17 7B ED 8F ……s….C….<br>0080: F6 27 C5 CF CD 92 02 19 E5 3C 74 C6 A7 77 68 7A .’…….&lt;t..whz<br>0090: 00 C8 B5 D9 04 56 23 44 DD 72 6A CB B3 FE B8 04 …..V#D.rj…..<br>00A0: C3 01 CD DE 17 79 D7 04 29 0D 49 2C 49 C4 25 29 …..y..).I,I.%)<br>00B0: 60 8E A7 ED 38 56 5D 72 91 0E 7A 20 8E BE DF CE `…8V]r..z ….<br>00C0: 26 33 16 5F D9 6D 0A ED 55 11 D6 0C 4F 19 96 24 &amp;3._.m..U…O..$<br>00D0: 9D 83 9F 1D 06 8A C9 10 85 A2 EC B6 FB D4 27 66 …………..’f<br>00E0: 28 64 60 56 9C CD 52 F8 3E 6F 9E 69 0B 95 B3 DD (d`V..R.&gt;o.i….<br>00F0: 8E 51 5B 41 E8 C9 10 CB F6 7D BC 98 31 0B 2D 79 .Q[A……..1.-y</pre><pre>]<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1.2 Handshake, length = 70<br>check handshake state: client_key_exchange[16]<br>update handshake state: client_key_exchange[16]<br>upcoming handshake states: certificate_verify[15](optional)<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** ECDH<strong>ClientKeyExchange</strong><br>ECDH Public value: { 4, 176, 123, 166, 185, 252, 181, 206, 79, 175, 64, 185, 75, 175, 29, 203, 218, 47, 49, 68, 234, 145, 247, 184, 23, 10, 224, 227, 100, 167, 158, 88, 184, 140, 128, 58, 249, 224, 138, 81, 175, 188, 201, 110, 216, 235, 251, 241, 234, 155, 193, 22, 57, 168, 229, 48, 0, 246, 52, 46, 225, 147, 202, 236, 244 }<br>SESSION KEYGEN:<br>PreMaster Secret:<br>0000: EE B9 50 0D 18 58 55 BA B0 B9 6D 4A 97 56 4B E6 ..P..XU…mJ.VK.<br>0010: 0B DC B5 C0 5F 19 48 80 F1 5C 08 FB FC 7C 96 2B …._.H..\…..+<br>CONNECTION KEYGEN:<br>Client Nonce:<br>0000: 35 78 E0 90 EB 7E 33 B6 93 0A 99 B9 85 B9 47 30 5x….3…….G0<br>0010: 5C 91 28 53 D9 88 53 AF 61 9C 14 F0 A6 3E 24 19 \.(S..S.a….&gt;$.<br>Server Nonce:<br>0000: 5E AF B1 E5 89 56 36 9A 4C F7 9E 3E 55 86 02 8F ^….V6.L..&gt;U…<br>0010: 4A AA 15 30 C0 FB DE 84 F2 77 C7 D4 A0 C3 6F 7C J..0…..w….o.<br>Master Secret:<br>0000: 9D 7F F0 AA 76 F0 80 94 19 F9 A5 0A DC 07 7C 40 ….v……….@<br>0010: 57 AA 8E E6 EA A3 B0 74 92 74 E8 25 5D 4D 4B CC W……t.t.%]MK.<br>0020: 7B C9 75 38 C6 F4 89 2D 5F A4 57 57 1E D7 BA F3 ..u8…-_.WW….<br>… no MAC keys used for this cipher<br>Client write key:<br>0000: 7B 26 AE 06 26 2F 0A 69 18 5C EA 14 77 C4 F6 41 .&amp;..&amp;/.i.\..w..A<br>Server write key:<br>0000: B3 D8 66 8E D6 A0 F2 17 E3 2A D8 4C 42 93 94 68 ..f……*.LB..h<br>Client write IV:<br>0000: E8 AD 2C 29 ..,)<br>Server write IV:<br>0000: D9 CE 2F E9 ../.<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1.2 Handshake, length = 264<br>check handshake state: certificate_verify[15]<br>update handshake state: certificate_verify[15]<br>upcoming handshake states: client change_cipher_spec[-1]<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>CertificateVerify</strong><br>Signature Algorithm SHA512withRSA<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1.2 Change Cipher Spec, length = 1<br>update handshake state: change_cipher_spec<br>upcoming handshake states: client finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>HTTPS-Listener I/O dispatcher-1, READ: TLSv1.2 Handshake, length = 40<br>check handshake state: finished[20]<br>update handshake state: finished[20]<br>upcoming handshake states: server change_cipher_spec[-1]<br>upcoming handshake states: server finished[20]<br>*** <strong>Finished</strong><br>verify_data: { 37, 119, 67, 220, 126, 19, 11, 106, 16, 67, 206, 43 }<br>***<br>update handshake state: change_cipher_spec<br>upcoming handshake states: server finished[20]<br>HTTPS-Listener I/O dispatcher-1, WRITE: TLSv1.2 Change Cipher Spec, length = 1<br>*** <strong>Finished</strong><br>verify_data: { 97, 235, 186, 95, 172, 137, 45, 139, 220, 41, 70, 213 }<br>***<br>update handshake state: finished[20]<br>HTTPS-Listener I/O dispatcher-1, WRITE: TLSv1.2 Handshake, length = 40</pre><p>Coming back to the topic, Mutual SSL can be exposed via mainly two paths in WSO2 APIM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*KAFxfCsg8vXdGEisD6vfWw.png" /></figure><ol><li>Inbound authentication (between the client and APIM)</li><li>Outbound authentication (between the APIM and backend)</li></ol><p>In order to enable Mutual SSL For inbound authentication, there are few configurations to be done which are clearly mentioned in the documentation [1],[2]. For APIM 2.6 version this feature is shipped via WUM from 22nd October 2018 onwards.</p><p>Note: If there are multiple certificates in the certificate chain of the client-side, those certificates need to be uploaded on the APIM side via the APIM Publisher portal.</p><p>When invoking the Mutual SSL secured API, both public certificate and private key should be available in the client application. For example below cURL command can be used to invoke the API (ex: context:test, version:1.0, resource:foo).</p><pre>curl -k --cert mynewcert.crt --key private_key.pem -X GET &quot;https://<br>&lt;host&gt;:8243/test/1.0/foo&quot;</pre><p>In Postman, Certificate settings menu can be used to upload the public certificate and private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puOFGAyN1cX4O2Ioyg6aUg.png" /></figure><p>Note: If we invoke the Mutual SSL secured API without passing the valid certificate to the APIM side when making the API call or valid certificate are not available in the APIM side below error can be observed.</p><pre>{<br>    &quot;fault&quot;: {<br>        &quot;code&quot;: 900911,<br>        &quot;message&quot;: &quot;The mutual SSL authentication has failed due to invalid/missing client certificate&quot;,<br>        &quot;description&quot;: &quot;The mutual SSL authentication has failed due to invalid/missing client certificate&quot;<br>    }<br>}</pre><p>For outbound authentication also there are few configurations to be done which are clearly mentioned in the documentation [3], [4]. To invoke a Mutual SSL supported backend, we need to make sure to do the below two points.</p><ul><li>Import the public certificate of API Manager into the trust-store of the backend server.</li><li>Import the public certificate of the backend server, into the trust store of API Manager.</li></ul><p>Note: The below trace can be observed in the SSL debug logs when trusted certificate authorities are not returned from the server.</p><pre>*** ServerHelloDone<br>Warning: no suitable certificate found - continuing without client authentication<br>*** Certificate chain<br>&lt;Empty&gt;<br>***</pre><p>Hope you find this blog post useful!</p><p><strong>References</strong></p><p>[1] <a href="https://docs.wso2.com/display/AM260/Securing+APIs+with+Mutual+SSL">https://docs.wso2.com/display/AM260/Securing+APIs+with+Mutual+SSL</a></p><p>[2] <a href="https://apim.docs.wso2.com/en/latest/learn/api-security/api-authentication/secure-apis-using-mutual-ssl/">https://apim.docs.wso2.com/en/latest/learn/api-security/api-authentication/secure-apis-using-mutual-ssl/</a></p><p>[3] <a href="https://docs.wso2.com/display/AM260/Mutual+SSL+between+API+Gateway+and+Backend">https://docs.wso2.com/display/AM260/Mutual+SSL+between+API+Gateway+and+Backend</a></p><p>[4] <a href="https://apim.docs.wso2.com/en/latest/learn/api-gateway/mutual-ssl-between-api-gateway-and-backend/#mutual-ssl-between-api-gateway-and-backend">https://apim.docs.wso2.com/en/latest/learn/api-gateway/mutual-ssl-between-api-gateway-and-backend/#mutual-ssl-between-api-gateway-and-backend</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e1d6b8f3469" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding and enabling Wire logs in WSO2-APIM-3.0.0]]></title>
            <link>https://wathsalakoralege.medium.com/understanding-and-enabling-wire-logs-in-wso2-apim-3-0-0-b7b953d19b9e?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7b953d19b9e</guid>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 07:42:12 GMT</pubDate>
            <atom:updated>2020-03-26T10:08:29.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2DCiJr1Cpdyjdw-cxeueQ.png" /></figure><h3><strong>Why Wire logs?</strong></h3><p>The Wire logs play a major role in the troubleshooting process of the WSO2 servers. Basically, the wire logs are included all the incoming and outgoing messages of the APIM Gateway.</p><p>Also, this will again helpful for troubleshooting the mediations in the APIM Gateway as well when we added any mediation logic inside the Gateway.[1]</p><p>It is recommended to enabled the Wire logs only for the troubleshooting process as it heavily grows the log files.</p><h3><strong>How to enable it?</strong></h3><p>To enable the Wire logs in the APIM-3.0.0 is slightly different from APIM 2.x.x as APIM-3.0.0 is consist of ‘<strong>Log4j2</strong>’.</p><ul><li>Open the ‘<strong><em>log4j2.properties’</em> </strong>file in <em>&lt;APIM-3.0.0_HOME&gt;/repository/conf </em>directory.</li><li>Make sure that the below segment has been added to that file.</li></ul><blockquote><a href="http://logger.synapse-wire.name/">logger.synapse-wire.name</a> = org.apache.synapse.transport.http.wire</blockquote><blockquote>logger.synapse-wire.level = DEBUG</blockquote><blockquote>logger.synapse-wire.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFIL<em>E</em></blockquote><ul><li>Then add the ‘<em>synapse-wire</em>’ to the ‘<strong><em>loggers</em></strong>’ section as below.</li></ul><blockquote><em>loggers = AUDIT_LOG, trace-messages, …. correlation, synapse-wire</em></blockquote><p>After these changes, you <strong>do not need to restart </strong>the server<strong>. </strong>After successfully deployed, there will be below log trace in the wso2carbon.log file.</p><p><em>INFO — LoggingUpdaterServiceComponent Logging configuration applied successfully</em></p><h3><strong>How to read and understand?</strong></h3><ul><li><strong><em>HTTP-Listener I/O Dispatcher-4 &gt;&gt;</em></strong></li></ul><p>The initial request coming from the client into the Gateway.</p><ul><li><strong><em>HTTP-Sender I/O Dispatcher-3 &lt;&lt;</em></strong></li></ul><p>The processed request going out from the Gateway to the external back-end.</p><ul><li><strong><em>HTTP-Sender I/O Dispatcher-3 &gt;&gt;</em></strong></li></ul><p>The response sent by the back-end to the Gateway.</p><ul><li><strong><em>HTTP-Listener I/O Dispatcher-4 &lt;&lt;</em></strong></li></ul><p>The response received to the client from the Gateway.</p><h3><strong>Sample Log for a token generation</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RwtU9NtK8SNGB23dl1KbLQ.png" /></figure><p>References:</p><p>[1] <a href="https://apim.docs.wso2.com/en/latest/Learn/APIGateway/MessageMediation/change-the-default-mediation-flow-of-api-requests/">https://apim.docs.wso2.com/en/latest/Learn/APIGateway/MessageMediation/change-the-default-mediation-flow-of-api-requests/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7b953d19b9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding a workflow to WSO2 APIM when there are port offsets]]></title>
            <link>https://wathsalakoralege.medium.com/adding-a-workflow-to-wso2-apim-when-there-are-port-offsets-f624fc29014f?source=rss-20da591f96b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f624fc29014f</guid>
            <category><![CDATA[ei]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[pbs]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[apim]]></category>
            <dc:creator><![CDATA[Lakmini Wathsala]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 06:44:36 GMT</pubDate>
            <atom:updated>2019-12-21T06:44:36.967Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6rehMBRmG74noppDkhNRmw.jpeg" /><figcaption>Source : <a href="https://gravityflow.io/articles/workflow-automation-best-practices/">https://gravityflow.io/articles/workflow-automation-best-practices/</a></figcaption></figure><p>You may already aware of adding custom workflows to WSO2 APIM. However, I have found that there is a little bit of confusing when there are port offsets for APIM and EI/BPS servers when achieving the same task. So, this blog post will help you to solve that confusion.</p><p>Just for the completion, I will also mention all default steps of this integration along with the required additional steps on fulfilling the requirement. And here, I will take adding application creation workflow relates to WSO2 BPS as an example.</p><h4>First, configure the Business Process Server</h4><ol><li>Download <a href="http://wso2.com/products/business-process-server/">WSO2 Business Process Server</a>.</li></ol><p>2. Set an offset of 4 to the default BPS port in the <em>&lt;BPS_HOME&gt;/repository/conf/carbon.xml </em>file.</p><p>&lt;<strong>Offset</strong>&gt;4&lt;/<strong>Offset</strong>&gt;</p><p>By default, this port offset is 2. So, when changing the BPS port offset other than 2, you need to search and replace the value 9765 in all the files ( .epr) inside the <em>&lt;APIM_HOME&gt;/business-processes</em> directory with the new port (ex: 9763 + &lt;port-offset&gt;). Or when running the APIM and BPS servers on different machines, you need to set the hostname to a different value other than the localhost.</p><p>3. Open the <em>&lt;BPS_HOME&gt;/repository/conf/humantask.xml </em>file and <em>&lt;BPS_HOME&gt;/repository/conf/b4p-coordination-config.xml </em>file and set the TaskCoordinationEnabled property to true.</p><p>&lt;<strong>TaskCoordinationEnabled</strong>&gt;true&lt;/<strong>TaskCoordinationEnabled</strong>&gt;</p><p>4. Copy the following from the <em>&lt;APIM_HOME&gt;/business-processes/epr</em> directory to the <em>&lt;BPS_HOME&gt;/repository/conf/epr</em> directory. <br>If the <em>&lt;BPS_HOME&gt;/repository/conf/epr</em> directory does not exist, create it.</p><p>Make sure to give the correct credentials in the <em>&lt;BPS_HOME&gt;/repository/conf/epr</em> files.</p><ul><li>Update the <em>&lt;APIM_HOME&gt;/business-processes/epr/ApplicationCallbackService.epr</em> file according to API Manager (hostname and port). Here I have used APIM server with port offset 1.</li></ul><p>&lt;wsa:Address&gt;https://localhost:8244/services/WorkflowCallbackService&lt;/wsa:Address&gt;</p><ul><li>Update the <em>&lt;APIM_HOME&gt;/business-processes/epr/ApplicationService.epr</em> file according to BPS.</li></ul><p>&lt;wsa:Address&gt;http://localhost:9767/services/ApplicationService&lt;/wsa:Address&gt;</p><p>5. Start the BPS server and sign in to the Management Console (https://&lt;Server Host&gt;:9443+&lt;port-offset&gt;/carbon)</p><p>ex:https://&lt;Server Host&gt;:9447/carbon</p><p>6. Also, please make sure to search the value <strong>8243, 8280</strong> in all the files (.epr, .wsdl files inside the ZIP archives) inside <em>&lt;APIM_HOME&gt;/business-processes</em> folder and replace respectively with <strong>8244, 8281</strong>.</p><p>7. Click <strong>Add </strong>under<strong> Processes</strong> and upload the <em>&lt;APIM_HOME&gt;/business-processes/application-creation/BPEL/ApplicationApprovalWorkFlowProcess_1.0.0.zip</em> file to BPS. <br>This is the business process archive file.</p><p>8. Select <strong>Add</strong> under the <strong>Human Tasks</strong> menu and upload the .<em>&lt;APIM_HOME&gt;/business-processes/application-creation/HumanTask/ApplicationsApprovalTask-1.0.0.zip</em> file to BPS. <br>This is the human task archived file.</p><p>When <strong>updating</strong> the aforementioned archive file, please make sure to un-deploy the existing BPEL and HumanTask archived files and redeploy the updated <em>&lt;APIM_HOME&gt;/business-processes/application-creation/BPEL/ApplicationApprovalWorkFlowProcess_1.0.0.zip</em> and <em>&lt;APIM_HOME&gt;/business-processes/application-creation/HumanTask/ApplicationsApprovalTask-1.0.0.zip</em> files to BPS server.</p><h4>Then configure the WSO2 API Manager</h4><ol><li>Open the <em>&lt;APIM_HOME&gt;/repository/deployment/server/jaggeryapps/admin/site/conf/site.json</em> file and configure “workFlowServerURL”under “ workflows” to point to the BPS server (ex:”workFlowServerURL”: “<a href="https://localhost:9445/services/">https://localhost:9447/services/</a>&quot;)</li><li>Change the port to 9444 (according to the port offset of APIM server) of the following property in WorkflowCallbackService.xml resides in the <em>&lt;APIM_HOME&gt;/repository/deployment/server/synapse-configs/default/proxy-services</em> directory.</li></ol><pre>&lt;address uri=&quot;https://localhost:9444/store/site/blocks/workflow/workflow-listener/ajax/workflow-listener.jag&quot;<br>                        format=&quot;rest&quot;/&gt;</pre><p>By default, it contains localhost:9443.</p><p>When you do not configure the above changes, you will be faced with the below warnings.</p><pre>WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint : AnonymousEndpoint with address https://localhost:9443/store/site/blocks/workflow/workflow-listener/ajax/workflow-listener.jag will be marked SUSPENDED as it failed {org.apache.synapse.endpoints.EndpointContext}</pre><pre>WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint : AnonymousEndpoint with address https://localhost:9443/store/site/blocks/workflow/workflow-listener/ajax/workflow-listener.jag - current suspend duration is : 30000ms - Next retry after : Tue Oct 29 11:11:46 CET 2019 {org.apache.synapse.endpoints.EndpointContext}</pre><p>3. Sign in to WSO2 APIM Management Console (https://&lt;Server-Host&gt;:9444/carbon) and select <strong>Browse</strong> under <strong>Resources</strong>.</p><p>4. Navigate to the <em>/_system/governance/apimgt/applicationdata/workflow-extensions.xml</em> resource, disable the Simple Workflow Executor, and enable WS Workflow Executor. In addition, specify the service endpoint where the workflow engine is hosted and the credentials required to access the said service via basic authentication (i.e., username/password based authentication).</p><pre>&lt;WorkFlowExtensions&gt;<br>…<br> &lt;ApplicationCreation executor=”org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationWSWorkflowExecutor”&gt;<br> &lt;Property name=”serviceEndpoint”&gt;<a href="http://localhost:9765/services/ApplicationApprovalWorkFlowProcess/">http://localhost:9767/services/ApplicationApprovalWorkFlowProcess/</a>&lt;/Property&gt;<br> &lt;Property name=”username”&gt;admin&lt;/Property&gt;<br> &lt;Property name=”password”&gt;admin&lt;/Property&gt;<br> &lt;Property name=”callbackURL”&gt;<a href="https://localhost:8243/services/WorkflowCallbackService">https://localhost:8244/services/WorkflowCallbackService</a>&lt;/Property&gt;<br> &lt;/ApplicationCreation&gt;<br>… <br>&lt;/WorkFlowExtensions&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-pokmIsUFouOHU_I74eVg.png" /></figure><p>Note: When enabling the workflow features, make sure you import the certificate of the API Manager into the client-truststore located inside the <em>&lt;BPS_HOME&gt;/repository/resources/security </em>directory.</p><p>Now, you can test the Application creation flow.</p><ol><li>Navigate the API Store, click <strong>Applications</strong> and create a new application. <br>Note that the status field of the application states <strong>INACTIVE (Waiting for approval)</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0JOFwa601eQhLOs6ZvsTw.png" /></figure><p>2. Sign in to the Admin Portal (https://localhost:9444/admin), list all the tasks for application creation and approve the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hXQXjzH1V3ykterVwAGog.png" /></figure><p>3. When navigating back to the <strong>Applications</strong> page in the WSO2 API Store and you can see the created application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ggE8G6M8tdwG8HT9pZfq2A.png" /></figure><p>Hope this blog post helps you to untie any confusion regarding the integrating workflows when servers have port offsets. :)</p><p>References:</p><p>[1] <a href="https://docs.wso2.com/display/AM260/Adding+an+Application+Creation+Workflow#ForBPS">https://docs.wso2.com/display/AM260/Adding+an+Application+Creation+Workflow#ForBPS</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f624fc29014f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>