---
title: "22 — Security Patterns: Federated Identity, Gatekeeper, and Valet Key"
uid: security
tags: ["valet-key", "security", "federated-identity", "roadmap:system-design", "gatekeeper", "system-design"]
excerpt: "Security provides confidentiality, integrity, and availability assurances — and the cloud patterns (federated identity, gatekeeper, valet key) enforce them structurally, without baking security into every line of code."
date: 2026-08-13T03:27:30+0000
source: https://www.aveshina.my.id/en/blog/security
---

"Use HTTPS and hash passwords" was my security plan, and it covered the floor while missing the architecture. Writing it down gave the field a structure: **security provides confidentiality, integrity, and availability assurances against malicious attacks, and the cloud security patterns are structural ways to enforce those assurances without baking security into every line of application code.** [1] The three patterns the roadmap highlights — federated identity, gatekeeper, and valet key — each move a security decision out of the application and into the architecture.

The framing that landed is that security at scale is not a feature you add; it is a set of boundaries you draw. Losing the confidentiality/integrity/availability assurances can hurt operations, revenue, and reputation [1], and maintaining security requires both hygiene (well-established practices) and vigilance (detecting and remediating vulnerabilities and active attacks). The patterns below are the structural part of that hygiene — they make the safe path the default path, so individual application code does not have to carry the full security load.

## The three patterns

Each pattern addresses a different security boundary: who is the user, what reaches the application, and how does the client touch storage [1].

```figure
<svg viewBox="0 0 740 280" xmlns="http://www.w3.org/2000/svg" class="my-6 w-full max-w-2xl" role="img" aria-label="Three security patterns. Left, Federated Identity: a Client is redirected to an external Identity Provider, then returns to the Application with a token. Middle, Gatekeeper: a Client's request passes through a Gatekeeper broker host that validates and sanitizes it before forwarding to the trusted Application. Right, Valet Key: the Application issues a short-lived restricted token so the Client can access Storage directly.">
  <defs>
    <marker id="secarrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
      <path d="M0,0 L10,5 L0,10 z" fill="#64748b"/>
    </marker>
  </defs>
  <g font-family="ui-sans-serif, system-ui, sans-serif" text-rendering="geometricPrecision">

    <!-- Federated Identity -->
    <text x="120" y="24" font-size="12" font-weight="700" fill="#1e1b4b" text-anchor="middle">Federated Identity</text>
    <rect x="30" y="40" width="70" height="30" rx="6" fill="#e0e7ff" stroke="#6366f1" stroke-width="1.2"/>
    <text x="65" y="60" font-size="9" font-weight="700" fill="#1e1b4b" text-anchor="middle">Client</text>
    <rect x="130" y="40" width="90" height="30" rx="6" fill="#fef9c3" stroke="#ca8a04" stroke-width="1.5"/>
    <text x="175" y="60" font-size="9" font-weight="700" fill="#422006" text-anchor="middle">Identity Provider</text>
    <rect x="250" y="40" width="90" height="30" rx="6" fill="#dcfce7" stroke="#16a34a" stroke-width="1.2"/>
    <text x="295" y="60" font-size="9" font-weight="700" fill="#052e16" text-anchor="middle">Application</text>
    <path d="M100,52 L128,52" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <path d="M220,52 L248,52" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <text x="175" y="92" font-size="9" fill="#1e1b4b" text-anchor="middle" font-style="italic">delegate auth; app trusts the token</text>

    <!-- Gatekeeper -->
    <text x="495" y="24" font-size="12" font-weight="700" fill="#500724" text-anchor="middle">Gatekeeper</text>
    <rect x="410" y="40" width="60" height="30" rx="6" fill="#e0e7ff" stroke="#6366f1" stroke-width="1.2"/>
    <text x="440" y="60" font-size="9" font-weight="700" fill="#1e1b4b" text-anchor="middle">Client</text>
    <rect x="490" y="40" width="80" height="30" rx="6" fill="#fce7f3" stroke="#db2777" stroke-width="1.5"/>
    <text x="530" y="60" font-size="9" font-weight="700" fill="#500724" text-anchor="middle">Gatekeeper</text>
    <rect x="590" y="40" width="90" height="30" rx="6" fill="#dcfce7" stroke="#16a34a" stroke-width="1.2"/>
    <text x="635" y="60" font-size="9" font-weight="700" fill="#052e16" text-anchor="middle">Trusted App</text>
    <path d="M470,52 L488,52" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <path d="M570,52 L588,52" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <text x="530" y="92" font-size="9" fill="#500724" text-anchor="middle" font-style="italic">validate &amp; sanitize before the trusted node</text>

    <!-- Valet Key -->
    <text x="330" y="130" font-size="12" font-weight="700" fill="#422006" text-anchor="middle">Valet Key</text>
    <rect x="180" y="146" width="80" height="30" rx="6" fill="#dcfce7" stroke="#16a34a" stroke-width="1.2"/>
    <text x="220" y="166" font-size="9" font-weight="700" fill="#052e16" text-anchor="middle">Application</text>
    <rect x="300" y="146" width="70" height="30" rx="6" fill="#e0e7ff" stroke="#6366f1" stroke-width="1.2"/>
    <text x="335" y="166" font-size="9" font-weight="700" fill="#1e1b4b" text-anchor="middle">Client</text>
    <rect x="410" y="146" width="80" height="30" rx="6" fill="#fee2e2" stroke="#dc2626" stroke-width="1.2"/>
    <text x="450" y="166" font-size="9" font-weight="700" fill="#7f1d1d" text-anchor="middle">Storage</text>
    <path d="M260,161 L298,161" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <path d="M370,161 L408,161" fill="none" stroke="#64748b" stroke-width="1.2" marker-end="url(#secarrow)"/>
    <text x="335" y="196" font-size="9" fill="#422006" text-anchor="middle" font-style="italic">short-lived token grants restricted direct access to one resource</text>

    <!-- shared concerns -->
    <rect x="40" y="220" width="660" height="50" rx="8" fill="#fef9c3" stroke="#ca8a04" stroke-width="1.2"/>
    <text x="60" y="242" font-size="11" font-weight="700" fill="#422006">Underlying all three</text>
    <text x="60" y="260" font-size="10" fill="#422006">confidentiality · integrity · availability — assurances against malicious attack, maintained by hygiene + vigilance</text>
  </g>
</svg>
```

