Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back to the course.
In our last lesson, we designed a sophisticated continuous authentication system. We moved beyond static, point-in-time checks to an event-driven model that continuously scores session risk based on real-time signals. This gave our ZTNA service a powerful, dynamic brain for making access decisions.
Now, we shift from the decision to the enforcement. An access policy is only as good as its enforcement mechanism. In a Zero Trust model, enforcement can't just happen at the network perimeter; it must follow the identity and protect each application individually.
This lesson directly addresses that need and fulfills the learning outcome: Design a micro-segmentation enforcement model for ZTNA using identity-aware proxies and dynamic network policies. We will architect the "moats" around each of our internal applications, ensuring that the access decisions from our policy engine are enforced consistently, whether a user is accessing an application or applications are communicating with each other.
1. The Principle: From Network Segmentation to Micro-segmentation
In traditional security, we used network segmentation (VLANs, subnets, firewalls) to create large, trusted zones. Once inside a zone, traffic could often move freely. This "east-west" traffic is a primary vector for attackers to move laterally after an initial breach.
Zero Trust demands a more granular approach: micro-segmentation. Instead of creating large zones, we treat every workload—be it a VM, a container, or a serverless function—as its own security perimeter. The goal is to enforce least-privilege access for all communication, drastically reducing the attack surface and containing breaches.
To build our first-principles understanding, let's explore this concept in more detail.
[PDF] Zero Trust Enforcement Using Microsegmentation...
The paper 'Zero Trust Enforcement Using Microsegmentation...' provides an excellent, in-depth explanation of micro-segmentation and its role in Zero Trust. We'll focus on the core concepts first.
Please read the sections '3.1 Concept of Microsegmentation' and '3.2 Network-Based vs. Identity-Based Segmentation'. As you read, focus on the fundamental shift from policies based on network topology (IP addresses, subnets) to policies based on workload identity (tags, labels, service accounts).
As the paper highlights, the key is moving from where a request comes from to who or what is making the request. This allows security policy to be decoupled from the network infrastructure, which is essential in dynamic cloud environments where IP addresses are ephemeral.
2. The Enforcement Point: The Identity-Aware Proxy (IAP)
To enforce identity-based policies at the application layer (L7), we need a component that can intercept traffic, validate the identity of the user, and check with our policy engine before allowing the request to proceed. This component is the Identity-Aware Proxy (IAP).
In the NIST Zero Trust Architecture, the IAP acts as a Policy Enforcement Point (PEP).

