<?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 Yathusiga Kirubananthan on Medium]]></title>
        <description><![CDATA[Stories by Yathusiga Kirubananthan on Medium]]></description>
        <link>https://medium.com/@yathusigakirubananthan?source=rss-4f2630436528------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*huSpjxqaGL6TSl2BfQkE9Q.jpeg</url>
            <title>Stories by Yathusiga Kirubananthan on Medium</title>
            <link>https://medium.com/@yathusigakirubananthan?source=rss-4f2630436528------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:26:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yathusigakirubananthan/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[One Authorization Standard, Two Roles: AuthZEN in ThunderID]]></title>
            <link>https://medium.com/@yathusigakirubananthan/one-authorization-standard-two-roles-authzen-in-thunderid-a5a73af21622?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5a73af21622</guid>
            <category><![CDATA[authzen]]></category>
            <category><![CDATA[pdp]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[pep]]></category>
            <category><![CDATA[thunderid]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 09:11:19 GMT</pubDate>
            <atom:updated>2026-11-09T09:11:19.367Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Exploring how ThunderID brings standardized authorization to modern applications by supporting both Policy Decision Point (PDP) and Policy Enforcement Point (PEP) capabilities.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwLRLll6nVZI3GLB5Tqftg.png" /><figcaption>AuthZEN support in ThunderID</figcaption></figure><p>Imagine an API gateway protecting a booking service. A user requests access to a reservation, and before forwarding the request, the gateway needs to answer a question: is this user allowed to perform this action?</p><p>The organization already uses an identity platform that manages users, roles, and permissions. Ideally, the gateway should be able to ask that platform for an authorization decision rather than implementing the same permission logic again.</p><p>Now consider the opposite situation. The identity platform is issuing an access token, but the organization manages its authorization policies in a dedicated policy engine. Instead of making the decision internally, the identity platform needs to consult that engine to determine which permissions the user should receive.</p><p>These scenarios appear different, but they share the same underlying requirement: <strong>one system needs to request an authorization decision from another.</strong></p><p>The challenge is that authorization systems have traditionally exposed different APIs, request formats, and integration mechanisms. Connecting an API gateway to one policy engine might require a custom adapter, while connecting an identity provider to another could require an entirely different implementation.</p><p>This is the problem that OpenID AuthZEN aims to solve. And in ThunderID, the same standard enables two complementary capabilities: serving authorization decisions to other systems and consuming decisions from other policy engines.</p><h3>What is AuthZEN?</h3><p>OpenID AuthZEN is an initiative of the OpenID Foundation focused on improving interoperability between authorization systems. Its Authorization API defines a common way for one component to request an access decision from another, without requiring them to share the same internal policy model.</p><p>At the center of this interaction are two roles: the Policy Enforcement Point (PEP) and the Policy Decision Point (PDP).</p><p>A <strong>Policy Enforcement Point</strong> is responsible for enforcing access decisions. It might be an API gateway checking whether to forward a request, an application protecting a sensitive operation, or an identity service determining which requested permissions can be granted.</p><p>A <strong>Policy Decision Point</strong>, on the other hand, is responsible for evaluating authorization policies. It receives information about the requested operation, evaluates the applicable rules, and returns a decision indicating whether access should be permitted.</p><p>Consider Alice attempting to view a booking. An AuthZEN evaluation can describe the request using a subject, resource, and action:</p><pre>{<br>  &quot;subject&quot;: {<br>    &quot;type&quot;: &quot;user&quot;,<br>    &quot;id&quot;: &quot;alice&quot;<br>  },<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;booking&quot;,<br>    &quot;id&quot;: &quot;booking-123&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;name&quot;: &quot;read&quot;<br>  }<br>}</pre><p>The PDP evaluates the request and returns a response such as:</p><pre>{<br>  &quot;decision&quot;: true<br>}</pre><p>The response is intentionally simple. The interesting part is everything that happens behind it. One PDP might evaluate a role-to-permission mapping, while another might consider resource ownership, organizational relationships, or other attributes.</p><p>The PEP doesn’t need to understand those implementation details. It only needs to provide the information required for evaluation and enforce the returned decision.</p><p><strong>AuthZEN standardizes the conversation between the PEP and PDP, not the policies that determine the answer.</strong></p><p>That distinction is important because organizations don’t necessarily want to replace their existing authorization engines. They want different systems to communicate without building a new integration for every combination.</p><h3>Why does authorization need a common API?</h3><p>Authentication already benefits from widely adopted standards such as OAuth 2.0 and OpenID Connect. Applications can integrate with different identity providers using familiar protocols instead of learning a completely different authentication mechanism for every provider.</p><p>Authorization presents a related interoperability challenge.</p><p>Imagine an organization with several protected APIs. Its gateway needs to check access before forwarding requests, its identity provider needs to evaluate permissions during token issuance, and its backend services may need to enforce resource-specific policies. Meanwhile, the policies themselves might live in an identity platform or a dedicated authorization service.</p><p>If every component uses a different authorization interface, integration becomes increasingly difficult. Applications become coupled to specific policy engines, similar authorization clients are implemented repeatedly, and replacing one component can require changes across several others.</p><p>AuthZEN introduces a shared authorization API contract. A PEP can construct a standardized evaluation request, and an AuthZEN-compatible PDP can respond using a predictable format.</p><p>This doesn’t mean every authorization engine will interpret the same resource identifiers or attributes automatically. Integrators still need to agree on the meaning of subjects, resources, actions, and context. But the communication protocol no longer needs to be invented separately for every integration.</p><p>The result is a cleaner separation between the systems that enforce access and the systems that evaluate authorization policies.</p><h3>Where does ThunderID fit into this?</h3><p>ThunderID is an open-source identity and access management platform that provides capabilities for managing users, agents, applications, resource servers, authentication, and authorization.</p><p>ThunderID already has a built-in role-based authorization model. Roles determine the permissions assigned to subjects, and those permissions can be evaluated when access is requested.</p><p>For many applications, this is sufficient. A service may only need to determine whether a user has permission to read a particular API or perform an administrative operation.</p><p>But organizations don’t all manage authorization in the same way. Some want their identity platform to act as the central authorization decision service. Others have existing policy engines that evaluate more contextual rules and want to continue using them.</p><p>Supporting AuthZEN in ThunderID addresses both requirements.</p><p>When another system needs a decision from ThunderID, <strong>ThunderID acts as a PDP</strong>. When ThunderID needs to consult another policy engine and apply its decision, <strong>ThunderID acts as a PEP</strong>.</p><p>The distinction becomes clearer when we follow an authorization request through each scenario.</p><h3>ThunderID as a PDP: Making authorization decisions available to other systems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KszxtGKKwx6k5LPOojXUw.png" /><figcaption>ThunderID as PDP</figcaption></figure><p>Let’s return to the API gateway protecting our booking service.</p><p>Alice sends a request to an API that requires the reservations:view permission. The gateway authenticates the request and identifies the subject, but it still needs to determine whether the requested operation is authorized.</p><p>Instead of maintaining its own copy of the organization’s permission rules, the gateway sends an AuthZEN access evaluation request to ThunderID.</p><p>ThunderID receives the evaluation, resolves the relevant resource server, and uses the configured authorization engine to determine whether the requested action is permitted. It then returns the decision to the gateway.</p><p>The gateway remains responsible for enforcing the result. If the evaluation is denied, it blocks the protected operation. If the evaluation is permitted, the request can proceed, subject to any other applicable checks.</p><p>This is a useful separation of responsibilities. ThunderID handles authorization evaluation, while the gateway handles enforcement at the API boundary. The gateway doesn’t need to understand how ThunderID manages its roles or permissions.</p><h3>Supporting different evaluation scenarios</h3><p>Authorization checks don’t always involve a single action. A gateway might need to evaluate several requested operations, while an application might need to discover which actions a user can perform before displaying available functionality.</p><p>ThunderID’s AuthZEN PDP support includes access evaluation, batch evaluation, action search, and discovery capabilities.</p><p>The single evaluation endpoint handles an individual authorization question, while batch evaluation allows several evaluations to be submitted together. Action search helps callers discover permitted actions, and discovery allows clients to identify the server’s advertised AuthZEN capabilities.</p><p>These operations make ThunderID’s authorization functionality available through a standard interface rather than requiring consumers to integrate with its internal authorization services.</p><p>But exposing authorization decisions is only one direction of the problem. What happens when the policies that matter aren’t managed inside ThunderID?</p><h3>ThunderID as a PEP: Bringing other policy engines into authorization</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPu7gb2D01hWDdISgsMKpw.png" /><figcaption>ThunderID as PEP</figcaption></figure><p>Consider an organization that uses ThunderID for identity management and token issuance but already has a dedicated authorization engine.</p><p>Its authorization policies might depend on attributes beyond roles and permissions. For example, a user might be allowed to cancel a booking only when they own it and its current status permits cancellation. Another policy might depend on organizational membership or the relationship between a user and a protected resource.</p><p>Rather than duplicating those policies in ThunderID, the organization wants its existing policy engine to remain responsible for evaluating them.</p><p>This is where ThunderID’s AuthZEN PEP capability becomes useful.</p><p>ThunderID can establish a connection to an AuthZEN-compatible PDP and use that connection as the authorization engine for a resource server. When an authorization evaluation is required, ThunderID constructs the appropriate AuthZEN request, sends it to the configured PDP, and applies the returned decision.</p><h3>Following a token issuance request</h3><p>Suppose a client application requests access to a booking API with three permissions:</p><pre>read<br>create<br>cancel</pre><p>The booking resource server is configured to use a connected AuthZEN PDP.</p><p>During token authorization, ThunderID evaluates the candidate permissions by sending the relevant authorization information to the configured PDP. The PDP evaluates each action according to its policies and returns the decisions.</p><p>Imagine that Alice is permitted to read and create bookings but is not allowed to cancel them.</p><p>PDP permits the read and create actions but denies cancel.</p><p>ThunderID applies these decisions during token issuance. The resulting token can contain the permitted read and create permissions, while the denied cancel permission is excluded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-JOUe927981v_fNmBzDmw.png" /></figure><p>The key architectural difference is that ThunderID is no longer responsible for evaluating the underlying policy itself. The connected PDP makes the authorization decision, and ThunderID enforces the result within its token issuance workflow.</p><p>There is an important boundary here. A permission granted during token issuance does not automatically authorize access to every individual resource associated with that permission. If an API needs to check whether Alice owns a particular booking, that resource-specific decision may still need to be evaluated when the API request occurs.</p><p>AuthZEN makes it possible to connect these authorization decisions across systems, but it doesn’t remove the responsibility of enforcing access at the appropriate point.</p><h3>Who should choose the authorization engine?</h3><p>Once ThunderID can work with different authorization engines, another design question emerges: where should the engine selection be configured?</p><p>At first, associating a PDP with the client application might seem reasonable. After all, the client is requesting access.</p><p>But the client is the consumer of the resource, not necessarily the party responsible for defining how that resource should be protected.</p><p>Imagine the same application accessing a booking API and an administrative API. The booking API might use policies based on booking ownership and traveler relationships, while the administrative API might use a different authorization engine with its own security requirements.</p><p>Allowing the consuming application to select the authorization engine would give it influence over how access to someone else’s protected resources is evaluated.</p><p>A more appropriate boundary is the resource server.</p><p>In ThunderID, authorization engines can be associated with resource servers, allowing the authorization mechanism to be selected according to the protected resource. One resource server can continue using the built-in RBAC engine, while another can use a connected AuthZEN PDP.</p><p>This design keeps the authorization configuration aligned with the resource being protected and allows different APIs to adopt different authorization models without requiring consuming applications to understand those differences.</p><h3>When ThunderID plays both roles</h3><p>There’s one more interesting scenario that connects the two capabilities.</p><p>Imagine that our API gateway sends an AuthZEN evaluation request to ThunderID. From the gateway’s perspective, ThunderID is the PDP because it exposes the authorization API and returns the decision.</p><p>But suppose the requested resource belongs to a resource server configured to use a connected AuthZEN PDP.</p><p>ThunderID can resolve that authorization engine and delegate the evaluation to it. Once the connected PDP returns its decision, ThunderID sends the result back to the gateway, which enforces it.</p><p>The authorization path becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRdg-hBBHdqpFFPILdvchQ.png" /></figure><p>This is where supporting both roles becomes particularly interesting. ThunderID can expose a PDP interface to one system while acting as a client of another PDP behind the scenes.</p><p>It demonstrates that PEP and PDP describe responsibilities within an authorization interaction rather than permanent labels attached to a product.</p><p>From the gateway’s perspective, ThunderID provides the authorization decision. From ThunderID’s perspective, the connected PDP provides the policy evaluation.</p><p>The same standard connects both interactions.</p><h3>The harder part is defining the boundaries</h3><p>On the surface, integrating an AuthZEN-compatible PDP sounds straightforward: construct a request, send it to the policy engine, receive a boolean decision, and apply the result.</p><p>But the HTTP request is only one part of the integration.</p><p>A connected PDP needs sufficient information to evaluate its policies, which raises questions about subject attributes, resource identifiers, and context mapping. Different resource servers may use different authorization engines, so the system must resolve the appropriate engine without crossing resource-server boundaries.</p><p>Failures introduce another important consideration. An explicit deny decision is not the same as a network timeout or an invalid PDP response. When a decision cannot be obtained, the integration must avoid granting access based on an evaluation that never succeeded.</p><p>There are also operational and security concerns around authenticating outbound requests, protecting connection credentials, and handling the availability of a remote authorization service.</p><p>These are not unique to AuthZEN, but they become especially important when authorization crosses a network boundary.</p><p>The standard defines how systems communicate. A secure implementation must also define what each system is responsible for, what information it can trust, and how it behaves when the other side fails.</p><h3>One standard, two roles</h3><p>Authorization is often presented as a simple allow-or-deny decision. In practice, the more interesting questions are about where that decision is made, who owns the policies, and which component is responsible for enforcing the result.</p><p>AuthZEN provides a standardized way to connect those responsibilities without requiring every system to adopt the same authorization engine.</p><p>ThunderID’s support for both PDP and PEP capabilities illustrates this flexibility. It can expose its authorization capabilities to gateways and applications, consult connected policy engines when evaluating requested permissions, and route authorization evaluations according to the resource server’s configuration.</p><p>The broader value is interoperability. Organizations can use built-in authorization where it fits and connect other policy engines where their requirements demand it, without making every enforcement point dependent on the internals of those engines.</p><p><strong>Authorization doesn’t have to live in one place. What matters is that the systems making and enforcing decisions can communicate through a clear, consistent, and secure contract.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5a73af21622" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why OAuth Tokens Can’t Answer Every Permission Question]]></title>
            <link>https://medium.com/@yathusigakirubananthan/why-oauth-tokens-cant-answer-every-permission-question-7b458500df6e?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b458500df6e</guid>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 11:06:41 GMT</pubDate>
            <atom:updated>2026-07-31T11:06:41.039Z</atom:updated>
            <content:encoded><![CDATA[<h3>The moment I realized a valid access token doesn’t automatically mean a request should be allowed</h3><p>One of the things I enjoy about learning backend engineering is discovering that concepts I thought I understand are often much deeper than they first appear. The more I work with APIs, authentication, and authorization, the more I realize that many ideas seem simple until you encounter a real-world requirement that challenges your understanding.</p><p>OAuth was one of those concepts for me.</p><p>When I first learned OAuth, the flow seemed surprisingly straightforward. A user logs in, an access token is issued, and that token is sent along with requests to APIs. The API validates the token, checks that it hasn’t expired, and serves the request. Everything appeared clean and elegant. From the outside, it felt like the access token contained everything the system needed to know.</p><p>Because of that, I gradually developed a mental model that turned out to be incomplete. I started viewing the access token as the source of truth for permissions. If someone asked whether a user could perform an action, my instinctive answer was simple: check the token. If the token is valid and contains the required scope, the request should be allowed.</p><p>Looking back, I think many developers build a similar understanding when they first encounter OAuth. Most tutorials focus on obtaining tokens, validating them, checking scopes, and protecting API endpoints. The examples are intentionally simple because they are teaching the foundations. A user receives a token containing a scope such as booking.read, the API verifies that scope, and the request succeeds. For someone learning OAuth, it feels logical to assume that permissions are solved.</p><p>And to be fair, for many situations that approach works perfectly.</p><p>The problem is that real systems rarely remain that simple for long. As applications grow, permission requirements become more specific. Business rules become more complex. Different users need different levels of access to different resources. Gradually, the question stops being “Does this user have the required scope?” and becomes something much more specific.</p><p>That realization did not come from reading a specification or studying a security model. It came from thinking through a seemingly simple business requirement that exposed a gap in my assumptions.</p><p>At first glance, the requirement looked harmless.</p><p>In reality, it completely changed the authorization question.</p><h3>The Requirement That Changed the Question</h3><p>Imagine a travel booking application used by travel agents to manage customer bookings. One of the agents, Alice, logs into the application and receives an access token. Among other information, the token contains a scope such as booking.read.</p><p>From the perspective of the API, everything seems straightforward. Alice makes a request to view booking information, the token is validated, the required scope is present, and the request is allowed. If someone asked whether Alice can read bookings, the answer would appear to be yes.</p><p>This is exactly the kind of scenario that many OAuth examples are built around. A user has a permission, the permission is represented by a scope, and the API checks whether that scope exists. The model is easy to understand and easy to implement.</p><p>Then imagine that the business team introduces a new requirement.</p><p>Instead of allowing every travel agent to view every booking, agents should only be able to view bookings that are assigned to them. Alice can still read bookings, but only the bookings she is responsible for managing.</p><p>At first, this sounded like a minor change to me. After all, Alice still has the same permission. She still has the booking.read scope. The token hasn&#39;t changed. Surely the system can continue using the same approach.</p><p>But the more I thought about it, the more I realized that the question being asked had changed completely.</p><p>Before, the system was asking:</p><p><em>Can Alice read bookings?</em></p><p>Now the system is asking:</p><p><em>Can Alice read booking #123?</em></p><p>That small difference introduces an entirely new set of considerations.</p><p>The access token can tell us that Alice has a permission related to reading bookings. What it cannot automatically tell us is whether booking #123 is actually assigned to Alice. That information exists somewhere else, most likely in a database or another business system. The API now needs to know something about both the user and the resource being accessed.</p><p>Suppose Alice requests booking #123. To make a decision, the system may need to answer questions such as:</p><ul><li>Is booking #123 assigned to Alice?</li><li>Was it reassigned to another agent yesterday?</li><li>Is the booking owned by a different department?</li><li>Has access to this booking been restricted for some reason?</li></ul><p>None of these questions are really about the token itself. They are questions about the current state of the system.</p><p>This was the first moment I started seeing the difference between having a permission and being allowed to perform a specific action on a specific resource.</p><p>The token was still useful. It could tell the system who Alice was and what broad capabilities she had. But it was no longer enough to make the final authorization decision on its own.</p><p>And once I noticed that, I started seeing the same pattern everywhere.</p><h3>The Moment I Realized Permissions Change</h3><p>The booking example looked simple until I started changing the conditions.</p><p>Let’s say Alice logs in at 9:00 AM and receives an access token that is valid for the next hour. At that moment, she is assigned to booking #123, and everything looks normal.</p><p>But what happens if something changes after the token is issued?</p><p>Imagine that at 9:15 AM, a manager reassigns booking #123 to another travel agent. Or perhaps Alice moves to a different team. Maybe the booking becomes restricted because it contains sensitive information. None of these changes require Alice to log in again. Her access token is still valid.</p><p>If the system only looks at the token, it would continue seeing the same information it saw at 9:00 AM.</p><p>That was when another realization hit me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ld_OKx9CLOPviSwetdkiFA.png" /></figure><p>An access token is often a snapshot of information that existed when it was created. It can contain details about the user, their identity, their roles, or the scopes that were granted. But the world around that token continues to change.</p><p>This becomes even more obvious when we think about how businesses operate in the real world. Organizations constantly update roles, move employees between teams, revoke access, archive resources, and introduce new policies. If every authorization decision depended entirely on information stored inside a token, the system could easily end up making decisions based on outdated information.</p><p>The more I explored backend systems, the more I realized that many authorization decisions depend on information that only exists at the moment the request is made.</p><p>A valid token might tell us that Alice is a travel agent.</p><p>But it cannot always tell us:</p><ul><li>Whether Alice is still assigned to a particular booking.</li><li>Whether the booking is currently active.</li><li>Whether company policy allows access at this moment.</li><li>Whether another system has changed the relationship between Alice and the booking.</li></ul><p>Those answers often require a fresh evaluation using the current state of the system.</p><p>This was the point where I stopped thinking about authorization as a simple token check.</p><p>Instead, I started seeing authorization as a decision-making process.</p><p>The token is one input into that process, but it is rarely the only input.</p><p>And once I started looking at it that way, examples of this problem began appearing everywhere — not just in travel booking systems, but in almost every application I use every day.</p><h3>Once I Saw It, I Started Seeing It Everywhere</h3><p>After understanding the limitation in the booking example, I started noticing the same pattern in many of the applications I use every day.</p><p>The interesting thing is that these systems often appear simple from the outside. We click a button, open a page, or access a resource without thinking about the authorization decisions happening behind the scenes. But once you start looking closely, you realize that many of those decisions require far more information than what can comfortably fit inside an access token.</p><p>Take a document-sharing platform as an example.</p><p>Imagine a user has permission to read documents. If authorization were purely based on that permission, the user should be able to read every document in the system. But that is obviously not how document-sharing applications work.</p><p>Instead, the system needs to answer additional questions.</p><p>Who owns this document?</p><p>Has it been shared with the user?</p><p>Was access removed five minutes ago?</p><p>Is the document private, internal, or public?</p><p>The authorization decision depends not only on the user but also on the specific document being accessed. Two requests made by the same user might produce completely different outcomes depending on which document is involved.</p><p>The same pattern appears in source code hosting platforms.</p><p>A developer may have permission to view repositories, but that does not automatically mean they can view every repository within an organization. Access often depends on team membership, repository ownership, project relationships, or organization policies. The system must evaluate those relationships before making a decision.</p><p>Banking applications provide another good example.</p><p>A customer may have permission to view accounts, but that does not mean they can view every account managed by the bank. The system needs to determine which accounts belong to that customer, whether the account is active, whether there are restrictions on access, and sometimes even whether additional verification is required.</p><p>The more examples I considered, the more a common pattern emerged.</p><p>Most real-world authorization questions are not simply asking:</p><p><em>Does this user have permission X?</em></p><p>Instead, they are asking:</p><p><em>Can this user perform action X on resource Y under the current circumstances?</em></p><p>That is a much richer question.</p><p>It requires information about the user.</p><p>It requires information about the resource.</p><p>It may require information about relationships between users and resources.</p><p>And sometimes it even requires information about the current context, such as time, location, risk level, or organizational policies.</p><p>This was a major shift in how I thought about backend systems.</p><p>I had originally viewed authorization as something that happened entirely through tokens and scopes. But the systems I was observing were making decisions using a much broader set of information.</p><p>The token was still important. In fact, it was often the starting point of the decision.</p><p>But it was rarely the end of the story.</p><p>And that led me to a question I had never really asked before:</p><p>If access tokens are not designed to answer all of these authorization questions, then what problem are they actually trying to solve?</p><h3>Part 5: What OAuth Is Actually Solving</h3><p>This was the point where I had to revisit my understanding of OAuth.</p><p>I had unconsciously treated OAuth as an authorization system. If a request arrived with a valid access token, I assumed the token itself was responsible for answering permission questions. But the more I explored real-world scenarios, the more I realized that OAuth is solving a different problem.</p><p>At its core, OAuth is about delegated access.</p><p>It allows a user to grant an application access to resources without sharing their credentials. Instead of giving an application a username and password, the user authorizes the application to obtain an access token that can be used when calling APIs.</p><p>That access token becomes proof that access has been granted.</p><p>This is an incredibly important responsibility.</p><p>Without OAuth, modern applications would struggle to securely access APIs on behalf of users. The entire ecosystem of web applications, mobile applications, and third-party integrations depends on this capability.</p><p>But notice what OAuth is primarily concerned with.</p><p>Questions such as:</p><ul><li>Who is making this request?</li><li>Has the user granted access to this application?</li><li>What scopes were granted?</li><li>Is the token valid?</li><li>Has the token expired?</li></ul><p>These are all important questions, and OAuth helps answer them very well.</p><p>The mistake I made was assuming that these were the only questions a backend system needed to answer.</p><p>In reality, many authorization decisions happen after those questions have already been answered.</p><p>Imagine a request arriving at an API.</p><p>The first step might be validating the access token. If the token is invalid, the request is rejected immediately. If the token is valid, the system now knows who the user is and what general permissions have been granted.</p><p>But the application may still need to perform additional checks before allowing the operation.</p><p>It may need to verify ownership.</p><p>It may need to check relationships between entities.</p><p>It may need to evaluate business policies.</p><p>It may need to consider contextual information that didn’t exist when the token was issued.</p><p>In other words, a valid token often gets the request through the front door, but it does not always determine what happens next.</p><p>This distinction helped me understand why modern systems often separate authentication and authorization into different layers.</p><p>Authentication establishes identity.</p><p>OAuth enables delegated access and token-based communication.</p><p>Authorization evaluates whether a specific action should be allowed.</p><p>They work together, but they are not the same thing.</p><p>Once I understood that separation, many architectural decisions I had previously seen in production systems started making more sense. The additional authorization checks, policy engines, permission services, and access evaluations were not replacing OAuth. They were solving a different problem that OAuth was never designed to solve in the first place.</p><p>And that realization completely changed how I think about permissions in backend systems today.</p><h3>The Lesson I Took Away</h3><p>One of the most valuable lessons I’ve learned while exploring backend engineering is that the most important questions are often hidden behind seemingly simple concepts.</p><p>When I first learned OAuth, I thought the interesting part was obtaining and validating tokens. Those were the things I could see happening. They were easy to understand and easy to visualize.</p><p>What I didn’t realize was that many of the hardest authorization problems begin after the token has already been validated.</p><p>A user may be authenticated.</p><p>The token may be valid.</p><p>The required scope may be present.</p><p>And yet the system may still need to determine whether a particular action should be allowed.</p><p>That decision often depends on information that lives outside the token: resource ownership, organizational relationships, business policies, contextual data, and the current state of the system.</p><p>Looking back, I don’t think my misunderstanding came from learning OAuth incorrectly. It came from assuming that OAuth was responsible for solving every permission problem. The deeper I went into real-world systems, the more I realized that authorization is often much broader than token validation.</p><p>Today, when I look at an access token, I no longer see it as the final answer to an authorization decision. I see it as one important piece of information that helps the system make that decision.</p><p>A valid token can tell us who is making a request.</p><p>It can tell us what access was granted.</p><p>But many modern applications need to answer a much more specific question:</p><p><em>Can this user perform this action on this resource right now?</em></p><p>And sometimes, the only way to answer that question is to look beyond the token itself.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b458500df6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Static Scopes to Runtime Decisions: How We Added AuthZEN Authorization to ThunderID’s…]]></title>
            <link>https://medium.com/@yathusigakirubananthan/from-static-scopes-to-runtime-decisions-how-we-added-authzen-authorization-to-thunderids-ba450a058995?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba450a058995</guid>
            <category><![CDATA[thunderid]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[policy-decision-point]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[authzen]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 07:52:37 GMT</pubDate>
            <atom:updated>2026-07-10T07:57:20.948Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Static Scopes to Runtime Decisions: How We Added AuthZEN Authorization to ThunderID’s Wayfinder Sample</h3><p><strong><em>“Can you recommend the best flight for my trip next month?”</em></strong></p><p>To us, it’s a simple question to ask an AI assistant. To the application behind the scenes, it’s a surprisingly complex request.</p><p>Before the AI can answer, it may need to search flights, read existing bookings, check upgrade eligibility, retrieve user preferences, and call several backend tools. Some of those operations only read information, while others can modify user data.</p><p>That naturally raises an important question.</p><p><strong>How do we decide whether the AI agent should actually be allowed to perform those actions?</strong></p><p>This week, I had the opportunity to work on exactly that problem while contributing to <strong>Wayfinder</strong>, ThunderID’s sample AI travel application. My task was to integrate <strong>ThunderID’s AuthZEN Policy Decision Point (PDP)</strong> into the existing application and demonstrate how runtime authorization can strengthen AI-powered systems.</p><p>When I first picked up the task, I assumed it would be another authorization feature — a few API calls, some policy checks, and we would be done.</p><p>Instead, it turned into an interesting lesson about how authorization changes once AI agents become first-class participants in an application.</p><h3>Meet Wayfinder</h3><p>Before talking about the implementation, it’s worth understanding what Wayfinder actually is.</p><p><strong>ThunderID</strong> is an identity and access management platform, and <strong>Wayfinder</strong> serves as its sample application for demonstrating modern authentication, authorization, consent, and AI integration patterns.</p><p>Rather than being a simple demo with a login page, Wayfinder resembles a real travel application. Users can sign in securely, search for flights, create bookings, manage reservations, and request seat upgrades.</p><p>What makes it particularly interesting is its built-in <strong>AI Concierge</strong>.</p><p>Instead of calling backend APIs directly, the AI interacts with the application through the <strong>Model Context Protocol (MCP)</strong>. The backend exposes travel capabilities as MCP tools, allowing the AI to search flights, recommend bookings, retrieve reservations, and perform other travel-related operations.</p><p>Wayfinder also demonstrates several identity scenarios that are becoming increasingly common in modern applications:</p><ul><li>User authentication with OAuth and OpenID Connect</li><li>Consent-driven authorization flows</li><li>AI agent interactions</li><li>On-behalf-of authorization</li><li>MCP Inspector integration</li><li>Background agent workflows</li></ul><p>Before I started working on this project, all of these scenarios were already functioning correctly. That meant one thing. Whatever solution we introduced couldn’t break any of the existing user journeys. That simple requirement ended up driving almost every design decision.</p><h3>How Authorization Originally Worked</h3><p>Like many modern applications, Wayfinder originally protected its backend operations using <strong>OAuth scopes</strong>.</p><p>Every protected MCP tool was associated with a specific permission. When a request arrived, the backend validated the caller’s access token and checked whether it contained the required scope.</p><p>Conceptually, the flow looked like this:</p><pre>User or AI Client<br>        │<br>        ▼<br> Access Token<br>        │<br>        ▼<br>Backend validates token<br>        │<br>        ▼<br>Required scope present?<br>        │<br>   ┌────┴────┐<br>   │         │<br> Allow     Deny</pre><p>This is exactly how OAuth was designed to work. If the token contains the required permission, the request proceeds. Otherwise, the backend rejects it. There’s nothing wrong with this approach.</p><p>In fact, <strong>scope-based authorization still remains the default authorization model in Wayfinder today.</strong></p><p>So naturally, the question becomes:</p><p><strong>If this already works, why introduce something else?</strong></p><h3>When AI Agents Change the Question</h3><p>The answer became much clearer once I started thinking about how AI agents actually use MCP tools.</p><p>Imagine four different situations.</p><p>In the first, John signs into Wayfinder and opens MCP Inspector. He invokes a booking tool directly. Later, John opens the AI Concierge and asks,</p><p><em>“Can you recommend flights for my vacation?”</em></p><p>The AI invokes the very same MCP tool on his behalf. That night, a background scheduler processes pending upgrade requests. Meanwhile, another autonomous workflow analyzes booking information to prepare recommendations.</p><p>All four scenarios might execute exactly the same backend tool.</p><p>But they are not the same request. The identity behind each request is different. The responsibility behind each request is different. The context behind each request is different. And that means the authorization decision might also need to be different.</p><p>At that point, I realized something interesting. The question was no longer:</p><p><strong><em>Does this access token contain the required scope?</em></strong></p><p>Instead, it had become:</p><p><strong><em>Should this particular subject be allowed to perform this specific action on this resource right now?</em></strong></p><p>That’s a very different question.</p><p>Instead of looking only at the contents of an access token, the backend now needs to consider the identity making the request, the action being performed, the resource being accessed, and the authorization policy that applies at that moment.</p><p>That’s exactly the kind of problem <strong>AuthZEN</strong> was designed to solve.</p><h3>Moving Beyond Static Scope Checks</h3><p>One thing I appreciate about this project is that it never tries to replace OAuth. OAuth scopes are still incredibly useful. They’re efficient, well understood, and continue to solve the majority of authorization needs in traditional applications.</p><p>The challenge wasn’t that scopes were wrong.</p><p>The challenge was that AI introduces new kinds of callers.</p><p>Sometimes the caller is a user.</p><p>Sometimes it’s an AI assistant.</p><p>Sometimes it’s an agent acting on behalf of a user.</p><p>Sometimes it’s an autonomous background service.</p><p>All of them may invoke the same tool, but not all of them should necessarily receive the same authorization decision.</p><p>That’s where <strong>runtime authorization</strong> becomes valuable. Instead of relying solely on permissions embedded inside an access token, the application can ask a <strong>Policy Decision Point</strong> to evaluate the request when the tool is about to execute. Rather than asking,</p><p>“Does this token contain the required permission?”</p><p>the backend asks,</p><p>“Can this subject perform this action on this resource right now?”</p><p>It’s a subtle difference.</p><p>But once AI agents become part of your architecture, that subtle difference becomes incredibly powerful.</p><p>Since Wayfinder is ThunderID’s sample application, integrating <strong>ThunderID’s AuthZEN Policy Decision Point</strong> was a natural way to demonstrate this approach.</p><p>The next challenge was figuring out how to introduce runtime authorization without changing any of the application’s existing behavior. That turned out to be the most interesting part of the implementation.</p><h3>Designing the Solution</h3><p>Once we understood the problem, the next question was surprisingly simple.</p><p><strong>How do we introduce runtime authorization without breaking everything that already works?</strong></p><p>Wayfinder already supported several user journeys.</p><p>The web application.</p><p>The AI Concierge.</p><p>MCP Inspector.</p><p>On-behalf-of authorization.</p><p>Consent flows.</p><p>Background upgrade processing.</p><p>None of these should behave differently just because we wanted to demonstrate AuthZEN. So instead of replacing the existing authorization model, we decided to make runtime authorization an <strong>optional mode</strong>.</p><p>The application can now run in one of two configurations.</p><pre>AUTHORIZATION_MODE=scope</pre><p>or</p><pre>AUTHORIZATION_MODE=authzen</pre><p>When running in <strong>scope</strong> mode, Wayfinder behaves exactly as it always has. Protected MCP tools validate the required OAuth scopes before execution.</p><p>When switched to <strong>AuthZEN</strong> mode, only one part of the request flow changes.</p><p>Instead of making the authorization decision locally, the backend asks <strong>ThunderID’s AuthZEN Policy Decision Point</strong> whether the requested action should be allowed.</p><p>That one design decision gave us something we really wanted. We could demonstrate runtime authorization without maintaining two separate implementations, and existing demos continued to work exactly as before.</p><h3>Not Every Tool Needs the Same Protection</h3><p>Another question quickly came up.</p><p>Should every MCP tool require authorization?</p><p>The answer is <strong>no</strong>.</p><p>Some tools simply require that the caller is authenticated. Others perform sensitive operations such as creating bookings, retrieving reservations, cancelling trips, or processing upgrades. Those clearly require additional authorization. To keep the implementation simple, every protected MCP tool is mapped to the permission it requires.</p><p>For example, a booking recommendation tool requires a recommendation permission, while creating a booking requires a booking creation permission.</p><p>This mapping became the bridge between Wayfinder’s MCP tools and ThunderID’s authorization policies. One small but important decision was to <strong>fail closed</strong>. If someone adds a new MCP tool but forgets to define its authorization rule, the backend doesn’t assume it’s safe. Instead, the request is denied until an explicit permission mapping has been added.</p><p>It’s one of those details users never notice, but from a security perspective it makes a big difference.</p><h3>Runtime Authorization in Action</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxisdMndy3OshytcGHRx_g.png" /></figure><p>With AuthZEN enabled, the request flow changes slightly.</p><p>Previously, the backend would validate the token, check its scopes, and immediately execute the requested tool. Now there’s one additional step. Before executing the tool, the backend asks ThunderID whether the operation should be allowed.</p><p>The flow now looks like this.</p><pre>User / AI Agent<br>        │<br>        ▼<br>     MCP Tool<br>        │<br>        ▼<br> Wayfinder Backend<br>        │<br>        ▼<br> Build Authorization Request<br>        │<br>        ▼<br> ThunderID AuthZEN PDP<br>        │<br>        ▼<br>  Allow or Deny<br>        │<br>        ▼<br> Execute Tool</pre><p>From the user’s perspective, nothing changes.</p><p>The AI still answers the question. The MCP tool is still invoked. The backend still performs the business logic. The only difference is that the authorization decision is no longer made inside the application itself. Instead, it is delegated to ThunderID’s Policy Decision Point. That separation of responsibilities is one of the biggest advantages of the AuthZEN model.</p><p>The application focuses on business logic.</p><p>ThunderID focuses on authorization.</p><h3>What Does ThunderID Actually Evaluate?</h3><p>Whenever a protected MCP tool is invoked, the backend constructs an authorization request before contacting ThunderID.</p><p>At its core, the request answers three questions.</p><p><strong>Who</strong> is making the request?</p><p><strong>What</strong> resource are they trying to access?</p><p><strong>What</strong> action are they attempting to perform?</p><p>For example, when the AI Concierge invokes the booking recommendation tool, the backend sends an authorization request describing:</p><ul><li>the <strong>subject</strong> (the AI Concierge),</li><li>the <strong>resource</strong> (Wayfinder),</li><li>and the <strong>action</strong> (booking recommendation).</li></ul><p>ThunderID evaluates these attributes against its authorization policies and returns either <strong>Allow</strong> or <strong>Deny</strong>. What I like about this model is that the authorization decision isn’t tied to a specific access token. It’s tied to the actual operation being performed. That makes it much easier to support different kinds of callers without changing the application itself.</p><h3>The Two-Token Model</h3><p>One part of the implementation initially confused me.</p><p>If the backend is asking ThunderID whether an action should be allowed, how does the backend authenticate to ThunderID?</p><p>At first I assumed the answer would be:</p><p><em>“The AI agent authenticates to ThunderID.”</em></p><p>But that’s not what happens. Instead, the backend authenticates itself using its own trusted service credentials. That service credential simply allows the backend to call ThunderID’s AuthZEN endpoint. It is <strong>not</strong> the identity being authorized. This distinction is subtle but extremely important. Imagine John asks the AI Concierge to recommend flights. The backend authenticates to ThunderID using its own service credentials.</p><p>However, the <strong>subject</strong> inside the authorization request is still <strong>John</strong> or the <strong>AI Concierge</strong>, depending on who is actually performing the operation. The backend is only asking the question. ThunderID is deciding whether the real subject is allowed to perform the requested action.</p><p>Once I understood that separation, the architecture became much clearer.</p><p>The backend doesn’t own authorization decisions. It simply forwards the relevant context to ThunderID and enforces whatever decision is returned.</p><h3>Why I Liked This Design</h3><p>The more I worked on the integration, the more I appreciated how little disruption it introduced.</p><p>We didn’t have to redesign Wayfinder. We didn’t have to rewrite existing MCP tools. We didn’t have to replace OAuth. Instead, we simply inserted a runtime authorization step before protected operations. That means developers can still use traditional scope validation whenever it’s sufficient. And when applications require richer authorization decisions — especially for AI agents — they can enable AuthZEN with minimal changes.</p><p>To me, that’s what good engineering looks like.</p><p>Rather than replacing existing systems, it extends them in a way that lets developers adopt new capabilities gradually. The implementation felt less like introducing a completely new authorization model and more like teaching an existing application how to ask a better question before executing a sensitive operation.</p><h3>Seeing Runtime Authorization in Action</h3><p>Once everything was wired together, the most satisfying part wasn’t seeing the code compile or the tests pass.</p><p>It was watching the same MCP tool produce different authorization decisions depending on <strong>who</strong> was invoking it.</p><p>Imagine two different scenarios.</p><p>In the first scenario, <strong>John</strong> signs in and connects to Wayfinder through MCP Inspector. He invokes the recommend_bookings tool directly. The request reaches the Wayfinder backend, which builds an AuthZEN authorization request and sends it to ThunderID. ThunderID evaluates the request using the subject, resource, and action provided by the backend. If John doesn’t have permission to perform that operation, ThunderID returns a <strong>Deny</strong> decision. The backend respects that decision and the MCP tool never executes.</p><p>Now let’s look at another scenario.</p><p>Instead of John calling the tool directly, the <strong>Wayfinder AI Concierge</strong> invokes exactly the same tool while helping a user plan a trip. The backend follows exactly the same process. It builds the authorization request. It calls ThunderID. It waits for a decision. The difference is that the subject being evaluated is now the AI Concierge rather than John. Although the requested operation is identical, ThunderID may return a completely different decision because the subject has changed. That simple demonstration captures the biggest advantage of runtime authorization. The application isn’t just checking whether a permission exists inside an access token. It’s evaluating <strong>who</strong> is performing the action before deciding whether the operation should continue.</p><p>For AI applications, where the same backend capability may be invoked by users, AI assistants, delegated workflows, or background services, that extra context becomes incredibly valuable.</p><h3>Authentication, Consent, and Authorization Are Different Problems</h3><p>Working on this project also helped me connect three concepts that are often discussed together but solve very different problems.</p><p><strong>Authentication</strong> answers a simple question:</p><p>Who are you?</p><p>ThunderID authenticates users and issues the tokens that identify them.</p><p><strong>Consent</strong> answers another question:</p><p>Has the user approved this application or AI agent to access specific capabilities?</p><p>For example, when the AI Concierge needs permission to access a user’s bookings, Wayfinder redirects the user through a consent flow. Once the user approves the requested permissions, the AI can obtain a user-context token and continue acting on the user’s behalf. But even after both authentication and consent have succeeded, one important question still remains.</p><p><strong><em>Should this action actually be allowed?</em></strong></p><p>That’s the responsibility of authorization. With AuthZEN, the backend doesn’t simply trust that every permission inside an access token should always be accepted. Instead, it asks ThunderID to evaluate the request at runtime. That distinction became much clearer to me while working on this integration.</p><p>Authentication proves identity. Consent records approval. Authorization decides whether the requested action should actually happen. Although they often work together, they solve three completely different problems.</p><h3>Building for Reliability</h3><p>Adding runtime authorization also means introducing another network call into the request path. That immediately raises another concern.</p><p>What happens if the authorization service is slow?</p><p>Or temporarily unavailable?</p><p>Or returns an unexpected response?</p><p>Those questions shaped several implementation decisions.</p><p>To avoid requesting a new access token every time the backend contacted ThunderID, we introduced <strong>token caching</strong>. If multiple requests arrived simultaneously while the backend was still obtaining a token, they shared the same in-flight request instead of creating multiple identical token requests. Timeout protection ensured that the backend wouldn’t wait indefinitely for an authorization decision. Perhaps the most important decision, however, was to <strong>fail closed</strong>.</p><p>If the backend couldn’t obtain a clear <strong>Allow</strong> decision from ThunderID — whether because of a communication failure, an unexpected response, or an explicit denial — the protected MCP tool simply wouldn’t execute. From a security perspective, that’s exactly the behavior we wanted. When authorization is uncertain, it’s safer to reject the request than to accidentally allow an operation that shouldn’t happen.</p><h3>Looking Back</h3><p>One thing I appreciated throughout this project was that we never tried to replace OAuth.</p><p>OAuth scopes continue to work extremely well, and they remain the default authorization mechanism in Wayfinder. AuthZEN simply adds another layer for applications that need runtime policy evaluation. That means existing applications don’t have to abandon their current security model.</p><p>Instead, they can gradually introduce runtime authorization wherever additional context becomes important.</p><p>For me, that’s one of the biggest strengths of this approach.</p><p>Rather than forcing developers to choose between OAuth and AuthZEN, the two approaches complement each other. Scopes continue to answer <strong>what permissions were granted when the token was issued</strong>. AuthZEN answers <strong>whether this action should be allowed right now</strong>.</p><p>When I first started this task, I thought it would mostly involve connecting another authorization API. By the time I finished, I realized the real lesson had very little to do with APIs. It was about how the way we think about authorization is changing. Traditional applications usually have one obvious caller: the authenticated user.</p><p>AI-powered applications are different.</p><p>The same backend operation might be invoked directly by a user, by an AI assistant, by an agent acting on behalf of a user, or by an autonomous background service. Those requests may all look similar, but they don’t necessarily deserve the same authorization decision. That’s why I found this project so interesting. It wasn’t about replacing OAuth or proving that scopes are no longer useful.</p><p>It was about recognizing that AI applications introduce new identities, new execution contexts, and new authorization challenges.</p><p>By integrating ThunderID’s AuthZEN Policy Decision Point into Wayfinder, we demonstrated how an existing application can evolve from static scope validation to runtime authorization decisions without disrupting the architecture that was already in place.</p><p>For me, that was the biggest takeaway.</p><p>The most important authorization question is no longer just:</p><p><strong><em>“Does this token contain the required permission?”</em></strong></p><p>As AI systems become more capable, the more meaningful question becomes:</p><p><strong><em>“Should this subject be allowed to perform this action right now?”</em></strong></p><p>I believe that’s a shift we’ll continue to see as AI agents become a larger part of the applications we build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba450a058995" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The First Time I Opened a Production Go Codebase and Felt Completely Lost]]></title>
            <link>https://medium.com/@yathusigakirubananthan/the-first-time-i-opened-a-production-go-codebase-and-felt-completely-lost-288b1602f8eb?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/288b1602f8eb</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 05:37:40 GMT</pubDate>
            <atom:updated>2026-07-08T05:37:40.116Z</atom:updated>
            <content:encoded><![CDATA[<h3>It wasn’t the code that confused me. It was everything around it.</h3><p>A month ago, I opened a real production Go codebase for the first time.</p><p>I wasn’t looking for anything complicated.</p><p>I just wanted to understand how one API worked.</p><p>In my mind, it sounded simple.</p><p>Find the endpoint.</p><p>Read the code.</p><p>Understand the logic.</p><p>Close the laptop feeling a little smarter.</p><p>That was the plan.</p><p>Instead, I found myself staring at a project structure that looked nothing like anything I had built before.</p><pre>handlers/<br>services/<br>repositories/<br>middleware/<br>models/<br>internal/<br>providers/<br>...</pre><p>I remember scrolling through the folders and thinking:</p><p><strong>Why does one API need all of this?</strong></p><p>Most of my university projects looked completely different.</p><p>A few Go files.</p><p>Some functions.</p><p>Maybe a database package.</p><p>Everything was easy to find because everything lived close together.</p><p>This project felt different.</p><p>Almost intimidating.</p><p>I wasn’t confused because I didn’t know Go.</p><p>I was confused because I didn’t understand the architecture.</p><h3>I started following one API</h3><p>Instead of trying to understand the whole project, I decided to follow a single request.</p><p>Just one.</p><p>If I could understand one request, maybe the rest of the project would make sense too.</p><p>So I found an endpoint.</p><p>It led me to a handler.</p><p>I opened the file expecting to see business logic.</p><p>Instead, I saw something surprisingly small.</p><pre>func GetUserHandler() {<br>    userService.GetUser(id)<br>}</pre><p>That was it.</p><p>I remember staring at the screen for a moment.</p><p><strong>Where was the actual code?</strong></p><p>The handler wasn’t doing much.</p><p>It simply forwarded the request somewhere else.</p><p>So naturally, I clicked into the service.</p><h3>Surely the service contains the real logic…</h3><p>The service was larger.</p><p>But not in the way I expected.</p><p>It performed some business decisions.</p><p>It validated a few things.</p><p>Then…</p><p>It called another layer.</p><pre>userRepository.GetUser(id)</pre><p>Again.</p><p>No SQL.</p><p>No database queries.</p><p>No huge block of code.</p><p>Just another function call.</p><p>At this point I honestly wondered if someone had hidden the real application from me.</p><p>Every file seemed to be passing responsibility to another file.</p><p>I kept following the trail.</p><p>Eventually, I reached the repository.</p><p>And finally…</p><p>There it was.</p><p>The database interaction.</p><p>The SQL.</p><p>The part I had been looking for all along.</p><p>That’s when something finally clicked.</p><h3>I had been asking the wrong question</h3><p>For hours I had been asking:</p><p><strong><em>Why are there so many layers?</em></strong></p><p>But that wasn’t the right question.</p><p>The better question was:</p><p><strong><em>What responsibility does each layer have?</em></strong></p><p>Once I started looking at it that way, everything became much clearer.</p><p>The handler wasn’t supposed to know how the database worked.</p><p>Its job was simply to receive an HTTP request and pass it to the next layer.</p><p>The service wasn’t supposed to understand SQL.</p><p>Its responsibility was to make business decisions.</p><p>The repository wasn’t concerned with HTTP requests or business rules.</p><p>Its only responsibility was talking to the database.</p><p>Each layer knew exactly one thing.</p><p>Nothing more.</p><p>Nothing less.</p><h3>Then I remembered my own projects</h3><p>I started comparing this architecture with projects I had built before.</p><p>In my university assignments, one function often did everything.</p><p>It validated input.</p><p>Talked to the database.</p><p>Applied business logic.</p><p>Returned the response.</p><p>It worked.</p><p>And honestly…</p><p>For small projects, that’s perfectly fine.</p><p>But then I imagined something different.</p><p>Imagine the project growing for five years.</p><p>Hundreds of API endpoints.</p><p>Millions of users.</p><p>Dozens of developers joining and leaving the team.</p><p>New features every month.</p><p>Changing business requirements.</p><p>Security improvements.</p><p>Performance optimizations.</p><p>Now imagine all of that living inside one massive function.</p><p>Suddenly, the folders I once thought were unnecessary started making perfect sense.</p><h3>Architecture isn’t about adding layers</h3><p>One misunderstanding I had was thinking architecture existed to make projects look more “professional.”</p><p>Now I see it differently.</p><p>Architecture isn’t about adding layers.</p><p>It’s about separating responsibilities.</p><p>The handler should focus on communication.</p><p>The service should focus on business rules.</p><p>The repository should focus on data.</p><p>Each layer protects the others from unnecessary complexity.</p><p>That separation makes the project easier to understand, easier to test, and easier to change.</p><p>Not just today.</p><p>But years from now.</p><h3>Then something connected with last week’s article</h3><p>Last week, I wrote about what happens when an API request reaches a backend server.</p><p>I followed the request as it traveled through different parts of the system.</p><p>This week, I realized something else.</p><p>Every stop in that journey usually belongs to a completely different part of the codebase.</p><p>The request enters through a handler.</p><p>The handler asks the service what should happen.</p><p>The service requests data from the repository.</p><p>The repository communicates with the database.</p><p>The request isn’t just moving through a system.</p><p>It’s moving through a carefully designed architecture.</p><p>That was a connection I had never made before.</p><h3>The biggest mindset shift</h3><p>Looking back, I don’t think I was overwhelmed because production software was complicated.</p><p>I was overwhelmed because I had only ever built software designed to be finished.</p><p>Production software isn’t designed to be finished.</p><p>It’s designed to evolve.</p><p>Every new feature.</p><p>Every bug fix.</p><p>Every developer who joins the team adds more complexity.</p><p>Good architecture doesn’t eliminate that complexity.</p><p>It gives it a place to live.</p><p>And I think that’s one of the biggest lessons I’ve learned while exploring backend engineering.</p><p>I’m slowly realizing that writing code is only one part of software engineering.</p><p>Designing software that other engineers can continue building years later is an entirely different skill.</p><p>And that’s the skill I’m starting to appreciate every time I open a production codebase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=288b1602f8eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Building Real-Time Authorization with Envoy Proxy and ThunderID Taught Me About API Security]]></title>
            <link>https://medium.com/@yathusigakirubananthan/what-building-real-time-authorization-with-envoy-proxy-and-thunderid-taught-me-about-api-security-57113b8aaa30?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/57113b8aaa30</guid>
            <category><![CDATA[authzen]]></category>
            <category><![CDATA[thunderid]]></category>
            <category><![CDATA[envoy-proxy]]></category>
            <category><![CDATA[pdp]]></category>
            <category><![CDATA[authorization]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 03 Jul 2026 10:34:42 GMT</pubDate>
            <atom:updated>2026-07-03T10:34:42.203Z</atom:updated>
            <content:encoded><![CDATA[<p>One thing I have started noticing recently is that real engineering work often changes how we understand concepts we thought were already familiar.</p><p>Sometimes a system looks straightforward when we first learn about it. We understand the architecture diagrams, we understand the definitions, and after a while we assume we understand the entire problem space. But the moment we start building something real, we begin noticing layers of complexity that were easy to ignore when everything existed only as theory.</p><p>I experienced something similar while working on integrating Envoy Proxy with ThunderID’s AuthZEN Policy Decision Point. What initially started as an integration task eventually changed how I think about API security, particularly the relationship between authentication, authorization, and the way API gateways usually trust access tokens.</p><p>Before this project, I had been working on implementing AuthZEN support inside ThunderID itself. The purpose of that work was to allow ThunderID to act as a Policy Decision Point capable of receiving authorization requests and returning standardized allow or deny decisions. After completing that implementation, the next question naturally followed. A Policy Decision Point by itself cannot do much unless another system actively asks it for authorization decisions. In a real-world architecture, incoming API requests first pass through some form of gateway, and that gateway needs to decide when authorization checks should happen before requests are allowed to reach backend services. This was what led me to start exploring Envoy.</p><p>The overall architecture seemed fairly straightforward at first. The application would send requests toward Envoy, Envoy would sit in front of the protected backend service as the Policy Enforcement Point, and before forwarding the request, Envoy would ask ThunderID whether the caller should be allowed to access the requested API. If ThunderID returned an allow decision, the request would continue normally. If ThunderID denied access, Envoy would immediately stop the request. Conceptually, the design felt simple enough.</p><p>Before starting the integration, I spent some time understanding how Envoy actually processes incoming traffic internally. Until then, I had mostly thought about API gateways in a simplified way: a request arrives, the gateway performs security checks, and the request moves forward. But Envoy’s architecture is much more structured. Requests pass through a chain of filters, where each filter gets an opportunity to inspect the request, modify it, or completely block it before the request reaches the backend service. For the flow I was building, the relevant filters were the JWT authentication filter, followed by the external authorization filter, and finally the router responsible for forwarding traffic downstream.</p><p>The JWT authentication filter immediately caught my attention because it performs exactly what many modern API architectures rely on. It validates the incoming access token, verifies the token signature, checks whether the issuer is trusted, confirms that the token has not expired, and extracts the identity of the caller from the verified token claims.</p><p>At first, I assumed that once this step succeeded, most of the authorization problem had already been solved. After all, when an authorization server creates a JWT, it already examines the user’s roles, permissions, and scopes before generating the token. The gateway simply validates that token later and trusts the authorization information already stored inside it.</p><p>But while thinking through this architecture, I found myself asking a question I had never seriously considered before. What happens if the information inside the JWT is no longer correct?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHuwypljNAtdLLiWd5BvWQ.png" /></figure><p>Imagine a user logs into an application and receives an access token allowing access to a protected API. At the moment that token is created, the authorization server looks at the user’s assigned roles and permissions and embeds that information inside the JWT. Everything works exactly as expected. But suppose a few minutes later an administrator removes that user from a privileged role.</p><p>Logically, the user should immediately lose access. The problem is that the JWT has already been issued, and nothing inside that token changes after it leaves the authorization server. As long as the token remains valid, Envoy continues trusting information that may no longer reflect the actual state of the system.</p><p>This was probably the moment I started thinking differently about API gateways. I realized I had been unconsciously treating authentication and authorization as if they were part of the same security problem. In reality, they solve very different problems. Authentication tells the system who the caller is. Authorization answers a more dynamic question: should this caller still be allowed to perform this action right now? That phrase — right now — suddenly became much more important than I had previously appreciated, because systems constantly change. Roles change, permissions change, and access policies change, while the JWT continues carrying information captured at a single point in time.</p><p>This realization fundamentally changed how I approached the integration. Instead of allowing Envoy to treat JWT validation as the final security decision, I started thinking about separating authentication and authorization into two independent stages. Envoy would still authenticate the caller exactly as before, but after the JWT was successfully validated, it would no longer immediately forward the request. Instead, Envoy would contact ThunderID and request a fresh authorization decision before allowing the request to continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tAB64w1-LPMCegA_Vy7-nQ.png" /></figure><p>This completely changed the request flow. When an application sends an API request, Envoy first validates the bearer token using its JWT authentication filter. It verifies the signature, checks the issuer, confirms token validity, and extracts the authenticated subject. But rather than immediately forwarding the request to the protected backend service, Envoy triggers its external authorization mechanism and sends an authorization request to ThunderID. ThunderID then evaluates the subject’s current role assignments and permissions, determines whether the requested action is still allowed, and returns an authorization decision back to Envoy. If the request is authorized, Envoy forwards it to the backend service. If the decision is denied, Envoy immediately returns a 403 Forbidden response.</p><p>The most satisfying part of the project came during testing. I wanted to confirm that authorization decisions were no longer tied to the lifetime of the JWT itself. I first sent a request using a valid access token and confirmed that the request succeeded. I then removed the user’s role assignment inside ThunderID and deliberately reused the exact same JWT without generating a new token. When I repeated the request, Envoy immediately returned 403 Forbidden. The token itself had not changed, and from a purely authentication perspective it was still completely valid. But the system was no longer trusting stale authorization data stored inside the token. It was making decisions based on the user’s current permissions instead.</p><p>This project taught me something I had never fully appreciated before. For a long time, I believed that a correctly validated JWT effectively meant the request was authorized. But after building this integration, I now think about API security very differently. A valid JWT proves identity, but authorization is often a dynamic decision that should sometimes happen in real time rather than being permanently embedded inside a token for the duration of its lifetime.</p><p>Working on this integration between Envoy Proxy and ThunderID made me realize that <strong>sometimes the most important security question is not whether a token is valid. Sometimes the more important question is whether the system should still trust what that token says.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57113b8aaa30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Actually Happens When an API Request Hits a Backend Server?]]></title>
            <link>https://medium.com/@yathusigakirubananthan/what-actually-happens-when-an-api-request-hits-a-backend-server-9e5fccdeb28b?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e5fccdeb28b</guid>
            <category><![CDATA[thunderid]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 08:57:38 GMT</pubDate>
            <atom:updated>2026-07-02T08:34:52.250Z</atom:updated>
            <content:encoded><![CDATA[<h3>The moment I realized I had been using APIs for years without truly understanding what happens behind the scenes.</h3><p>For a long time, I thought I understood APIs.</p><p>I knew how to send a request.</p><p>I knew how to open Postman.</p><p>I knew how to hit an endpoint and get a response back.</p><pre>GET /users/101</pre><p>And somehow…</p><p>Data would come back.</p><p>It worked.</p><p>So I never really questioned what happened in between.</p><p>But recently, while working on a real identity platform called ThunderID and spending more time reading production backend code, I realized something uncomfortable.I had been using APIs for years…</p><p><strong>Without actually understanding what happens after I press “Send”.</strong></p><p>And once I started understanding the journey of a request, I began looking at backend systems very differently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ASGD4mvrk4s_TWNFgbNL8g.png" /></figure><h3>Let’s start with what we think happens</h3><p>When most beginners learn APIs, we usually imagine something very simple.</p><p>We send a request.</p><p>The server receives it.</p><p>The server gives us a response.</p><p>Something like this.</p><pre>Client → Server → Response</pre><p>Simple.</p><p>Or at least…</p><p>That is what I used to think.</p><p>But real backend systems are doing much more than simply receiving requests and returning data.</p><p>A lot happens in between.</p><p>And every layer has a reason to exist.</p><h3>Imagine sending a request to fetch a user</h3><p>Let’s say I send this request.</p><pre>GET /users/101</pre><p>At first glance, it feels like the server should simply look into a database and return the user.</p><p>But large systems do not work that way.</p><p>The request begins a journey.</p><p>And it travels through multiple layers before data ever comes back.</p><p>Something like this.</p><pre>Client<br>   ↓<br>Router<br>   ↓<br>Middleware<br>   ↓<br>Handler<br>   ↓<br>Service Layer<br>   ↓<br>Repository Layer<br>   ↓<br>Database<br>   ↓<br>Response</pre><p>The first time I saw this architecture in a real codebase…</p><p>While going through parts of ThunderID’s codebase, I kept seeing layers separated into handlers, services, models, and internal packages.</p><p>At first, I thought:<br><em>Why make something simple look this complicated?</em></p><p>Later I realized it was not complexity for the sake of complexity.</p><p>It was structure built for systems that need to grow.</p><p>I had one question.</p><p><strong>Why so many layers?</strong></p><p><strong>Why not simply write everything in one function?</strong></p><p>Turns out, each layer exists because large systems need structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15l-f4-XfUEP8nj0G1Qsjw.png" /></figure><h3>First stop: The Router</h3><p>The router’s job is simple.</p><p>It looks at the incoming request and decides:</p><p><em>Which part of the code should handle this?</em></p><p>For example:</p><pre>/users/101</pre><p>might go to:</p><pre>getUserHandler()</pre><p>You can think of the router like a receptionist.</p><p>It does not solve the problem.</p><p>It simply sends you to the correct place.</p><h3>Before your code runs, Middleware steps in</h3><p>This was one of the first backend concepts that really clicked for me.</p><p>Before your actual business logic runs…</p><p>Many systems perform checks.</p><p>Things like:</p><ul><li>Is the user authenticated?</li><li>Should this request be logged?</li><li>Has the rate limit been exceeded?</li><li>Is this request allowed from this origin?</li></ul><p>This is where <strong>middleware</strong> lives.</p><p>It acts like a checkpoint.</p><p>Every request passes through it before reaching the actual application logic.</p><p>And I realized something interesting.</p><p>A lot of backend engineering is not about business logic.</p><p>It is about handling all the things around the business logic.</p><p>Security.</p><p>Logging.</p><p>Validation.</p><p>Monitoring.</p><p>Reliability.</p><h3>Then comes the Handler</h3><p>The handler is where the application finally starts understanding the request.</p><p>Its job is usually simple.</p><p>Read the request.</p><p>Validate input.</p><p>Extract parameters.</p><p>Call the next layer.</p><p>Something like:</p><pre>func GetUserHandler() {<br>    userService.GetUser(id)<br>}</pre><p>At first, I assumed this was where most logic lived.</p><p>But surprisingly…</p><p>It usually is not.</p><h3>The Service Layer: Where decisions happen</h3><p>This is where business logic normally lives.</p><p>The service layer decides <em>what needs to happen</em>.</p><p>For example:</p><p><em>Should the user be allowed to access this data?</em></p><p><em>Do we need to update something else?</em></p><p><em>Does another service need to be called?</em></p><p>It contains the actual decision-making part of the application.</p><p>And this was when I started understanding an important design principle.</p><p><strong>The web layer should not know business logic.</strong></p><p>Its job is only communication.</p><p>The service layer handles decisions.</p><h3>Then the Repository talks to the Database</h3><p>Eventually, the application needs data.</p><p>This is where the repository layer comes in.</p><p>Instead of letting business logic directly talk to SQL queries or database operations…</p><p>Applications often isolate database communication into its own layer.</p><p>Something like:</p><pre>userRepository.GetByID(id)</pre><p>And finally…</p><p>The database responds.</p><p>The data moves back through all layers.</p><p>And eventually reaches the client.</p><h3>Why not just put everything in one function?</h3><p>This was my biggest question.</p><p>Why not simply do this?</p><pre>Get request  <br>Query database  <br>Return response</pre><p>Because systems grow.</p><p>And when systems grow, messy code becomes expensive.</p><p>Imagine thousands of API endpoints.</p><p>Hundreds of engineers.</p><p>Years of maintenance.</p><p>Suddenly, organization matters more than speed.</p><p>Breaking code into layers makes systems easier to:</p><ul><li>test</li><li>maintain</li><li>debug</li><li>scale</li><li>extend later</li></ul><p>And I am slowly realizing something.</p><p>A lot of software engineering is simply learning how to manage complexity.</p><h3>The biggest thing I misunderstood about backend development</h3><p>When I first started learning programming, I thought backend development was mostly writing logic.</p><p>Take request.</p><p>Run code.</p><p>Return data.</p><p>But the deeper I go into backend engineering, the more I realize something.</p><p>Backend systems spend a lot of effort organizing responsibilities.</p><p>Every layer exists because it protects the system from becoming chaos.</p><p>The router routes.</p><p>Middleware protects.</p><p>Handlers communicate.</p><p>Services make decisions.</p><p>Repositories access data.</p><p>And together…</p><p>They make large systems maintainable.</p><h3>Something I’m learning</h3><p>The first time I started reading through ThunderID’s backend codebase, I kept seeing folders named:</p><ul><li>handlers</li><li>services</li><li>middleware</li><li>repositories</li><li>models</li></ul><p>And honestly…</p><p>I had no idea why everything was split this way.</p><p>Now I am starting to understand.</p><p>Good backend systems are not just about making code work.</p><p>They are about designing systems other engineers can understand, scale, and maintain years later.</p><p>And sometimes the hardest part of backend engineering is not solving problems.</p><p><strong>It is organizing complexity before complexity organizes you.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e5fccdeb28b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Do So Many Modern Backend Systems Love Go?]]></title>
            <link>https://medium.com/@yathusigakirubananthan/why-do-so-many-modern-backend-systems-love-go-a9706e238f35?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9706e238f35</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 19 Jun 2026 04:21:33 GMT</pubDate>
            <atom:updated>2026-08-13T09:27:40.762Z</atom:updated>
            <content:encoded><![CDATA[<h3>The first time I realized programming languages are chosen for engineering decisions, not just syntax.</h3><p>A few weeks ago, while learning more about backend engineering, I noticed something I couldn’t ignore.</p><p>Many of the tools powering modern infrastructure seemed to share one common pattern.<strong>Docker. Kubernetes. API gateways. Cloud-native platforms.</strong></p><p>They were all built using <strong>Go</strong>.At first, I thought:<em>“Okay… maybe Go is just another trending language.”</em>But the more I explored, the more I started realizing something important.Teams do not choose a programming language for backend systems simply because it looks elegant or has better syntax.</p><p>They choose it because <strong>the language solves real engineering problems.</strong>That led me to a question I had never seriously thought about before.<strong>Why do so many modern backend systems love Go?</strong></p><p>Here’s what I found.</p><h3>First, think about what backend systems actually do</h3><p>I started noticing this more clearly while working on <strong>ThunderID</strong>, an identity and access management platform built using Go.As I began reading real production code instead of small personal projects, I realized backend systems are rarely doing just one thing.</p><p>They are constantly handling API requests, processing authentication flows, managing tokens, communicating with databases, and coordinating multiple services at the same time.That was one of the first moments I understood why languages used in production systems are chosen very differently from languages we casually use while learning.</p><p>When we start programming, our code usually does one thing at a time.</p><p><strong><em>Take input.<br>Process it.<br>Print output.</em></strong></p><p>Simple.</p><p>But production backend systems live in a completely different world.Imagine a service receiving <strong>thousands of requests every second</strong>.At the same time, it might be:</p><ul><li>talking to databases</li><li>communicating with other services</li><li>processing background jobs</li><li>retrying failed requests</li><li>handling timeouts</li><li>writing logs</li><li>scaling across multiple servers</li></ul><p>Now the question becomes:<em>Can your programming language handle chaos efficiently? </em>This is where Go starts standing out.</p><h3>Why did Docker choose Go?</h3><p>Take Docker.</p><p>Every time you run a container, Docker has to deal with operating-system-level tasks.It constantly works with:</p><ul><li>processes</li><li>networking</li><li>filesystems</li><li>packaging applications consistently across environments</li></ul><p>This is not the kind of software where you can afford unnecessary complexity.Docker needed something that was:</p><ul><li>fast</li><li>reliable</li><li>easy to maintain</li><li>simple to distribute</li></ul><p>Go solved that beautifully.One of its biggest advantages?A Go application can usually be compiled into <strong>a single binary file</strong>.</p><p><strong><em>No complicated runtime setup.</em></strong></p><p><strong><em>No dependency nightmares.</em></strong></p><p><strong><em>Just build and run.</em></strong></p><p>That sounds simple.But in production systems, simple deployment saves teams an enormous amount of pain.That was the moment I started realizing something.Maybe programming languages are not just about writing code.Maybe they are about solving engineering problems at scale.</p><h3>Why Kubernetes also uses Go</h3><p>Then there is Kubernetes.And Kubernetes is basically a machine that never stops making decisions.It constantly checks things like:</p><p><em>Did a container fail?</em></p><p><em>Did a new service appear?</em></p><p><em>Does something need restarting?</em></p><p><em>Should traffic be redirected?</em></p><p>It is doing hundreds of things <em>at the same time.</em>This is exactly where Go becomes powerful.Instead of forcing developers to manage complicated threads manually, Go offers something beautifully simple.</p><p><strong>Goroutines.</strong></p><p>You can literally write:</p><pre>go processRequest()<br>go watchCluster()<br>go restartService()</pre><p>And suddenly multiple tasks run concurrently.For systems like Kubernetes, this feels natural.For backend engineers, it means building concurrent systems without constantly fighting the language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TjbsAM_N0-_PsqsxZyyh0Q.png" /></figure><h3>Why ThunderID uses Go</h3><p>I started seeing the same pattern in ThunderIDAnd something interesting started becoming clear.The same reasons that make Go valuable for systems like Docker and Kubernetes are also incredibly important for identity platforms.Think about what a system like ThunderID has to handle constantly.</p><p><strong><em>It processes authentication requests.</em></strong></p><p><strong><em>Issues access tokens.</em></strong></p><p><strong><em>Validates permissions.</em></strong></p><p><strong><em>Communicates with databases.</em></strong></p><p>Handles API traffic from multiple applications at the same time.And all of this needs to happen reliably and with low latency.That is exactly where Go starts making sense.Its lightweight concurrency model makes it easier to handle many requests simultaneously.Its fast performance is valuable for systems that sit in the critical path of authentication and authorization.And its simplicity becomes important when maintaining large backend codebases that power security-critical systems.</p><p>Working on ThunderID made me realize something important.The reasons companies choose Go are not theoretical.You can actually see those engineering decisions reflected in real production systems.</p><h3>Speed matters more than beginners realize</h3><p>When I first started programming, I never cared about compilation speed.I used to think:</p><p><em>“As long as the code runs, who cares?”</em></p><p>But real backend development is different.Teams constantly build and test code.Hundreds of times.Large projects often contain thousands of files.If every build takes too long, developers lose valuable time every single day.Go was intentionally designed to compile extremely fast.And that small detail changes developer experience far more than most beginners realize.Sometimes engineering is not about writing code faster.It is about removing friction.</p><h3>Concurrency is where backend systems live</h3><p>One thing I am slowly understanding about backend engineering is this.</p><p><strong>Most systems are not busy computing.</strong></p><p><strong>They are busy waiting.</strong></p><p>Waiting for databases.<br>Waiting for APIs.<br>Waiting for files.<br>Waiting for networks.<br>Waiting for users.</p><p>And modern systems need to handle many of those things simultaneously.In some languages, concurrency feels intimidating.</p><p><strong><em>Threads.</em></strong></p><p><strong><em>Locks.</em></strong></p><p><strong><em>Synchronization.</em></strong></p><p><strong><em>Complexity.</em></strong></p><p>Go makes concurrency feel approachable.And when developers are not afraid of concurrency…They actually use it.That matters a lot.</p><h3>One underrated reason: Go encourages boring code (and that is a good thing)</h3><p>At first, I found Go surprisingly minimal.I kept wondering:</p><p><strong><em>Where are the fancy abstractions?</em></strong></p><p><strong><em>Why does the language feel so simple?</em></strong></p><p>Then I realized something important.Backend systems often live for <strong>years.</strong>Different engineers will read the same code.Teams grow.Projects become massive.And suddenly the goal is no longer:</p><p><em>Write clever code.</em></p><p>The goal becomes:</p><p><em>Write code another engineer can understand at 2 AM during a production failure.</em></p><p>Go naturally pushes developers toward simple and readable code.That is incredibly valuable.</p><h3>So why do modern backend systems keep choosing Go?</h3><p>Because backend engineering is rarely about writing clever algorithms.</p><p>It is about building systems that are:</p><ul><li>reliable</li><li>maintainable</li><li>easy to deploy</li><li>fast enough</li><li>capable of handling many things at once</li></ul><p>Go hits that balance extremely well.That is why systems like Docker and Kubernetes trust it.Not because Go is perfect.But because it solves the kinds of problems backend engineers deal with every day.</p><h3>Something I am learning</h3><p>The more I learn backend engineering, the more I realize programming languages are not just about syntax.Over the past few weeks, while working on <strong>ThunderID</strong> and spending more time reading real production code, I have started noticing something interesting.</p><p>Large systems are full of engineering decisions that beginners usually never think about.</p><p><strong><em>Performance.</em></strong></p><p><strong><em>Maintainability.</em></strong></p><p><strong><em>Concurrency.</em></strong></p><p><strong><em>Deployment.</em></strong></p><p><strong><em>Scalability.</em></strong></p><p>Every design decision exists because someone, somewhere, had a real problem to solve.And Go feels like a language built by engineers who deeply understood production systems.</p><p>I used to think choosing a programming language was mostly about personal preference.Now I am starting to understand something different.</p><p>Sometimes…</p><p><strong>The language itself is part of the architecture.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9706e238f35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When a Simple Permission Check Became an Engineering Journey]]></title>
            <link>https://medium.com/@yathusigakirubananthan/when-a-simple-permission-check-became-an-engineering-journey-fb400c0d8adf?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb400c0d8adf</guid>
            <category><![CDATA[pdp]]></category>
            <category><![CDATA[thunderid]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[authzen]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 08:28:19 GMT</pubDate>
            <atom:updated>2026-06-12T08:49:30.249Z</atom:updated>
            <content:encoded><![CDATA[<p>Every engineering task starts with something that sounds deceptively simple.</p><p>For us, it started with one question.</p><p><strong><em>Can this subject perform this action on this resource?</em></strong></p><p>At first glance, it feels straightforward.</p><p>A request comes in.<br>The system checks permissions.<br>It returns <strong>true</strong> or <strong>false</strong>.</p><p>Simple.</p><p>Or at least, that’s what we thought.</p><p>The moment we started integrating <strong>AuthZEN</strong> into ThunderID, that “simple question” quickly turned into something much bigger.</p><p>Who exactly is the <strong>subject</strong>?</p><p>Is it a user? An application? A service account? An agent?</p><p>What does the <strong>resource</strong> represent?</p><p>A booking? A document? A tenant?</p><p>What if the permission is inherited through a group instead of being assigned directly?</p><p>And if the client asks about a resource that doesn’t even exist… is that an error, or is the answer simply <strong>no</strong>?</p><p>That was the beginning of our AuthZEN journey.</p><p>And surprisingly, the hardest part was never writing the endpoints.</p><p>It was figuring out <strong>where AuthZEN should fit inside ThunderID.</strong></p><h3>Why We Even Needed This</h3><p>To understand why this integration matters, imagine a company building a <strong>travel booking platform</strong>.</p><p>Thousands of users interact with the system every day.</p><p>Some users are customers booking tickets.</p><p>Some users are support agents managing reservations.</p><p>Some users are administrators updating bookings and managing pricing.</p><p>Now imagine a customer tries to access a booking.</p><p>The application suddenly needs to answer one important question.</p><p><strong><em>Can this user read booking </em></strong><strong><em>BK-1024?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Z9j2iq9j__K5HXFv0EFwQ.png" /></figure><p>Traditionally, every application handles this differently.</p><p>One service may check user roles directly.</p><p>Another service may query a permissions database.</p><p>A third service may implement its own custom authorization logic.</p><p>Over time, authorization logic becomes scattered everywhere.</p><p>This is where AuthZEN becomes valuable.</p><p>Instead of each application deciding authorization by itself, applications ask a centralized <strong>Policy Decision Point (PDP)</strong>.</p><p>The request looks like this:</p><pre>{<br>  &quot;subject&quot;: {<br>    &quot;type&quot;: &quot;user&quot;,<br>    &quot;id&quot;: &quot;alice&quot;<br>  },<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;booking&quot;,<br>    &quot;id&quot;: &quot;BK-1024&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;name&quot;: &quot;booking:read&quot;<br>  }<br>}</pre><p>The Policy Decision Point evaluates the request and responds:</p><pre>{<br>  &quot;decision&quot;: true<br>}</pre><p>The application does not need to understand internal permission logic.</p><p>It simply asks:</p><p><strong><em>Should access be allowed?</em></strong></p><p>That was exactly what we wanted ThunderID to support.</p><h3>The First Big Architectural Decision</h3><p>Very early in implementation, we faced two possible approaches.</p><h4>Option 1</h4><p>Build an entirely new authorization engine specifically for AuthZEN.</p><h4>Option 2</h4><p>Keep ThunderID’s existing authorization system and expose it through AuthZEN-compatible APIs.</p><p>We chose the second option.</p><p>And honestly, that single decision shaped everything that followed.</p><p>ThunderID already had a mature internal authorization system built around:</p><ul><li><strong><em>RBAC</em></strong></li><li><strong><em>Roles</em></strong></li><li><strong><em>Permissions</em></strong></li><li><strong><em>Resource Servers</em></strong></li><li><strong><em>Users</em></strong></li><li><strong><em>Groups</em></strong></li><li><strong><em>Transitive group membership</em></strong></li></ul><p>That system was already working well.</p><p>Rebuilding it simply for protocol compatibility would have been unnecessary.</p><p>So we made one important decision.</p><p><strong><em>We are not building a new authorization engine for AuthZEN.</em></strong></p><p><strong><em>We are exposing ThunderID’s existing authorization model through the AuthZEN API contract.</em></strong></p><p>That decision became the foundation for the entire implementation.</p><h3>Understanding The Core Challenge</h3><p>AuthZEN provides a standard way for applications to ask a <strong>Policy Decision Point (PDP)</strong> for authorization decisions.</p><p>A request looks like this:</p><pre>{<br>  &quot;subject&quot;: {<br>    &quot;type&quot;: &quot;user&quot;,<br>    &quot;id&quot;: &quot;user1&quot;<br>  },<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;booking&quot;,<br>    &quot;id&quot;: &quot;booking123&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;name&quot;: &quot;booking:read&quot;<br>  }<br>}</pre><p>And expects a simple response.</p><pre>{<br>  &quot;decision&quot;: true<br>}</pre><p>Simple from the outside.</p><p>But internally, we quickly discovered an important problem.</p><p><strong>AuthZEN and ThunderID do not model authorization in the same way.</strong></p><h3>Designing An Adapter Instead Of A Rewrite</h3><p>We implemented AuthZEN as an adapter layer inside ThunderID.</p><p>This layer acts as a translator between the external AuthZEN protocol and ThunderID’s internal authorization system.</p><p>We exposed four endpoints.</p><pre>GET  /.well-known/authzen-configuration</pre><pre>POST /access/v1/evaluation</pre><pre>POST /access/v1/evaluations</pre><pre>POST /access/v1/search/action</pre><p>One thing I particularly liked about AuthZEN is the discovery endpoint.</p><p>Clients can discover PDP metadata automatically without manually configuring endpoints.</p><p>Internally, the request flow became:</p><pre>AuthZEN Request<br>      ↓<br>AuthZEN Handler<br>      ↓<br>AuthZEN Service Adapter<br>      ↓<br>ThunderID Authorization Service<br>      ↓<br>RBAC Engine<br>      ↓<br>Authorization Decision<br>      ↓<br>AuthZEN Response</pre><p>This separation gave us flexibility.</p><p>AuthZEN became purely the <strong>API contract</strong>.</p><p>ThunderID remained the actual <strong>decision maker</strong>.</p><p>If ThunderID changes authorization engines in the future, the AuthZEN API layer remains untouched.</p><p>That separation mattered.</p><h3>The Translation Layer Was Where The Real Work Happened</h3><p>AuthZEN describes authorization using three concepts.</p><pre>subject + resource + action</pre><p>ThunderID internally evaluates authorization differently.</p><p>It expects:</p><pre>subject + resource server + permission</pre><p>So every AuthZEN request had to be translated.</p><p>The adapter performs mappings like:</p><ul><li>subject.id → internal subject ID</li><li>subject.type → entity validation</li><li>resource.type → resource server lookup</li><li>action.name → permission validation</li></ul><p>For example:</p><pre>{<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;booking&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;name&quot;: &quot;booking:read&quot;<br>  }<br>}</pre><p>Internally becomes:</p><pre>Find resource server &quot;booking&quot;</pre><pre>Validate permission &quot;booking:read&quot;</pre><pre>Check whether subject has permission</pre><p>That simple boolean response suddenly had a lot happening underneath.</p><h3>Problem 1: Subject Validation Is Never Perfect</h3><p>In theory, every client should provide complete subject information.</p><p>Reality is rarely perfect.</p><p>Sometimes integrations only know the subject ID.</p><p>Sometimes subject type information is missing.</p><p>Sometimes external systems do not provide enough metadata.</p><p>So we made a practical decision.</p><p>Validate strictly <strong>only when enough information exists.</strong></p><p>The rule became:</p><ul><li>If subject.type exists → validate entity type</li><li>If subject.type is empty → skip validation</li></ul><p>This gave us a balance between correctness and usability.</p><h3>Problem 2: Permissions Usually Come Through Groups</h3><p>Permissions are rarely assigned directly.</p><p>In ThunderID, users often receive permissions through:</p><ul><li><strong><em>Roles</em></strong></li><li><strong><em>Group assignments</em></strong></li><li><strong><em>Nested groups</em></strong></li></ul><p>So before authorization evaluation begins, we resolve transitive group membership.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqoHTh_Z9wI1sn9ZyRavBg.png" /></figure><p>The internal flow looks like this.</p><pre>Subject ID<br>     ↓<br>Entity Provider<br>     ↓<br>Resolve Groups<br>     ↓<br>Find Transitive Groups<br>     ↓<br>Authorization Evaluation</pre><p>We also remove duplicate group IDs before evaluation.</p><p>It sounds like a small optimization.</p><p>Until you start debugging repeated lookups at scale.</p><p>Then it matters a lot.</p><h3>Problem 3: What Happens If The Resource Does Not Exist?</h3><p>This became one of our most interesting design questions.</p><p>Suppose a client sends:</p><pre>{<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;unknown-resource&quot;<br>  },<br>  &quot;action&quot;: {<br>    &quot;name&quot;: &quot;booking:read&quot;<br>  }<br>}</pre><p>Or requests an action that does not exist.</p><p>Should the server return an HTTP error?</p><p>Or should authorization simply deny access?</p><p>We decided on a clear rule.</p><p>Malformed request structure:</p><pre>400 Bad Request</pre><p>Unknown resource or invalid action:</p><pre>{<br>  &quot;decision&quot;: false,<br>  &quot;context&quot;: {<br>    &quot;error&quot;: {<br>      &quot;message&quot;: &quot;Resource not found&quot;<br>    }<br>  }<br>}</pre><p>The reasoning was simple.</p><p>Asking whether someone can perform an unknown action is still a valid authorization question.</p><p>The answer is simply <strong>no</strong>.</p><h3>Problem 4: Batch Evaluation Should Not Be A Loop</h3><p>AuthZEN supports batch authorization.</p><pre>POST /access/v1/evaluations</pre><p>The easiest implementation would have been:</p><p>Loop through each request and call single evaluation repeatedly.</p><p>We intentionally avoided that.</p><p>Instead, we built an optimized batch path.</p><p>During batch processing, we cache repeated lookups.</p><p>We cache:</p><ul><li><strong><em>Resource server lookups</em></strong></li><li><strong><em>Subject validation results</em></strong></li><li><strong><em>Action validation results</em></strong></li><li><strong><em>Group resolution results</em></strong></li></ul><p>Then we call ThunderID’s internal batch authorization service.</p><p>Most importantly, we preserve response order.</p><p>Because response index 1 must always match request index 1.</p><p>A small detail.</p><p>A very important detail.</p><h3>Problem 5: Sometimes You Need To Know What Is Allowed</h3><p>Authorization is not always:</p><p><strong><em>Can this user perform this action?</em></strong></p><p>Sometimes applications need to ask:</p><p><strong><em>What actions can this user perform on this resource?</em></strong></p><p>This is where AuthZEN action search comes in.</p><p>Endpoint:</p><pre>POST /access/v1/search/action</pre><p>To answer this, the system:</p><ol><li><strong><em>Resolves the resource server</em></strong></li><li><strong><em>Collects all available actions</em></strong></li><li><strong><em>Includes nested resource permissions</em></strong></li><li><strong><em>Removes duplicate actions</em></strong></li><li><strong><em>Runs batch authorization evaluation</em></strong></li><li><strong><em>Returns only allowed actions</em></strong></li></ol><p>The important thing here was consistency.</p><p>We did not build shortcuts.</p><p>We reused the same authorization engine.</p><p>That meant authorization behavior stayed consistent across every endpoint.</p><h3>Where Testing Became Critical</h3><p>Interestingly, the biggest complexity was not RBAC itself.</p><p>It was the translation boundary.</p><p>So most of our tests focused there.</p><p>We tested both:</p><h3>Handler Layer</h3><ul><li><strong><em>Request parsing</em></strong></li><li><strong><em>Invalid JSON</em></strong></li><li><strong><em>Metadata discovery</em></strong></li><li><strong><em>Error handling</em></strong></li><li><strong><em>API validation</em></strong></li></ul><h3>Service Layer</h3><ul><li><strong><em>Subject validation</em></strong></li><li><strong><em>Group resolution</em></strong></li><li><strong><em>Invalid actions</em></strong></li><li><strong><em>Batch evaluation caching</em></strong></li><li><strong><em>Authorization failures</em></strong></li></ul><p>The AuthZEN adapter was doing much more than forwarding JSON.</p><p>It was:</p><ul><li><strong><em>validating</em></strong></li><li><strong><em>resolving</em></strong></li><li><strong><em>transforming</em></strong></li><li><strong><em>caching</em></strong></li><li><strong><em>preserving ThunderID semantics</em></strong></li></ul><p>That boundary needed confidence.</p><h3>What This Project Taught Me</h3><p>The biggest lesson I learned is this.</p><p>Integrating a standard is rarely about implementing API endpoints.</p><p>The hard part is choosing the right architectural boundary.</p><p>Push AuthZEN too deep into the authorization engine, and internal logic becomes polluted by protocol-specific concerns.</p><p>Make it too thin, and you lose important behavior like validation, group resolution, and batch performance optimizations.</p><p>The adapter approach gave us the best balance.</p><ul><li><strong><em>AuthZEN remains a clean public contract</em></strong></li><li><strong><em>ThunderID remains the authorization decision engine</em></strong></li><li><strong><em>Developers get a standard interface without learning internal implementation details</em></strong></li></ul><p>And honestly, that was the most satisfying part.</p><p>We did not replace ThunderID’s authorization system.</p><p>We made it interoperable.</p><p>Sometimes good engineering is not about building something entirely new.</p><p>It is about making what already exists work better with the rest of the world.</p><p>That, for me, was the real story behind adding AuthZEN support to ThunderID.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb400c0d8adf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding ID Tokens, Access Tokens, and Refresh Tokens]]></title>
            <link>https://medium.com/@yathusigakirubananthan/understanding-id-tokens-access-tokens-and-refresh-tokens-920a11129980?source=rss-4f2630436528------2</link>
            <guid isPermaLink="false">https://medium.com/p/920a11129980</guid>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[access-token]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[idtoken]]></category>
            <category><![CDATA[refresh-token]]></category>
            <dc:creator><![CDATA[Yathusiga Kirubananthan]]></dc:creator>
            <pubDate>Wed, 10 Jun 2026 15:37:35 GMT</pubDate>
            <atom:updated>2026-06-10T15:37:35.148Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wondered how apps know who you are after you log in — without asking for your password every 5 minutes? The answer is tokens. Let’s break down the three main ones .</p><h3><strong>Think of It Like a Theme Park</strong></h3><p>Imagine you visit a theme park:</p><ol><li>You show your <strong>ID at the entrance</strong> → they confirm who you are</li><li>You get a <strong>wristband</strong> → lets you ride attractions all day</li><li>You get a <strong>renewal ticket</strong> → exchange it for a new wristband when yours expires</li></ol><p>That’s exactly how ID tokens, access tokens, and refresh tokens work!</p><h3>ID Token — “Who are you?”</h3><p>The <strong>ID Token</strong> is proof of your identity. It’s issued right after you log in and contains basic info about you:</p><ul><li>Your name</li><li>Your email</li><li>Your profile picture</li><li>When you logged in</li></ul><p><strong><em>Think of it as your digital passport. The app reads it once to learn who you are, but doesn’t keep sending it around</em></strong><em>.</em></p><p><strong>Used for:</strong> Showing the app your identity (login/profile pages)</p><h3>Access Token — “What can you do?”</h3><p>The <strong>Access Token</strong> is what you use to actually <em>do things</em> in the app — like fetch your emails, post a photo, or view your dashboard.</p><p>Every time your app talks to a server behind the scenes, it sends this token to prove you’re allowed in.</p><ul><li>It <strong>expires quickly</strong> (usually in 15 minutes to 1 hour)</li><li>This is intentional — if someone steals it, the damage is limited</li></ul><p><strong><em>Think of it as your theme park wristband. It lets you access rides, but it stops working at the end of the day.</em></strong></p><p><strong>Used for:</strong> Making API calls, fetching data, performing actions</p><h3>Refresh Token — “Stay logged in”</h3><p>When your Access Token expires, you’d normally have to log in again. That would be annoying! The <strong>Refresh Token</strong> solves this.</p><p>It lives quietly in the background and says: <em>“Hey, this person already logged in — give them a new access token automatically.”</em></p><ul><li>It lasts much longer (days, weeks, or even months)</li><li>It’s only ever sent to the <strong>auth server</strong>, not to other services</li><li>When used, it often gets <strong>replaced with a new one</strong> (for safety)</li></ul><p><strong><em>Think of it as a renewal ticket. You hand it in, and you get a fresh wristband — no need to queue up at the entrance again.</em></strong></p><p><strong>Used for:</strong> Silently refreshing your session so you stay logged in</p><h3>How They Work Together</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*553ld0bgG5FH5qq_5d3xWw.png" /></figure><h3>The Simple Flow</h3><ol><li>You <strong>log in</strong> → app receives all three tokens</li><li>App uses <strong>Access Token</strong> to load your data</li><li>Access Token <strong>expires</strong> → app uses Refresh Token to get a new one</li><li>You keep using the app <strong>without logging in again</strong></li><li>Eventually the Refresh Token expires too → you log in once more</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=920a11129980" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>