- **Federated identity** delegates authentication to an external identity provider [2]. Instead of the application implementing (and securing) its own username/password store, it trusts tokens issued by a dedicated identity provider. This simplifies development, minimizes the requirement for user administration, and improves the user experience (single sign-on). The application's only job is to validate the token it receives — it never touches the credentials. This is how "Sign in with Google" works, and it is the same pattern the ave-space portfolio uses for Supabase Auth.
- **Gatekeeper** protects applications and services using a dedicated host instance that acts as a broker between clients and the application [3]. The gatekeeper validates and sanitizes requests, then forwards them to the trusted application node. It provides an additional layer of security and limits the system's attack surface — the application node is never directly exposed, and the gatekeeper can be hardened and audited independently. The trusted node sits in a network zone the public cannot reach.
- **Valet key** uses a token that gives clients restricted, direct access to a specific resource, to offload data transfer from the application [4]. Particularly useful with cloud-hosted storage or queues, it minimizes cost and maximizes scalability and performance. The application mints a short-lived token that grants, say, upload rights to one blob for ten minutes; the client uploads directly to storage without the bytes ever passing through the application. The analogy is a hotel valet key — it opens one door for a limited purpose, not the whole building.

## What each pattern buys, and what it costs

The three patterns share a common move: they pull a security concern _out_ of the application code and into a dedicated structure (an identity provider, a broker host, a token issuer). The payoff is that the application does less security-sensitive work, which means less surface area to get wrong. The cost is operational — another component to run, another contract to honor (the token format, the validation rules, the token's lifetime).

- Federated identity removes password storage from the application (the highest-risk data to hold) at the cost of a dependency on the identity provider.
- The gatekeeper removes direct exposure of the application at the cost of an extra network hop and a second component to operate.
- The valet key removes the application from the data path at the cost of implementing token minting and expiry logic.

## How I use this

The habit is to ask, for each security-sensitive interaction, whether the application _needs_ to be in the path. For authentication, it almost never does — I delegate to a federated identity provider (Supabase/Auth0/Google) and validate tokens, rather than holding credentials. For public-facing services, I put a gatekeeper (or API gateway acting as one) in front so the application is not directly exposed and requests are sanitized before they reach it. For large uploads/downloads, I issue short-lived valet-key tokens so the client talks to storage directly and the application is not a bottleneck for bytes it does not need to inspect. The discipline is to make the safe path the structural default, so that individual developers cannot accidentally ship an insecure path by forgetting a check — the architecture enforces the boundary regardless.

## References

[1] Microsoft, "Security patterns," Azure Architecture Framework. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/framework/security/security-patterns](https://learn.microsoft.com/en-us/azure/architecture/framework/security/security-patterns)

[2] Microsoft, "Federated Identity pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/federated-identity](https://learn.microsoft.com/en-us/azure/architecture/patterns/federated-identity)

[3] Microsoft, "Gatekeeper pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/gatekeeper](https://learn.microsoft.com/en-us/azure/architecture/patterns/gatekeeper)

[4] Microsoft, "Valet Key pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/valet-key](https://learn.microsoft.com/en-us/azure/architecture/patterns/valet-key)

[5] Microsoft, "Deployment Stamps pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/deployment-stamp](https://learn.microsoft.com/en-us/azure/architecture/patterns/deployment-stamp)

[6] Microsoft, "Geodes pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/geodes](https://learn.microsoft.com/en-us/azure/architecture/patterns/geodes)

[7] Microsoft, "Health Endpoint Monitoring pattern," Azure Architecture Center. [Online]. Available: [https://learn.microsoft.com/en-us/azure/architecture/patterns/health-endpoint-monitoring](https://learn.microsoft.com/en-us/azure/architecture/patterns/health-endpoint-monitoring)

```quiz
Q: Federated identity delegates ____ to an external identity provider.
- authorization (what the user can do)
- authentication (who the user is)
correct: 1
explain: Federated identity delegates authentication. The application validates the token it receives and never handles credentials directly, simplifying development and improving security.

Q: The Gatekeeper pattern's main benefit is…
- it speeds up request handling by caching
- the trusted application node is never directly exposed; requests are validated/sanitized by a broker first
correct: 1
explain: The gatekeeper is a broker host that validates and sanitizes requests before forwarding them to a trusted node that the public cannot reach, limiting the attack surface.

Q: A valet key is best described as…
- a permanent admin credential stored on the client
- a short-lived, restricted token granting a client direct access to one specific resource
correct: 1
explain: Like a hotel valet key, it opens one door for a limited purpose. The application mints a short-lived token so the client can reach storage directly without routing bytes through the app.

Q: The common move underlying all three patterns is…
- baking security into every line of application code
- pulling a security concern out of the application into a dedicated structure (IdP, broker, token issuer)
correct: 1
explain: Each pattern moves a security-sensitive concern out of the application and into a dedicated component, shrinking the app's attack surface and making the safe path the default.
```