To see this in action, let's watch a short, practical demonstration of what an IAP does.
Secure Cloud Run with IAP (Identity-Aware Proxy)
The video 'Secure Cloud Run with IAP' from Google Cloud Tech provides a concrete example of an IAP protecting a web application. It clearly shows how the IAP acts as a gatekeeper.
Watch the entire video (it's short). Pay close attention to these architectural details: The application code itself contains no authentication logic. The IAP intercepts all requests and forces a login. The IAP can enforce policies based on identity and context (like location or device). The IAP injects headers (e.g., X-Goog-Authenticated-User-Email) containing the authenticated user's identity, which the backend application can then use for logging or fine-grained authorization.
The video demonstrates the what. Now let's return to our core research paper to understand the why and how IAPs are fundamental to ZTNA.
[PDF] Zero Trust Enforcement Using Microsegmentation...
Let's dive deeper into the architectural role of IAPs within a Zero Trust framework.
Please read the sections '4.1 What Are Identity-Aware Proxies?' and '4.2 Integrating IAPs with Zero Trust'. Focus on how IAPs decouple access control from the network and act as the ideal integration point for the dynamic trust signals we designed in our previous lesson.
3. Architecting an IAP: The "Auth Shim" Pattern
Given your goal of understanding how to build these systems, let's go beyond using a managed IAP service and explore how you might architect one yourself. A full-blown IAP can be a complex product, but for many use cases, a lightweight pattern is sufficient and provides more flexibility.
The "Auth Shim" paper formalizes such a pattern. It's an excellent example of applying system design principles to solve a common security integration problem.
The Auth Shim: A Lightweight Architectural Pattern
The paper 'The Auth Shim' formalizes a reusable architectural pattern for a lightweight IAP. It's purpose-built to bridge applications with modern identity providers, which is exactly what we need in our ZTNA model.
Please read the following sections: Section II-A 'Zero Trust, IAPs, and Modern Enterprise SSO': For context. Section III 'The Auth Shim Architectural Pattern': Pay close attention to the components, especially the RBAC Engine and Session Bridge. Section IV-A 'Detailed Comparative Analysis': To understand the design trade-offs between this pattern, a full IAP, and a commercial plugin.
The Auth Shim pattern provides a clear blueprint. The RBAC Engine is the component that would consume the dynamic trust score from our continuous authentication system. For example, a SAML assertion or OIDC token could contain a claim like "risk_level": "medium". The RBAC Engine would translate this into a specific role within the target application (e.g., readonly-user), enforcing the policy decision made by our risk engine. The Shim's ability to perform just-in-time user provisioning and role synchronization is what makes it so powerful for ZTNA.
4. Completing the Model: Dynamic Network Policies
IAPs are excellent for securing application-layer (HTTP/S) access. However, micro-segmentation also requires controlling traffic at the network layer (L3/L4) to prevent, for example, a compromised web server from initiating an SSH connection to a database server. This is where dynamic network policies come in.
These policies are "dynamic" because they are defined using workload identities (like labels or tags) rather than static IP addresses. The network fabric itself enforces these rules.
Let's refer back to our main paper for implementation examples. In Section 3.3, "Implementation in Cloud Environments," the paper describes platform-native tools for this:
- AWS: Security Groups can be configured to allow traffic only from other resources with a specific tag (e.g., allow traffic on port 3306 only from EC2 instances tagged
role: web-server). - Azure: Application Security Groups (ASGs) serve a similar function, grouping VMs by workload identity.
- Kubernetes: This is where the concept shines. Kubernetes
NetworkPolicyobjects use pod labels to define fine-grained ingress and egress rules. A CNI plugin like Calico or Cilium is responsible for enforcing these policies in the kernel using eBPF or other mechanisms, making it highly efficient.
A dynamic policy might state: "Pods with the label app: frontend can only communicate with pods with the label app: backend on port 8080." If a frontend pod is compromised and its label is changed to risk: high by our control plane, its network policies can be instantly updated to sever all connections.
5. A Coordinated Enforcement Framework
The complete micro-segmentation model uses both IAPs and dynamic network policies in a coordinated fashion.

The synergy is as follows:
- User-to-App (North-South traffic into a micro-segment): An Identity-Aware Proxy (IAP) intercepts the request. It validates the user's identity and device posture against the Policy Engine, which uses the continuous risk score we designed previously. If access is granted, the request is forwarded.
- App-to-App (East-West traffic between micro-segments): The communication is governed by Dynamic Network Policies. A backend service might have a policy that only allows incoming connections from the IAP's specific service identity, preventing any other internal service from accessing it directly.
This layered approach ensures that identity is verified at every step, truly enforcing the principle of least privilege.
[PDF] Zero Trust Enforcement Using Microsegmentation...
Let's conclude by studying how these components are orchestrated into a single, cohesive framework.
Please read section '6.1 Coordinating Microsegmentation + IAP + CARA' to see the conceptual model. Then, read section '6.4 Reference Implementation Example' for a concrete architectural example using Google Cloud Platform tools. This ties everything together.
Conclusion
In this lesson, we have designed a robust enforcement model for our ZTNA service. We've moved beyond a simple perimeter and created a system where every application is protected by its own identity-aware security controls.
Key Takeaways:
- Micro-segmentation is the strategy of creating granular security perimeters around individual workloads to prevent lateral movement.
- Identity-Aware Proxies (IAPs) are the primary enforcement point for user-to-application (L7) access, making decisions based on identity and context provided by the ZTNA control plane.
- The "Auth Shim" is a lightweight, flexible architectural pattern for building an IAP that can perform just-in-time provisioning and role synchronization.
- Dynamic Network Policies provide enforcement at the network layer (L3/L4) for application-to-application communication, using workload identities (tags/labels) instead of static IPs.
- A complete model coordinates IAPs and dynamic network policies to enforce least-privilege access at every layer of the stack.
Preview of the Next Lesson:
We have now designed the major logical components of our ZTNA service: device posture assessment, continuous authentication, and now micro-segmentation enforcement. As a software engineer, you know that a distributed system is only as good as its reliability and observability. In our next and final lesson for this module, we will address the crucial operational aspects as we architect for high availability and observability in a distributed ZTNA solution.