<?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 Udesh Athukorala on Medium]]></title>
        <description><![CDATA[Stories by Udesh Athukorala on Medium]]></description>
        <link>https://medium.com/@udeshathukorala-16?source=rss-c2dfd06830ae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZyY4AOO0AnmQTW2MxwFadQ.png</url>
            <title>Stories by Udesh Athukorala on Medium</title>
            <link>https://medium.com/@udeshathukorala-16?source=rss-c2dfd06830ae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:18:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@udeshathukorala-16/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[Private Key JWT Authentication with ES256 in WSO2 Identity Server]]></title>
            <link>https://udeshathukorala-16.medium.com/private-key-jwt-authentication-with-es256-in-wso2-identity-server-4945d402b1e9?source=rss-c2dfd06830ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/4945d402b1e9</guid>
            <dc:creator><![CDATA[Udesh Athukorala]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 20:50:12 GMT</pubDate>
            <atom:updated>2025-12-16T20:50:12.862Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>In the modern API security landscape, OAuth 2.0 and OpenID Connect (OIDC) client authentication methods are critical for securing token requests. While client_secret_basic offers simplicity, <strong>Private Key JWT Authentication</strong> provides superior security by leveraging asymmetric cryptography, making it the gold standard for confidential clients (such as backend services and microservices).</p><p><strong>WSO2 Identity Server (IS) 7.2</strong> fully supports this mechanism, allowing clients to sign a JWT using their private key, which the server verifies using the corresponding public key.</p><p>While guides often default to RSA (RS256), this article focuses on adopting a more modern and efficient approach: using <strong>ES256</strong> (Elliptic Curve Digital Signature Algorithm using P-256 and SHA-256). ES256 offers equivalent security to RS256 with significantly shorter key lengths and faster signature generation/verification, making it an excellent choice for performance-sensitive applications.</p><p>This guide walks you through configuring <strong>Private Key JWT client authentication in WSO2 Identity Server 7.2 using ES256</strong>, covering everything from key generation to token exchange.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8QXxXABn4uSJehB1b0NhA.png" /><figcaption>Private Key JWT Authentication</figcaption></figure><h3><strong>Step-by-Step Guide to Configuring JWT Private Key Authentication in WSO2 Identity Server</strong></h3><h4>Prerequisites:</h4><ul><li><strong>WSO2 Identity Server (wso2is-7.2.0)</strong>: <a href="https://wso2.com/products/downloads/?product=wso2is">Download</a> the ZIP file and follow the product installation <a href="https://is.docs.wso2.com/en/latest/get-started/quick-set-up/">guide</a>. This will be our authorization server.</li><li><strong>OpenSSL</strong>: Installed on your client machine for key generation and JWT signing.</li></ul><h4>Step 01 — Generate ES256 Key Pair</h4><p>The first and most crucial step is generating an Elliptic Curve key pair, which will be used for ES256 signing. We will use the prime256v1 curve, which corresponds to P-256 used in ES256.</p><ol><li>Generate the EC Private Key</li></ol><p>The following command generates an EC private key in PEM format.</p><pre>openssl ecparam -genkey -name prime256v1 -noout -out private_key.pem</pre><p>2. Generate the Public Certificate</p><p>Next, create a self-signed public certificate (certificate.pem) from the private key. This is the file we will upload to WSO2 IS.</p><pre>openssl req -new -x509 -key private_key.pem -out certificate.pem -days 365 -nodes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsTeG_FPKBFSStqZLLo-VA.png" /></figure><p>We now have our key pair:</p><ul><li>private_key.pem (The secret key used by your client to sign the JWT).</li><li>certificate.pem (The public certificate uploaded to WSO2 IS for verification).</li></ul><h4>Step 2: Configuring WSO2 Identity Server 7.2</h4><ol><li><strong>Create an Application (Service Provider)</strong></li></ol><ul><li>Log into <strong>WSO2 Identity Server 7.2 Console</strong>.</li><li>Navigate to <strong>Applications</strong> → Click <strong>Create New Application</strong> → Select <strong>Traditional Web Application</strong> → Choose <strong>OIDC</strong> as the protocol.</li><li>Set the <strong>Callback URL</strong> (e.g., <a href="https://oidcdebugger.com/debug).">https://oidcdebugger.com/debug).</a></li><li><strong>Create the Application</strong> and note down the <strong>Client ID</strong>.</li></ul><p><strong>2. Enable and Configure Private Key JWT</strong></p><ul><li>In the application configuration, navigate to the <strong>Inbound Authentication Configuration</strong> -&gt; <strong>OAuth/OpenID Connect Configuration</strong>.</li><li>Under <strong>Client Authentication Method</strong>, select <strong>Private Key JWT</strong>.</li><li>Select <strong>ES256</strong> as the <strong>Signing Algorithm</strong> from the dropdown.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*9epr4RBBfRuW1vVNn6ForA.png" /><figcaption>Client AUthentication Configurations in WSO2 Identity Server for an Application</figcaption></figure><ul><li>Under the <strong>Certificate</strong> section, click on <strong>Provide Certificate</strong>.</li><li><strong>Upload</strong> the public certificate (certificate.pem file we generated in Step 1).</li><li><strong>Save</strong> the changes by updating the application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v76iWjuvU4TR7pavsCtNRQ.png" /><figcaption>Certificate Section of a Application in WSO2 Identity Server</figcaption></figure><p>WSO2 IS is now configured to expect a Private Key JWT assertion from your client and will use the uploaded public key to verify any assertion signed with ES256.</p><h4>Step 3 — Create JWT Header &amp; JWT Payload</h4><p>The client application must now dynamically create a JWT assertion for every token request. This JWT must contain specific claims and be signed using the private_key.pem.</p><ol><li><strong>Generate JWT header</strong></li></ol><ul><li>The header must explicitly state the <strong>ES256</strong> signing algorithm.</li></ul><pre>{<br>  &quot;alg&quot;: &quot;ES256&quot;,<br>  &quot;typ&quot;: &quot;JWT&quot;<br>}</pre><ul><li>Use the below command to create the Base64 URL encoded JWT header and save as a text file (header_base64.txt).</li></ul><pre>echo -n &#39;{&quot;alg&quot;:&quot;ES256&quot;,&quot;typ&quot;:&quot;JWT&quot;}&#39; \<br>  | openssl base64 -e -A \<br>  | tr -d &#39;=&#39; \<br>  | tr &#39;/+&#39; &#39;_-&#39; &gt; header_base64.txt</pre><p><strong>2. Generate the JWT Payload(Claims)</strong></p><p>The payload contains the necessary claims for client authentication, including the client ID, the token endpoint, and time-related security constraints.</p><pre>{<br>  &quot;iss&quot;: &quot;YOUR_CLIENT_ID&quot;, <br>  &quot;sub&quot;: &quot;YOUR_CLIENT_ID&quot;,<br>  &quot;aud&quot;: &quot;https://localhost:9443/oauth2/token&quot;, <br>  &quot;exp&quot;: 1734567890, <br>  &quot;iat&quot;: 1734567590, <br>  &quot;jti&quot;: &quot;b3e34b46-0b89-4b71-b8ef-18f973711b62&quot;<br>}</pre><ul><li>iss : issuer of the assertion (must be the Client ID).</li><li>sub : The subject of the assertion (must be the Client ID).</li><li>aud : The audience, typically the WSO2 IS token endpoint.</li><li>exp : Expiration time as a Unix Timestamp(recommended short life, e.g., 5 minutes).</li><li>iat : Issued-at time as a Unix Timestamp</li><li>jti : A unique JWT ID to prevent replay attacks.(UUID)</li></ul><p>Use the below command to generate the payload as a JSON file (payload.json) with dynamic exp, iat, and jti values.</p><pre>cat &lt;&lt;EOF &gt; payload.json<br>{<br>  &quot;iss&quot;: &quot;YOUR_CLIENT_ID&quot;,<br>  &quot;sub&quot;: &quot;YOUR_CLIENT_ID&quot;,<br>  &quot;aud&quot;: &quot;https://localhost:9443/oauth2/token&quot;,<br>  &quot;exp&quot;: $(($(date +%s) + 300)),<br>  &quot;iat&quot;: $(date +%s),<br>  &quot;jti&quot;: &quot;$(uuidgen)&quot;<br>}<br>EOF</pre><p>Use the below command to generate the Base64 URL encoded payload as a text file (payload_base64.txt).</p><pre>tr -d &#39;\n&#39; &lt; payload.json \<br>  | openssl base64 -e -A \<br>  | tr -d &#39;=&#39; \<br>  | tr &#39;/+&#39; &#39;_-&#39; &gt; payload_base64.txt</pre><h4>Step 4— Sign JWT and Generate JWT Assertion</h4><ol><li><strong>Create the Signing Input</strong></li></ol><ul><li>Concatenate the encoded header and payload with a dot (.) and save as signing_input.txt.</li><li>SIGNING_INPUT = &lt;EncodedHeader&gt;.&lt;EncodedPayload&gt;</li></ul><pre>echo -n &quot;$(cat header_base64.txt).$(cat payload_base64.txt)&quot; &gt; signing_input.txt</pre><p>2. <strong>Generate the ES256 Signature</strong></p><ul><li>Sign the signing_input.txt using the private key and SHA-256 digest.</li></ul><pre>openssl dgst -sha256 -sign private_key.pem -out signature_der.bin signing_input.txt</pre><p><strong>3. Convert DER Signature → Raw R‖S Signature</strong></p><ul><li>EC signatures are typically generated in ASN.1 DER format, but JWT requires a raw concatenation of the R and S values. Use the following Python script to convert the DER format (signature_der.bin) to the raw R‖S format (signature.bin).</li></ul><pre>python3 - &lt;&lt; &#39;EOF&#39;<br>der = open(&quot;signature_der.bin&quot;, &quot;rb&quot;).read()<br><br>if der[0] != 0x30:<br>    raise SystemExit(&quot;Not a SEQUENCE&quot;)<br><br>pos = 2<br>length_byte = der[1]<br>if length_byte &amp; 0x80:  # long form length<br>    nlen = length_byte &amp; 0x7F<br>    pos = 2 + nlen<br><br>if der[pos] != 0x02:<br>    raise SystemExit(&quot;Expected INTEGER for r&quot;)<br>lr = der[pos + 1]<br>r = der[pos + 2:pos + 2 + lr]<br>pos = pos + 2 + lr<br><br>if der[pos] != 0x02:<br>    raise SystemExit(&quot;Expected INTEGER for s&quot;)<br>ls = der[pos + 1]<br>s = der[pos + 2:pos + 2 + ls]<br><br># Strip leading zeros and pad to 32 bytes for ES256 (P-256)<br>r = r.lstrip(b&#39;\x00&#39;).rjust(32, b&#39;\x00&#39;)<br>s = s.lstrip(b&#39;\x00&#39;).rjust(32, b&#39;\x00&#39;)<br><br>open(&quot;signature.bin&quot;, &quot;wb&quot;).write(r + s)<br>EOF</pre><p>4. <strong>Base64URL Encode the Signature</strong></p><ul><li>The binary signature must be URL-safe Base64 encoded to form the final part of the JWT.</li></ul><pre>openssl base64 -e -A -in signature.bin \<br>  | tr -d &#39;=&#39; \<br>  | tr &#39;/+&#39; &#39;_-&#39; &gt; signature_base64.txt</pre><p><strong>5. Build the final JWT Assertion:</strong></p><ul><li>Combine the three Base64 URL encoded parts (header, payload, and signature). This is our final client_assertion.</li></ul><pre>printf &#39;%s.%s.%s\n&#39; \<br>  &quot;$(cat header_base64.txt)&quot; \<br>  &quot;$(cat payload_base64.txt)&quot; \<br>  &quot;$(cat signature_base64.txt)&quot; &gt; jwt_assertion.txt</pre><h4>Step 5— Exchange JWT for an Access Token</h4><ul><li>Finally, use the generated JWT assertion to request a token from WSO2 IS.</li><li>We’ll use the client_credentials grant type as an example, but this works for any grant that requires client authentication.</li></ul><pre>curl -k -X POST https://localhost:9443/oauth2/token \<br>  -H &quot;Content-Type: application/x-www-form-urlencoded&quot; \<br>  --data-urlencode &quot;grant_type=client_credentials&quot; \<br>  --data-urlencode &quot;client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&quot; \<br>  --data-urlencode &quot;client_assertion=$(cat jwt_assertion.txt)&quot; \<br>  --data-urlencode &quot;scope=openid&quot;</pre><ul><li>If the configuration is correct and the JWT is signed with the corresponding ES256 private key, WSO2 IS 7.2 will successfully verify the signature and return an access token:</li><li>If verification fails, you will receive an error like invalid_client or invalid_grant. Double-check your JWT header (&quot;alg&quot;: &quot;ES256&quot;), the claims (iss and sub must match the Client ID), and that the uploaded certificate matches the private key used for signing.</li></ul><h3>Conclusion</h3><p>By leveraging ES256 for Private Key JWT authentication, you successfully implement one of the most secure and modern client authentication methods available in WSO2 Identity Server 7.2. This elliptic curve approach provides not only robust security guarantees but also performance benefits over traditional RSA signatures, ensuring your confidential client applications communicate securely and efficiently with your Identity Provider.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4945d402b1e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Workflows with WSO2 Identity Server]]></title>
            <link>https://udeshathukorala-16.medium.com/setting-up-workflows-with-wso2-identity-server-e798bd848ea3?source=rss-c2dfd06830ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/e798bd848ea3</guid>
            <category><![CDATA[wso2-identity-server]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[workflow-management]]></category>
            <category><![CDATA[wso2is]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Udesh Athukorala]]></dc:creator>
            <pubDate>Thu, 30 Jun 2022 15:47:28 GMT</pubDate>
            <atom:updated>2022-06-30T15:47:28.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*47gbrIIl64EaCQS0sOPT_g.jpeg" /></figure><h3><strong>What is a Workflow?</strong></h3><blockquote>A <strong>workflow</strong> is a sequence of approval processes that need to go through in order to complete a human task.</blockquote><p>The workflow feature enables you to add more control and constraints to the tasks executed within it.</p><p>Let’s consider a sample use case.</p><h4>Sample Use Case</h4><p>Let’s consider adding a new employee to the company system by a HR person.</p><p>If company want’s they can let the HR person to add a new employee directly to the system.</p><p>But normally when an employee joins the company, it has to be approved by a set of administrators. So if the company wants to keep more control and constraint on adding new users(employees) to the system, they can manadate HR Manager’s approval for adding new employees. So in this case even HR member added new employees to the system, It will only complete after getting the approval from the Senior HR manager.</p><p>Below diagram shows this approval flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*wMo5BdICPHN4Hyv0VOEtIw.png" /><figcaption>Sample Approval Flow</figcaption></figure><ol><li>HR member(Requester) add user details and send user approval request to the HR Manager.</li><li>HR manager(Approver) checks the pending user approval request and can approve or reject the relevant user add request.</li><li>IF HR manager approves the user add request user will be added to the system successfully. But if HR manager reject the user approval request user will not be added to the system.</li></ol><p>This approval flow is a sample workflow.</p><h3>Try out Workflow Management</h3><p>In WSO2 identity server we can create approval workflows for different human tasks. Following are a some of them:</p><ul><li>User creation, modification and deletion</li><li>Role creation, modification and deletion</li><li>Assigning Roles to users</li><li>Assigning users to Roles</li><li>Update the attributes</li></ul><p>Now Let’s see how to implementing the above sample use case with WSO2 identity server workflow management.</p><h4><strong>Prerequisites</strong></h4><ul><li>Download the latest WSO2 Identity Server 5.11.0 from <a href="https://wso2.com/identity-server/#">here</a> .</li><li>Start WSO2 identity server by executing wso2server.sh (For unix environment) or wso2server.bat (For windows environment) file from the &lt;IS_HOME&gt;/bin directory.</li></ul><h4><strong>Add HR member and HR Manager and assign relevant roles</strong></h4><ol><li>Sign in to in to the Management Console via <a href="https://localhost:9443/carbon/">https://localhost:9443/carbon/</a>.</li></ol><p><em>Add new Roles </em><em>hr_member and </em><em>hr_manager</em>.</p><ol><li>On the <strong>Main</strong> menu, click<strong> Identity</strong> →<strong>Users and Roles</strong> →<strong>Add</strong>.</li><li>Then click <strong>Add New Role.</strong></li><li>Then enter role name <em>hr_member </em>and click <strong>Finish</strong>.</li><li>Then add <em>hr_manager </em>role also using the above three steps.</li></ol><p><em>Add two new users </em><em>johny &amp; </em><em>symondand assign </em><em>hr_member &amp;</em><em>hr_manager roles respectively.</em></p><ol><li>On the <strong>Main</strong> menu, click<strong> Identity</strong> →<strong>Users and Roles</strong> →<strong>Add</strong>.</li><li>Then click <strong>Add New User.</strong></li><li>Then add username as johny and password for johny and click <strong>Next</strong>.</li><li>Then select the Internal/hr_member and Internal/admin roles for user johny and click on Finish.</li><li>Similar to the above steps add user symond and assign Internal/hr_manager and Internal/admin roles for him.</li></ol><p>Now you have two users which has following roles.</p><ul><li><strong>johny</strong> →<strong>hr_member</strong></li><li><strong>symond</strong> →<strong>hr_manager</strong></li></ul><p>Please refer <a href="https://is.docs.wso2.com/en/latest/learn/configuring-roles-and-permissions/">this</a> for details about configuring roles &amp; permissions.</p><h4>Adding a New Workflow Definition</h4><p>Now let’s see how to add a new Workflow definition.</p><ol><li>On the <strong>Main</strong> tab of the Management Console, click <strong>Manage </strong>→<strong> Workflow Definition </strong>→<strong>Add</strong>.</li><li>Enter a workflow name and description and click <strong>Next</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*Hw-LdFmWsGPbAUW0CABDkA.png" /></figure><p>3. To add an approval level click <strong>Add Approval Step</strong>.</p><p>4. To serach a user role select the <strong>Search Roles</strong> radio button and click <strong>Search Roles</strong>.</p><p>5. Then Select the check-box associated with Internal/hr_manager role and click <strong>Add Selected Roles.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*LC5B6dhuvTHCkLclbdNRgQ.png" /></figure><p>6. Click <strong>Next</strong> to move to the next step.</p><p>7. Then add BPS Profile, Task Subject and Task Detail as below image and click on Finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*mRw0jwc1wDIOIbcxqCNGhA.png" /></figure><p>Now you will be able to view the workflow definition you just added, by navigating to <strong>Workflow Definitions </strong>→<strong> List</strong> under the <strong>Manage</strong> Section.</p><h4>Engaging a Workflow in an Operation</h4><p>Now you need to add the workflow you created to an operation. In our scenario we need engaging the approval workflow for the operation of adding a user.</p><ol><li>On the <strong>Main</strong> tab in the Management Console, click <strong>Manage </strong>→<strong> Workflow Engagement </strong>→ <strong>Add</strong>.</li><li>Then fill the Association Name and select other required details as given below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*6pSX68gfjsQ1qjSbZeaNog.png" /></figure><p>3. Click <strong>Add</strong> to complete adding the engagement. You can view, disable, or delete the association by navigating to <strong>Manage </strong>→<strong> WorkFlows Engagements </strong>→<strong> List</strong>.</p><p>Now that all the configurations are done, when you add a user it will not be displayed under the users section immediately and the user will not be able to login. The user will be enabled once the user addition task is approved by the hr_manager.</p><h4>Managing Human Tasks</h4><p>Human tasks are the steps that require human interaction in order to allow the process of the operation to proceed.</p><p>Let’s Follow the steps below to test the add user workflow.</p><ol><li>Sign in to WSO2 Identity Server with the admin credentials as a hr_member by entering Johny’s credentials.</li><li>Create a user with the name Kane. After you successfully create the user, it will be greyed out as shown below until a manager approves the addition of the user account.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*2F2YBtWO2KWCh9bHBCbdLg.png" /></figure><p>3. Then access the console URL (https://localhost:9443/console) and sign in as a hr_manager by using symond’s credentials.</p><p>4. In the <strong>Manage</strong> tab, choose <strong>Approvals</strong> from the left panel.</p><p>5. Select the approval task corresponding to the request made for user, Kane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b2a7ZXlV0L8v2olU7VEv0w.png" /></figure><p>6. Click <strong>Approve</strong> to approve the pending task and complete the workflow process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*FPACXkgkHH5DeaGUHYS1fw.png" /></figure><p>Now the approval task will be changed to <strong>Completed</strong> state and user Kane will be able to log in to the applications.</p><p><em>We are done! Now it’s your time. Try and See.</em></p><p><strong>Refrences</strong></p><ol><li><a href="https://is.docs.wso2.com/en/latest/learn/workflow-management/">https://is.docs.wso2.com/en/latest/learn/workflow-management/</a></li><li><a href="https://www.youtube.com/watch?v=DZJV1gqSDMc">https://www.youtube.com/watch?v=DZJV1gqSDMc</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e798bd848ea3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mutual TLS in Action]]></title>
            <link>https://udeshathukorala-16.medium.com/mutual-tls-in-action-c6a9778eff5d?source=rss-c2dfd06830ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6a9778eff5d</guid>
            <category><![CDATA[transportlayersecurity]]></category>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[mutual-tls]]></category>
            <category><![CDATA[mutual-authentication]]></category>
            <category><![CDATA[identity-management]]></category>
            <dc:creator><![CDATA[Udesh Athukorala]]></dc:creator>
            <pubDate>Tue, 14 Dec 2021 21:46:35 GMT</pubDate>
            <atom:updated>2021-12-14T21:46:35.287Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Mutual TLS in Action" src="https://cdn-images-1.medium.com/max/612/1*G0NsAFXoOdpE4qW43eOhTA.jpeg" /></figure><p>“What is mTLS?” I am sure this is the main question that you have at the start of this article. Mutual TLS(mTLS) or Mutual Transport Layer Security is a cryptographic protocol designed to provide secured and trusted communication between client and server over a computer network. Before diving into the mTLS we need to understand the Transport Layer Security (TLS)</p><h3>What is TLS?</h3><p>Transport Layer Security (TLS) is the de-facto standard to secure communications between applications of today&#39;s world.</p><blockquote><strong>“Transport Layer Security</strong> (<strong>TLS</strong>), the successor of the now-deprecated <strong>Secure Sockets Layer</strong> (<strong>SSL</strong>), is a cryptographic protocol designed to provide communications security over a computer network.”</blockquote><p>Even though you don’t know, you may use TLS many times when you browse the internet. Any website you visit starts with http or https. Did you know what is the exact difference between these two? Hyper Text Transfer Protocol (HTTP) is a protocol used for transferring data over a network and this is generally considered as not encrypted and not secured. <strong>Hyper Text Transfer Protocol Secure(HTTPS)</strong> is the secured version of HTTP and HTTPS ensures that ongoing online communication between server and browser is encrypted and secure. HTTPS uses TLS to encrypt http requests and responses.</p><h4>SSL vs TLS ?</h4><p>When you are searching in the internet regarding TLS you will be able to find both SSL/TLS terms are often used interchangeably and confused. Actually TLS evolved from a previous encryption protocol called SSL (Secure Sockets Layer), which was developed by Netscape. But SSL has not been updated since SSL 3.0 in 1996 and is now considered to be deprecated.</p><h3>How TLS works?</h3><p>TLS uses a combination of cryptographic processes to provide secure communication over a network. TLS works on using public-key encryption, which relies on a pair of keys(public key and private key). Normally we called this private key as key and the public key as the certificate. Anything encrypted with the public key only is decrypted with this private key. TLS protocol is designed to three essential security services: Authentication, Encryption and Integrity. But technically it is not required to use all these three services in every situation. But in that case you need to take your own risk about the security concerns. Let’s see how TLS provide provide those services.</p><h4><strong>TLS Authentication</strong></h4><p><em>Authentication</em> is the process of identifying and validating that a user or an application who they claim to be. By default, the TLS protocol only requires a server to authenticate itself to the client. Now see how server authentication happens using certificates. Certificate is something like your ID card. Identity Card contains several information to uniquely identify your identity and Identity card was issued by a specific trusted government agency(trusted third party).</p><figure><img alt="One-way authentication, only the Client authenticates the Server" src="https://cdn-images-1.medium.com/max/417/1*_K9FSDEWjHQumIPEDyT1tw.png" /><figcaption>Figure 1. One-way authentication, Only the client authenticates the server</figcaption></figure><p>The Typical TLS authentication process works using below steps.</p><ol><li><em>Client connects to server</em></li><li><em>Server presents its TLS certificate to the client</em></li><li><em>Client verifies the server’s certificate</em></li><li><em>Client and server exchange information over encrypted TLS connection</em></li></ol><h4><strong>TLS Encryption</strong></h4><p><em>Encryption</em> is the process of scrambling data so that only authorized parties can understand the information. Encryption protects data by scrambling it with a randomly generated pass-code, called an encryption key. Without the key, third parties will be unable to view your data. Therefore, data should be readable only by the receiver.</p><h4>TLS Integrity</h4><p><em>Integrity</em> ensures that the data received by the receiver is the same data that was sent by the sender. TLS digitally signs data in order to provide data integrity, verifying that the data is not tampered with before reaching to the recipient.</p><h3>What is Mutual TLS?</h3><p>Now let’s see what’s the difference between TLS and Mutual TLS. As I described in the previous section using TLS the client was able to verify the identity of the server, but the server was not able to verify the identity of the client. By default, TLS provides one-way authentication, which means only requires a server to authenticate itself to the client.</p><p>But sometimes the server may also need to verify the identity of the client to avoid anybody calling the service. This is the place where Mutual TLS comes into action. In Mutual TLS or two-way TLS, both the server and client authenticate each other to ensure that both parties are trusted. Using Mutual TLS, the server can verify the client’s identity before allowing them to make any request to the server.</p><figure><img alt="Two-way / Mutual Authentication" src="https://cdn-images-1.medium.com/max/417/1*4P30XMUkBLV2dPaSyFnSJg.png" /><figcaption>Figure 2. Two-Way or Mutual Authentication. In mTLS both the Client and the Server authenticate each other</figcaption></figure><h4>How mTLS works?</h4><p>In mTLS both the client and server authenticate each other using their certificates. When compared to the typical TLS, there are some additional steps in the mTLS to verify both parties.</p><ol><li><em>Client connects to server</em></li><li><em>Server presents it’s TLS certificate to the client</em></li><li><em>Client verifies the server’s certificate</em></li><li><em>Client presents it’s TLS certificate to the server</em></li><li><em>Server verifies the client’s certificate</em></li><li><em>Server grants access</em></li><li><em>Client and server exchange information over encrypted TLS connection</em></li></ol><p>Here we come to the end. I hope you have got something from my Blog. Happy Learning!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6a9778eff5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to OAuth 2.0]]></title>
            <link>https://udeshathukorala-16.medium.com/introduction-to-oauth-2-0-d8345186ee0a?source=rss-c2dfd06830ae------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8345186ee0a</guid>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[access-management]]></category>
            <dc:creator><![CDATA[Udesh Athukorala]]></dc:creator>
            <pubDate>Sun, 27 Jun 2021 15:01:03 GMT</pubDate>
            <atom:updated>2021-06-27T15:01:03.374Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yu26A4Gr3oQUz_wEZetKuA.jpeg" /></figure><p>Before moving into the Introduction of OAuth 2.0 first look into some important concepts that we need to understand.</p><ul><li><strong>Authentication</strong> is the process of identifying and validating that a user or an application who they claim to be. Username and Password is the most common authentication factor and if the provided username and password credentials are matches with the system data, system grants access to the user.</li><li><strong>Authorization</strong> happens after the user has been successfully authenticated. Authorization is the process of giving full or partial access to specific resources and functions of the system based on the user’s access rights. <em>Basically, authentication is who you are and authorization is what you can do.</em></li><li><strong>Access Delegation</strong> is the process of authorizing an application with limited access to the user’s resources on behalf of a user. A real-world example of access delegation is the valet key of a car. Although a master key of a car supports all the functionality of the car, the valet key of a car only provides limited access to the necessary parts of a car, like a driver side door and engine start which are only needed to park the car.</li></ul><h3>Why OAuth?</h3><p>In earlier days, if you wanted to use a third-party application that required access to another application&#39;s resources, you had to provide login credentials(username &amp; password) of this application to the third-party application. But in that case, the third-party application has gained full access to the application using the login credentials you entered, and this third-party application can easily act like you. This third-party application can store your password credentials and keep using them. So this method is not acceptable from the security perspective.</p><p>Several solutions have come up to address this issue and OAuth is one of them. OAuth provides secure access delegation by providing a temporary token with limited access, instead of sharing the login credentials to the third-party application.</p><h3>What is OAuth?</h3><blockquote>“The OAuth authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf.”</blockquote><p>Simply OAuth is an industry-standard protocol used for authorization and secure access delegation<em>.</em><strong><em> </em></strong>There are two versions of OAuth, OAuth 1.0 and OAuth 2.0 and they have different specifications and there is no backward compatibility between these two versions. So which is the most popular OAuth version? OAuth 2.0 is the most widely used OAuth protocol today and let’s look deeper into OAuth 2.0.</p><h3>Roles of OAuth 2.0</h3><p>There are four key roles involved in the standard OAuth2 flow.</p><ol><li><strong>Resource Owner:</strong> This is the owner(entity or person) of the resources in the resource server who is capable of granting access to the protected resources. If the resource owner is a person, it is called an end-user.</li><li><strong>Resource Server:</strong> This is the server where the resource owner stores his protected resources.</li><li><strong>Client Application: </strong>This is the third-party application that wants to access the protected resources in the resource server on behalf of the resource owner. The resource owner must give the necessary permissions to the third-party applications (client applications) to access the protected resources.</li><li><strong>Authorization Server: </strong>This is the server that authenticates the resource owners using their credentials. Authorization Server issues <em>access tokens</em> to the client application after successfully authenticating the resource owner. This <strong>access token</strong> is the credential gives to the client application to access the resource owner’s protected resources in the resource server.</li></ol><h3>Abstract OAuth 2.0 Protocol Flow</h3><p>Let’s look into Abstract OAuth2 flow, which helps you to understand how oauth2 works. This flow explains the interactions that happen among the above-mentioned roles in OAuth2 Flow and it consists of 6 main steps as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvP9jc_0KvhU4ymMF2B4rw.png" /><figcaption>Abstract OAuth2 Flow</figcaption></figure><ol><li>The client application sends an <em>authorization request</em> to the resource owner(end-user) to gain access to the user’s protected resources.</li><li>If the Resource Owner was not already authenticated with the authorization server, he will be required to log in and authenticate with the authorization server. After successful authentication, the user has to authorize the client application’s request. If the user approves the authorization request, the client application receives an <em>authorization grant</em>.</li><li>Then the client application authenticates with the authorization server and requests an access token from the authorization server by providing the <em>authorization grant</em>, which was received in the last step.</li><li>Authorization Server validates both the client application and authorization grant and then sends an <em>access token</em> to the client application.</li><li>Then the client application requests the resources from the resource server by sending the <em>access token</em> which was acquired in the previous step. Client applications can use this access token multiple times until the token expires.</li><li>Finally, the Resource Owner validates the received access token and if the access token is valid, returns the <em>requested resources</em> to the client application.</li></ol><p>As I earlier mentioned this is the abstract Auth2 Flow. The real-world flow can differ with the Authorization Grant Type. The <strong>grant type</strong> is the mechanism used by the client application to get access tokens from the authorization server.</p><p>I hope now you have a clear picture of the OAuth 2.0 and let’s deep more into OAuth 2.0 in the future. Feel free to post your feedback in the comment section and Thank you for reading! 😃</p><p><strong>References</strong></p><ol><li><a href="https://wso2.com/blogs/thesource/2019/08/oauth-2-basics/">https://wso2.com/blogs/thesource/2019/08/oauth-2-basics/</a></li><li><a href="https://www.udemy.com/course/introduction-to-wso2-identity-server/">https://www.udemy.com/course/introduction-to-wso2-identity-server/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8345186ee0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>