<?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 Anuj Singhania on Medium]]></title>
        <description><![CDATA[Stories by Anuj Singhania on Medium]]></description>
        <link>https://medium.com/@singhania.anuj18?source=rss-a1f59239a745------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8-ng92vzaOmUWBqH</url>
            <title>Stories by Anuj Singhania on Medium</title>
            <link>https://medium.com/@singhania.anuj18?source=rss-a1f59239a745------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 04:31:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@singhania.anuj18/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[The Consent Protocol: How JWTs Streamline Secure Operations]]></title>
            <link>https://medium.com/angel-tech/the-consent-protocol-how-jwts-streamline-secure-operations-23dc50937211?source=rss-a1f59239a745------2</link>
            <guid isPermaLink="false">https://medium.com/p/23dc50937211</guid>
            <category><![CDATA[consent]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Anuj Singhania]]></dc:creator>
            <pubDate>Thu, 30 Jan 2025 07:40:12 GMT</pubDate>
            <atom:updated>2025-02-03T04:44:14.505Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R4iUvRhmzObz0vswWCKnYQ.jpeg" /></figure><p>Have you ever wondered what happens behind the scenes when you initiate a critical operation on a trading app? How does the system ensure your actions are secure, seamless, and lightning-fast? At Angel One, where milliseconds can make all the difference, these questions drive our commitment to building cutting-edge solutions.</p><p>Angel One, as a broking company, offers a wide range of purpose-built services designed to support client trading activities. Many of these services are hosted on the Public cloud, leveraging the benefits of scalability, flexibility, and reliability. Others are deployed on an on-premises cloud, providing enhanced control, security, and lower latency for critical flows.</p><p>While most of these services operate independently without interdependencies, there are scenarios where seamless communication or collaboration between these services becomes essential to address specific use cases.</p><p>This blog dives into how we overcame some challenges involved in the above senerio using JWT (JSON Web Tokens) as a scalable and secure consent protocol. We’ll explore the evolution of our architecture, from brute-force validation and data replication to the innovative use of JWT — highlighting the pitfalls we avoided and the breakthroughs we achieved.</p><h3>The Use Case</h3><ol><li><strong>Operation Initiation</strong>:<br>A user initiates an operation through the web or mobile app.</li><li><strong>Consent Validation</strong>: <br>Web/App client first check with <strong>Consent Manager</strong> if consent is there.</li></ol><p><strong>If consent is not available</strong>:</p><ul><li>The system initiates a user consent flow.</li><li>After validation, the user provides their consent.</li><li><strong>Consent Manager</strong> securely stores this consent, valid for the remainder of the day.</li></ul><p><strong>3. Once consent available</strong>:</p><ul><li>The operation is forwarded to <strong>Operation Manager</strong>.</li><li>Before proceeding, <strong>Operation Manager</strong> ensures the consent is valid and aligns with the requested operation.</li></ul><p>This use case highlights the need for reliable communication at very high scale between two different services to ensure secure and seamless operations</p><h3>Brute force :</h3><p><strong>Operation Manager</strong> at each operation calls <strong>Consent Manager</strong> and verifies the consent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*oh1xbEp1eal2FWnnMUrscg.png" /></figure><p>This system works well when latency, throughput, and availability are not critical. However, for the use case mentioned, it introduces the following problems.</p><ul><li><strong>Scalability Concerns</strong>: A large number of requests to the Consent Manager can lead to bottlenecks, especially under heavy load.Consent Manager needs to scale to the level of Operation Manager.</li><li><strong>Latency Issues</strong>: If the Operation Manager and Consent Manager are deployed in different data-centers or clouds, network delays can add significant latency to critical operations.This could negatively impact user experience, especially in low-latency applications like trading.</li><li><strong>Availability Risks</strong>: If the Consent Manager is unavailable (e.g., due to outages or scaling issues), the entire operation flow is disrupted, impacting business continuity.This makes the system vulnerable to a single point of failure.</li><li><strong>Bandwidth Overheads</strong>: Frequent cross-data center communication consumes network bandwidth, increasing operational costs and potentially slowing down other network-dependent services.</li></ul><h3>Replication :</h3><p>Replicate consent data as Kafka event or CDC pipeline to a Database which is easily and locally accessible to <strong>Operation Manager</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Fwz1AE_8Pfii-zpJrZx7g.png" /></figure><p>While this works and can reduce cross service communication and can scale, it introduces different set of problems.</p><p><strong>Synchronisation Complexity</strong>: Ensuring that the replicated data is always up-to-date introduces operational overhead, especially with near-real-time requirements.</p><p><strong>Stale Data Risks</strong>: Delays in replication or pipeline failures can result in outdated consent data being used, leading to potential compliance issues.</p><p><strong>Additional Infrastructure</strong>: Setting up and maintaining Kafka, CDC pipelines, and distributed databases increases system complexity and costs.</p><h3>Consent Protocol :</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*tFOnId51pgmAeijCIO4zrQ.png" /></figure><p>In this approach, we use <a href="https://jwt.io/introduction"><strong>JWT</strong></a> (which has been already been used for authentication) to securely transfer consent information to the Operation Manager. By leveraging JWT’s characteristics — compactness, security, and statelessness — you can efficiently manage user consent while addressing scalability, security, and latency concerns.<br>Generated tokens had below characteristics</p><ul><li>Short lived</li><li>Asymmetrically generated</li><li>Payload inside token is encrypted (for sensitive information)</li></ul><h3>Why we choose to go with this</h3><ul><li><strong>Stateless Design</strong>: JWTs are self-contained tokens, meaning all the necessary consent data is embedded within the token. This reduces the load on the central Consent Manager, allowing the system to scale easily.</li><li><strong>Local Validation</strong>: JWTs are validated locally by the Operation Manager, avoiding network calls, which results in low latency for operations.</li><li><strong>Integrity</strong>: JWTs are signed with a private key, ensuring the integrity of the consent data and preventing tampering.</li><li><strong>Expiry and Auditing</strong>: JWTs can include expiration times, ensuring that consent is valid only for a limited period and offering an easy way to audit the consent validity.</li><li><strong>Reduced Infrastructure Overhead</strong>: By eliminating the need for centralised replication (like in Kafka or CDC), the system reduces infrastructure complexity and associated costs.</li></ul><p><strong>Conclusion</strong></p><p>By adopting JWT in our consent management, we’ve not only addressed critical challenges like scalability, latency, and availability but also simplified our infrastructure, enhancing the overall user experience. The stateless nature of JWTs allows our systems to operate independently while maintaining the highest levels of security and integrity. This shift demonstrates Angel One’s commitment to innovation and efficiency, ensuring that our trading platform remains robust, responsive, and reliable — even under high operational loads. As we continue to evolve, we’ll keep pushing the boundaries of technology to deliver seamless and secure solutions for our clients.</p><p>The approach discussed in blog have got great feedbacks from @Nitesh Jain (Lead Engineer <a href="https://medium.com/u/b06a776e75f4">Angel One</a>) and <a href="https://medium.com/u/61b14b0fff8f">Abhin Hattikudru</a>.</p><h3>References</h3><h4><a href="https://jwt.io/introduction">https://jwt.io/introduction</a> <br><a href="https://developer.okta.com/blog/2019/10/17/a-thorough-introduction-to-paseto">https://developer.okta.com/blog/2019/10/17/a-thorough-introduction-to-paseto</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23dc50937211" width="1" height="1" alt=""><hr><p><a href="https://medium.com/angel-tech/the-consent-protocol-how-jwts-streamline-secure-operations-23dc50937211">The Consent Protocol: How JWTs Streamline Secure Operations</a> was originally published in <a href="https://medium.com/angel-tech">Angel One Square</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>