Separate Identity Authentication from Application Authorization
Two questions hide behind one login prompt. Authentication asks who the person is. Authorization asks whether that person may use this particular application. Cloudflare Access brokers the first question to an identity provider and answers the second itself, from policies you write. A team that treats the login redirect as the whole control ends up with policies that look strict while admitting anyone the IdP will authenticate.
The identity provider authenticates; it does not authorize this application. Okta, Microsoft Entra ID, Google Workspace or a generic OIDC provider validates a password, a passkey or an MFA challenge, then returns claims: an email, a group list, a device signal. Those claims are evidence of identity. They are not a statement that the bearer may open the finance dashboard. Access turns claims into a decision by matching them against selectors in a policy.
The protected hostname is the unit of enforcement. An Access application binds a hostname and an optional path, and every request to that name is checked at the edge before it reaches your origin. The origin keeps running exactly as before; what changes is that it is no longer the first thing a visitor can reach. That is why the application object, not the origin server, is the thing you inventory and review.
Protect the hostname, not the server
Access enforces at the hostname it fronts. A DNS-only record, a direct IP or an unproxied CNAME walks around every policy and leaves no log entry, so inventory the destinations you protect and then prove nothing else answers for them.
Proxying is not optional. A DNS-only record resolves straight to the origin address and never passes through Access, so no policy is evaluated and no log entry is written. The same is true of a direct request to the origin IP or an unproxied CNAME that still points at the server. Access protects the hostname; it cannot protect a server that is reachable by another name.
One request crosses two trust boundaries. The browser asks for the hostname, Access matches it to an application, and an unauthenticated visitor is redirected to an allowed identity provider. The IdP returns a signed assertion, Access evaluates the application's ordered policies, and a successful match issues a session cookie plus a short-lived JWT. Only then does the request reach the origin, carrying the JWT in a header. Figure 1 traces that path and shows where the two decisions separate.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
sequenceDiagram
autonumber
participant B as Browser
participant A as Cloudflare Access
participant I as Identity provider
participant O as Origin
B->>A: GET app.example.com
A->>A: Match hostname and path to an application
alt No valid session
A-->>B: 302 to the allowed IdP
B->>I: Authenticate and complete MFA
I-->>A: Signed assertion with claims
A->>A: Evaluate ordered policies
alt No policy allows this identity
A-->>B: 403 or the custom deny page
else A policy allows
A-->>B: Session cookie and short-lived JWT
end
end
B->>A: Retry with the session cookie
A->>O: Proxy the request with Cf-Access-Jwt-Assertion
O-->>A: Application response
A-->>B: Response
Read Figure 1 from the two alt blocks. The first block is authentication: only the IdP can turn a visitor into a named user. The second block is authorization: only an Access policy can turn a named user into an allowed client. A valid IdP session that matches no policy still ends at the 403 branch, which is the default-deny behavior the rest of this article depends on.
The two planes are easiest to see side by side. Figure 2 places the identity plane above the enforcement plane, because the IdP answers a question that the policy engine then consumes. The dashed bypass path at the bottom is the part most diagrams omit: a DNS-only record or a direct origin request reaches the server without either plane being consulted.
Follow the dashed arrow before trusting the solid ones. The solid path is the one you designed. The dashed path is the one an attacker finds with a historical DNS record or a certificate-transparency search. If the origin answers on that path, the policy engine is optional equipment, and every allow and deny decision in this article is advisory.
The origin receives two things: a request and a claim. Every proxied request carries a signed JWT in the assertion header, and that JWT names the application through its audience claim. The origin can verify the signature and the audience, or it can be unreachable except through Access. A header that the origin trusts from any source is not authentication; it is a suggestion that anyone can type.
Session state lives in two places, and they expire separately. The IdP session is the single sign-on session shared across applications. The Access session is per application and bounded by the session duration you set on the application or policy. Signing out of the IdP does not necessarily end an Access session, and revoking an Access session does not sign the user out of the IdP. Revocation therefore needs both actions, plus a short enough session that the gap is tolerable.
Version baseline. Behavior was checked against Terraform CLI 1.17.1 and the Cloudflare provider at 5.28.1 on 6 November 2026. Access changes quickly: the dashboard labels and the API decision values already differ, as the next section shows. Where documentation and the provider schema disagree, the schema wins for the Terraform block and the API wins for behavior the provider does not expose.
Model Applications, Groups and Ordered Policy Decisions
An application is the container, not the rule. The application object owns the destination, the application type, the session duration, the allowed identity providers and the ordered list of policies. The four resource types are separate on purpose: the application is what you protect, the policy is what you decide, the group is a reusable selector bundle, and the identity provider is where authentication happens.
Two names carry the Terraform surface. The application is cloudflare_zero_trust_access_application; the policy is cloudflare_zero_trust_access_policy. Groups and identity providers follow the same prefix pattern. Naming them once is enough: from here on, "the application resource" and "the policy resource" mean those two objects, and the distinction matters more than the spelling.
Destinations replace a deprecated field that is already past its date. Provider 5.28.1 marks the older hostname list as deprecated in favor of destinations, with a support date of 21 November 2025. In November 2026 that date has passed, so new configuration should use the destinations block even though the old attribute still appears in the schema. A field can be present, accepted and still be the wrong choice.
The application type narrows what a policy may do. Self-hosted web apps, SaaS apps, SSH and RDP apps, and the App Launcher all share the policy engine. The infrastructure type is the exception in the schema: its policies accept only an allow decision. Picking the type first prevents a design conversation that the schema will reject later, and it decides which connection settings, such as SSH usernames or clipboard rules, are available at all.
A group has no opinion. The group resource bundles selectors into a named unit, with the same include, require and exclude structure as a policy, and nothing else. It carries no allow or deny decision, so a group cannot grant access on its own. That is exactly what makes it reusable: a group called "Contractors" means the same set of people in every policy that references it.
The policy is where a decision finally exists. A policy pairs one decision with selectors. Include behaves like OR, require behaves like AND, and exclude behaves like NOT: a request matches when at least one include rule matches, every require rule matches, and no exclude rule matches. A policy with an include of everyone and an exclude of nobody is a public application with a login page in front of it.
Include is OR; require is AND
A request matches a policy only when at least one include matches, every require matches, and no exclude matches. A lone include of everyone authenticates the visitor and then admits them; the login page supplies the appearance of control without the decision.
The decision values differ from the dashboard labels. The provider accepts four values: allow, deny, non-identity and bypass. The dashboard shows them as Allow, Block, Service Auth and Bypass, which is clearer about intent but easy to mistranslate into a review note. Write the API value in the change description so the reviewer sees the same word the provider will send.
Order is evaluated by action class first, then by position. Access evaluates service-auth and bypass policies before allow and deny policies, each group from top to bottom. Within the allow-and-deny group, the first matching policy stops evaluation. This is the detail that surprises people: a bypass policy placed at the bottom of the list still runs before an allow policy at the top.
Default deny is the floor, not a policy you write. If no policy matches, the request is denied. There is no implicit allow for members of the account, no fallback to the IdP's group membership and no "everyone in the organization" shortcut. That is why an empty policy list is a locked door rather than an open one, and why a missing policy produces a support ticket instead of a breach.
Figure 3 follows a request through the order. It deliberately puts service auth and bypass ahead of the identity check, because that is the order Access uses, and it sends an unmatched request to default deny rather than to an implicit allow. The deny and default-deny branches produce a 403 with no allow policy to blame; the bypass branch produces a 200 with no policy at all.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
R["Request to a protected hostname"] --> M{"Hostname and path
match an application?"}
M -- "no" --> N["No application context
Access does not broker it"]
M -- "yes" --> S{"Service Auth or Bypass
policy matched first?"}
S -- "valid token or certificate" --> SA["Service Auth
no IdP login"]
S -- "bypass rule" --> BY["Bypass
no enforcement, no logs"]
S -- "neither" --> L{"Identity session
present?"}
L -- "no" --> IDP["Redirect to an allowed IdP"]
IDP --> P
L -- "yes" --> P{"Deny evaluated before Allow
first match stops"}
P -- "deny matched" --> D["Blocked
403 or deny page"]
P -- "allow matched" --> G["Session granted
JWT carries aud"]
P -- "nothing matched" --> DD["Default deny"]
G --> O["Origin receives the request"]
SA --> O
BY --> O
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class M,S,L,P primary;
class R,IDP,G,O secondary;
class SA ok;
class BY,D,DD,N danger;
Read Figure 3 by asking which branch could be reached without an identity. Service auth is reached with a service token or a client certificate; bypass is reached with a selector that needs no identity at all. Both are evaluated before the login redirect, so adding either one changes the meaning of every allow policy below it. If a bypass rule exists, the allow policies are no longer the front door.
Precedence is a number and an order that must agree. Each policy attached to an application carries a unique precedence value, and the resource documents the list as ascending order of precedence. Keep the list order and the numbers in the same sequence. When they drift, the plan shows a reordering that reviewers read as noise, and the effective order becomes something nobody can explain from the file.
Reusable and inline policies are two ownership models. A standalone policy can be attached to several applications, and its read-only application count tells you the blast radius of an edit. A policy written inside the application block belongs to that application alone. Both are valid; mixing them for the same decision is how two files end up disagreeing about who may reach the same host.
The Require rule is a trap when it holds several values. Multiple values inside one require rule are combined with AND, so requiring two countries and two email domains at once can describe an empty set. A group converts that AND into an OR: build the group with the alternatives, then require the group. The rule reads the same, but the set of matching people is the one you meant.
The identity provider list has two sharp edges. The allowed identity provider list defaults to every provider configured in the account, so adding a new social login can silently widen an existing application. Automatic redirect to a single provider requires exactly one entry in that list. Both behaviors are schema-level, not dashboard folklore, and both deserve a test after any IdP change.
A bypass rule is not a quiet exception. It disables Access enforcement for the traffic it matches, and those requests are not logged by Access. Cloudflare's own guidance is to avoid using it for permanent access to internal applications. When a single endpoint must be public, scope the application to that path and record why, rather than widening an existing application that also serves authenticated pages.
Service auth is the correct tool for machines, not bypass. It enforces a credential and keeps logging, which is exactly what an API client or a scheduled job needs. The credential is a service token or a client certificate, and the policy action is service auth. Choosing bypass for a machine client throws away both the enforcement and the audit trail that made Access worth deploying.
One owner per decision is a design rule. The application file owns destinations and session duration; the policy file owns who matches; the group file owns the reusable selector set; the IdP file owns the connection to the identity system. When two of those files can change the same decision, the next incident review will find two explanations and no way to tell which one was live.
Use the Correct Credential for Each Actor
Six credentials appear around an Access deployment, and only one of them is a user login. They look similar in a configuration file because they are all strings that must be kept secret, but they authenticate different actors at different layers. Using the wrong one produces either a confusing redirect loop or a credential that grants far more than its owner intended.
Six secrets, six actors
The provider token acts for Terraform, the service token for a workload, the IdP secret for Access itself, and the session JWT for a person. Each one belongs to a different owner and revokes a different failure, so label them by actor before storing or rotating any of them.
The provider API token is Terraform's identity, not the application's. It authorizes the Cloudflare API calls that create applications, policies and tokens, and its permissions should be limited to the Access resources the configuration owns. It never appears in a request to a protected hostname. A provider token with account-wide edit rights is an infrastructure risk; it is not an Access credential and should not be treated as one.
The Access service token is a workload identity. Cloudflare generates a client ID and a client secret, and the workload presents both in request headers. The token must be authorized by a service-auth policy on the specific application; otherwise Access still prompts for an identity provider login. The secret is displayed once at creation, and Terraform stores the computed value in state for as long as the resource exists.
The IdP client secret belongs to the identity team's integration. Access acts as an OAuth or SAML client of the identity provider, and the secret proves that Access is allowed to ask the IdP to authenticate users. Rotating it breaks human logins, not API calls. It is also the credential most likely to be pasted into a ticket, because it is configured once and then forgotten until the next IdP audit.
The application session is a human credential with a short life. After login, Access issues a cookie and a JWT scoped to that application. The JWT audience claim ties it to one application, and the session duration bounds how long the cookie is accepted. Copying that cookie or JWT into a CI job turns a human session into a shared secret with no owner, no expiry review and no way to revoke one consumer.
An mTLS client certificate is machine identity at the TLS layer. You upload the issuing CA to Access, associate it with hostnames, and let a policy match on a valid certificate or a common name. The private key never leaves the client, which makes it stronger than a shared secret for a device fleet. The trade-off is lifecycle: the CA, the leaf certificates and the association all have expiry dates you must own.
A WARP session identifies a managed device, not a person. When an application allows WARP authentication, an enrolled device can reuse its WARP session instead of prompting for the IdP again. Device posture selectors then become meaningful because the request carries device context. WARP is not a substitute for a policy: it changes which credential is presented, not who is allowed.
Strict service token authentication removes the redirect. With the setting enabled, a failed service-token request returns 401 or 403 instead of a 302 to the login page, only service-auth policies can authorize it, and no session cookie is issued. Organizations created on or after 5 October 2026 have it on by default. For an API, the difference between a JSON 401 and an HTML login page is the difference between a debuggable client and a mystery.
Read the table by the actor column. The question is never "which secret is in this file?" but "who is acting, and which credential proves it?" One actor should map to one credential, and one credential should have one owner and one rotation procedure.
| Credential | Actor it identifies | Presented to | Terraform surface | Rotation trigger |
|---|---|---|---|---|
| Provider API token | Terraform and the pipeline | Cloudflare API | API token resource, outside the Access configuration | Permission review and expiry; rotate on staff change |
| Access service token | A workload, CI job or scheduler | The Access application, in two request headers | cloudflare_zero_trust_access_service_token | Increment the secret version, update consumers, expire the old secret |
| IdP client secret | Access, as a client of the identity provider | The IdP token or assertion endpoint | config.client_secret on the identity provider resource | IdP-side rotation with an overlap window |
| Application session | A human after a successful login | Access cookie and JWT on each request | Derived, not managed; bounded by session duration | Session expiry, revoke sessions, or IdP sign-out |
| mTLS client certificate | A device or service at the TLS layer | Access edge, as a client certificate | cloudflare_zero_trust_access_mtls_certificate for the CA, plus a policy selector | Leaf and CA expiry; reissue before the trust store changes |
| WARP session | An enrolled managed device | Access, through the Cloudflare One Client | Device enrollment plus the application WARP setting | Device posture changes and enrollment revocation |
The table also explains why a leak has a different blast radius in each row. A provider token can rewrite every application in the account. A service token reaches the applications its policies authorize. An IdP secret can impersonate Access to the IdP. A session cookie reaches one application until it expires. Treating all of them as just "a secret in a file" hides those differences from the person writing the incident runbook.
Plan Rotation and a Reviewed Break-Glass Route
Rotation is a sequence with an overlap, not a replacement. Every rotatable credential in the previous table has a period when the new value exists and the old value still works. That overlap is what keeps a rotation from becoming an outage. The work is to make the overlap deliberate, observable and short, rather than discovering it by accident when an old client continues to succeed.
Terraform state holds the secrets that Terraform creates. Marking a variable sensitive only redacts it from CLI output; the value is still written to state and to any saved plan file. Service token secrets and identity provider client secrets therefore inherit the security of the state backend. Encrypted remote state, narrow read access, short plan retention and a ban on attaching plans to tickets are the controls that make the table's rotation promises real.
A service token rotation has a version and a grace period. Incrementing the secret version asks Access to issue a new secret while keeping the previous one valid until the expiry you set. Update every consumer, verify the new secret works, then move the previous expiry into the past to revoke it. The grace period is configurable from one hour to thirty days; a thirty-day window is a migration project, not a rotation.
The consumer inventory is the actual work. A token is easy to rotate; the places that hard-coded it are not. Search the pipeline definitions, the scheduler, the edge Worker and the runbook before you start, and record the owner of each consumer. If a consumer cannot be updated inside the grace window, the rotation plan is incomplete, not the grace period too short.
The inventory is the rotation
A token rotates in one API call; the consumers hard-coded across pipelines, schedulers and runbooks decide whether that call is safe. Name every consumer and its owner first, then set the grace period to the time the slowest one actually needs.
Changing the duration resets the expiry clock. Updating the token duration extends the expiration relative to the time of the update, which is convenient for renewal and dangerous as a silent fix. A token set to never expire is a permanent credential with no review date. Prefer a bounded duration with an expiry alert, and treat the alert as the trigger for a planned rotation rather than a reminder to click refresh.
Inactive-token cleanup is a backstop, not a policy. Access can disable or delete service tokens that have not authenticated and are not directly referenced by a policy rule, after an inactivity period of 30 to 365 days. It helps with abandoned tokens, but it will not save a token that is still referenced by a policy and still being used by an unowned job. Ownership remains the control.
An IdP secret rotation runs on the identity provider's schedule. Create a second client secret at the IdP, update the Terraform variable, apply, verify a real login, then revoke the first secret. The overlapping secret at the IdP is what prevents a login outage during the apply. Never revoke the old secret before a successful login has been observed with the new one.
A break-glass route answers a different failure. The scenario is not a forgotten password; it is an identity provider outage, a mis-scoped policy that locks out every administrator, or a compromised IdP account. The route must work when the primary IdP does not, and it must be narrow enough that its existence does not weaken the normal path. That rules out a bypass policy, which enforces nothing and logs nothing.
Use a second identity provider with a named group. A one-time PIN provider is built into Access and does not depend on the primary IdP's availability. Attach it to a dedicated recovery application or a scoped allow policy whose include rule names specific people or a specific group, with a short session duration and an alert on every use. The policy must name identities: an include rule based only on the one-time PIN login method matches anyone who can receive mail.
The recovery path needs an owner and an expiry. Record who can invoke it, who approves the invocation, how long the temporary policy may exist and when it was last tested. A quarterly test that signs in through the recovery provider and then removes the temporary access is the evidence that matters most. An untested break-glass route is a document, not a control.
Figure 4 shows the two lanes side by side. The left lane is the planned rotation with its overlap window. The right lane is the emergency route, with the same discipline applied to a much shorter timeline: detect, use a named credential, keep the session short, then review and revoke.
The left lane is safe because it removes the old credential last. The right lane is safe because it adds the emergency credential first and removes it first. Reversing either order produces the same failure: a credential that outlives the reason it was created. Write the removal step into the change, not into the memory of the person on call.
A break-glass route must be tested when nothing is broken. Test it in a lab account or against a staging application, with the same provider type and the same policy shape. A test that only reads the configuration proves the document exists. A test that signs in, reaches the application and then removes the temporary access proves the route works under the conditions it was written for.
Prove Allowed, Denied and Service-to-Service Outcomes
A 200 as an administrator proves nothing. Every Access deployment needs four observations: a human who should be allowed gets in, a human who should be denied cannot, a service token that should work does, and the same request without the token fails. Run them from outside the corporate network, because that is where the policy is actually enforced.
Human tests need a clean session. Use a private browser window or a separate profile, and start at the protected hostname rather than at the IdP. If the browser already holds an SSO session, the redirect can complete without showing the login flow, and the test silently proves only that the cookie exists. Record the redirect chain, the final status and whether the deny page appeared.
Denied tests need a user who can authenticate. The best negative test is a real identity from the IdP that sits outside the allowed group, because it proves the policy denied an authenticated person rather than the IdP failing to recognize them. A made-up email that fails at the IdP proves the IdP works, not that the policy does. Capture the status code and the Access log entry for that identity.
Service tests should not borrow a human session. Call the application with the two service-token headers and no cookie, then repeat the call with the headers removed. The first should succeed and the second should redirect or return 401, depending on the strict setting. If the second call succeeds, a bypass policy or a DNS-only path is carrying the request, and the service token is decoration.
The origin is the third witness. Have the test origin echo only whether the assertion header is present, never its value, and compare the JWT audience with the application's read-only audience attribute. A request that reaches the origin without an assertion header means the path skipped Access. A JWT with the wrong audience means the token was minted for a different application.
The origin is the third witness
The origin can report whether the assertion header arrived and for which audience, without logging the token. A request that reaches it headerless proves a bypass path exists, even when the browser test looked perfect.
Drift is a test result too. Change one policy in the dashboard, run a plan, and confirm the change appears as a diff. If the plan is clean, the policy is not owned by the configuration you think owns it. That check catches the most common Access failure: two teams editing the same application, one through Terraform and one through the dashboard, with neither noticing.
The lab below is deliberately comparative. It asks for the allowed, denied and service outcomes in the same session, with the same hostname, so the only variable is the credential. Do it in a lab account, never against a production application that real people depend on.
Verify an Access policy
Status: design-only. Use a lab account, a lab zone and a staging origin. No production identity provider, no customer hostnames and no real secrets are needed. Replace every hostname and identifier with your own placeholders.
Prerequisites. Terraform CLI 1.17.1, provider 5.28.1, a proxied lab hostname, one identity provider you can test with, and an origin that returns a small JSON body stating whether the assertion header was present. A one-time PIN provider is enough for the human path.
Steps. Create the application with one allow policy for a named test group and one service-auth policy for a test service token. Apply the configuration and record the application audience from state. In a clean browser profile, request the hostname and follow the redirect to the IdP. Sign in as an allowed user and record the final status and the origin's assertion report. Sign out, then repeat with a user who authenticates but is outside the group. Call the same hostname with the service-token headers, then without them. Finally, change one policy in the dashboard and run a plan.
| Check | Action | Pass condition | Failure signal |
|---|---|---|---|
| Human allowed | Clean profile, allowed group, follow the redirect | Login completes and the origin reports an assertion header | Loop at the IdP, or a 403 for an allowed user |
| Human denied | Clean profile, authenticated but outside the group | 403 or the custom deny page, with no session cookie | The denied user reaches the origin |
| Service allowed | Two service-token headers, no cookie | 200 from the origin with a service-auth log entry | A login redirect, or a 403 with a valid token |
| Service denied | Same request without the headers | 302 to the IdP, or 401 when strict service auth is on | 200, which means bypass or a direct path |
| Origin claim | Read the origin's assertion report and the application audience | Header present and audience matches the application | Header absent, or an audience from another app |
| Ownership | Edit one policy in the dashboard, then plan | The plan shows the policy diff | A clean plan, which means Terraform does not own the policy |
Expected observation. The allowed human sees the origin's JSON body with the assertion header present. The denied human sees a 403 or the deny page and never reaches the origin. The service call with headers returns 200 and produces a service-auth log entry. The same call without headers redirects to the IdP, or returns 401 under strict service auth. The dashboard edit appears as a plan diff.
Failure check. The lab fails if the denied user reaches the origin, if the service call succeeds without headers, if the origin reports no assertion header on an allowed request, or if the dashboard edit produces no diff. It also fails if the only evidence is a screenshot of the dashboard: the status codes, the origin report and the log entry are the evidence.
Cost and cleanup. The lab uses one application, two policies, one group, one service token and one lab hostname. Destroy the application and the token when finished; deleting the token is the revocation, not a state cleanup. Remove the temporary group and any test identity you created at the IdP.
Evidence to keep. Sanitized status codes for all four calls, the redirect chain, the origin's assertion report, the audience comparison, the service-auth log entry and the plan diff for the dashboard edit. Store the evidence with the lab notes, never with the token secret.
Close with the three questions the configuration must answer. Which identity provider authenticates this user, which ordered policy decides this application, and which credential proves a machine is allowed? The first answer belongs to the identity team, the second to the application owner, and the third to whoever runs the workload. When all three are written down with an owner and a test, Access is an authorization system; when they are not, it is a login page with a hopeful configuration behind it.
Next in the Series
In Tunnels and Gateway: Connect Private Origins and Govern Egress, we'll explore Separate Terraform-managed network configuration from connector processes and enrolled clients.