Skip to Content
Cloud Engineering Academy
5. Security for Banking & Finance

Zero-trust principles and AWS Verified Access (overview)

Replace 'inside the network means trusted' with per-request decisions based on identity, device posture and context, and see how AWS Verified Access gives Harbourline staff VPN-less access to internal banking tools.

intermediate⏱ 1 h 30 min🟡 Low costSCS-C03SAA-C03

Assumes: .NET 10 LTS · AWS SDK for .NET v4 · AWS CLI v2 · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Explain the core zero-trust principles (verify explicitly, least privilege, assume breach) and why "on the corporate network" is no longer a security decision for a bank.
  • Describe the building blocks of AWS Verified Access: instances, trust providers (user and device), groups, endpoints and Cedar access policies.
  • Write Cedar policies that combine IAM Identity Center group membership, verified email and device posture.
  • Verify the signed x-amzn-ava-user-context header inside an ASP.NET Core application, so the app trusts identity claims only when Verified Access really sent them.
  • Compare Verified Access with Client VPN, Microsoft Entra Private Access / Application Proxy and Systems Manager Session Manager, and pick the right tool per use case.
  • Estimate the cost of a Verified Access deployment and run it as a deploy-and-destroy exercise, or complete the free design-only alternative.

Prerequisites

Why this matters in banking

Picture Harbourline's back-office. Operations staff use an internal Payments Exceptions web app to release payments stuck in sanctions screening. Today it sits behind the corporate VPN: once a laptop is connected, it can reach the app, the database subnet's load balancer, a dozen admin consoles and the legacy Core Banking jump host. Three real-world failure patterns follow from that design:

  1. A phished VPN credential is a master key. The attacker connects, and the network treats them as an employee. Every internal app that relies on "only staff can reach this" is now exposed. Several high-profile breaches in financial services started exactly this way.
  2. Unmanaged devices. A contractor connects from a personal laptop with an out-of-date browser and a keylogger. The VPN checked a password and an MFA code — it never asked whether the device was healthy.
  3. No per-application evidence. The auditor asks "who accessed the payments-release tool last quarter, from which device?" The VPN logs show IP addresses and session times, not application decisions.

Regulators increasingly expect controls that don't depend on network location. The UK's operational-resilience and outsourcing expectations, PCI DSS requirements for MFA into the cardholder data environment, and the general direction of NCSC zero-trust guidance all point the same way: authenticate and authorise each access to each application, using the strongest signals you have. (Mapping those expectations to specific controls is your compliance team's job; this lesson gives you the technical building blocks.)

The idea in plain language

Zero trust is a design philosophy, not a product. It says: never grant access just because a request comes from a particular network. Instead, every request is evaluated using:

  • Who is asking (a strongly authenticated identity, with MFA),
  • What they are using (the device — is it managed, encrypted, patched, free of malware?),
  • What they want (this one application, maybe this one action),
  • Context (time, location, risk signals),

and the answer is the least access needed, re-checked continuously. It also assumes that a breach has already happened somewhere, so every component should limit the blast radius.

NIST SP 800-207 describes the pattern with three roles: a policy decision point (decides), a policy enforcement point (sits in the traffic path and enforces) and policy information points (identity provider, device management, threat intelligence).

AWS Verified Access is AWS's managed policy enforcement and decision point for workforce access to applications. You put your internal app (behind an internal load balancer or on a network interface) behind a Verified Access endpoint. A user browses to https://payments-exceptions.corp.harbourline.example; Verified Access redirects them to your identity provider, collects device signals from a browser extension if configured, evaluates a Cedar policy, and only then proxies the request to the app. No VPN client, and the app is never reachable from the internet directly.

Analogy: The old model is a bank building where your staff pass gets you through the front door and then every internal door is propped open. Zero trust puts a guard at every door. Verified Access is the guard at the door of each application: it checks your pass (identity), looks at what you are carrying (device posture), checks the access list for that specific room (policy), and writes everything in the visitor book (logs).

What problem the AWS service solves

ConceptWhat it isNotes (checked 2026-11-18)
Verified Access instanceThe top-level container in a Region; trust providers attach to itLogging is configured at instance level (CloudWatch Logs, S3 or Firehose)
Trust provider — userIdentity source: IAM Identity Center or any OIDC IdP (Entra ID, Okta, Ping…)policy-reference-name decides the name used in policies, e.g. context.idc
Trust provider — deviceDevice posture from a partner: Jamf, CrowdStrike, JumpCloudRequires the browser extension on the client for HTTP apps ⚠ VERIFY the current partner list
Verified Access groupA set of endpoints sharing a group policyTypical: one group per business domain (payments ops, risk, HR)
EndpointThe application front doorTypes: load-balancer (internal ALB/NLB), network-interface, and — for non-HTTP(S) — rds and cidr
Access policyCedar permit / forbid statements on group and endpointGroup and endpoint policies must both allow
Signed user claimsHeader x-amzn-ava-user-context, a JWT signed with ES384The app should verify it before trusting any claim
WAF integrationAttach an AWS WAF web ACL to the instanceSame rule groups as in the WAF lesson
Non-HTTP accessTCP, SSH, RDP to EC2, RDS or CIDR rangesGA since February 2025; users need the AWS Verified Access Connectivity Client

Honest limitations:

  • Verified Access is for workforce access to your applications. It is not a customer-facing identity solution (that is Cognito or your CIAM) and not a general internet proxy or secure web gateway.
  • Policies are evaluated per request for HTTP apps, but they can only use the signals the trust providers supply. If your IdP doesn't enforce phishing-resistant MFA, Verified Access can't add it.
  • It costs money per application per hour, even when idle (see Cost). For a small number of rarely used admin tools, Session Manager port forwarding may be cheaper.
  • Device trust providers require a supported management product and the browser extension; unmanaged-device scenarios need a separate decision (deny, or a reduced-risk policy).
  • It does not make an application secure. The app still needs authorisation for actions (who may release a £2m payment) — Verified Access decides who may reach the app.

Microsoft / Azure comparison

You know (Microsoft/Azure)AWS equivalentWhat's different
Microsoft Entra Private Access (Global Secure Access)AWS Verified AccessVerified Access is per-Region and per-application; policies are written in Cedar rather than configured as Conditional Access policies
Entra Application ProxyVerified Access HTTP endpoint on an internal ALBNo connector VM to run; Verified Access sits in your VPC via the endpoint
Entra Conditional Access (device compliance, sign-in risk)Cedar policies using user + device trust dataYou can still keep Conditional Access in Entra when Entra is the OIDC trust provider — both layers apply
Intune compliance stateJamf / CrowdStrike / JumpCloud device trust providersIntune is not a built-in Verified Access device provider ⚠ VERIFY; a common pattern is to enforce device compliance in Entra Conditional Access instead
Azure Bastion (RDP/SSH via browser)Systems Manager Session Manager, or Verified Access TCP endpointsSession Manager needs no inbound ports and is free; Verified Access TCP adds identity + device policy
Point-to-site VPN GatewayAWS Client VPNNetwork-level access; zero-trust guidance treats this as a fallback
ASP.NET Core [Authorize(Policy = "...")]Cedar policy at the edge plus your app's own authorisationKeep both: edge decides reachability, app decides actions

Architecture

Trust boundaries: the app and its load balancer live only in private subnets; the load balancer's security group accepts traffic only from the Verified Access endpoint's security group. The identity provider is the source of identity truth, the device manager is the source of device truth, and the policy is versioned code. Every allow and deny is logged to the log-archive account (see CloudTrail for banks for the same pattern applied to API audit logs).

Request flow

Step-by-step implementation

Inventory internal applications and classify them

List every internal app currently reached over VPN. For each one note the users, data classification (from data classification), protocol (HTTP or TCP) and whether it already has its own authentication. For Harbourline's first wave: Payments Exceptions (HTTPS, restricted data), Reconciliation dashboard (HTTPS, confidential), and the Core Banking batch-console jump host (SSH, restricted).

Choose the identity source

If staff already sign in through Entra ID, either federate Entra ID into IAM Identity Center (one identity plane for AWS console and apps) or register Entra ID directly as an OIDC trust provider. Use group IDs, not display names, in policies; names change, IDs don't. Make sure MFA is enforced by the IdP.

Decide on device posture

Agree with end-user computing which device signals exist (Jamf for Macs, CrowdStrike Falcon on Windows) and which minimum is acceptable for each data classification. Restricted apps: managed device and low risk score. Confidential: managed device. Document what happens to unmanaged devices (usually: deny).

Create the instance and attach trust providers

Create a Verified Access instance, a user trust provider (policy reference name idc) and, optionally, a device trust provider (jamf or crwd), and attach them to the instance. Turn on logging immediately, with trust-context logging if your privacy review allows (see Security considerations).

Create groups with coarse policies

One group per business domain, with a group policy such as "must be in the Harbourline-Staff group with a verified email". Groups let a security team own a baseline while application teams add stricter endpoint policies.

Create endpoints with fine-grained policies

For each app: a public-trust TLS certificate in ACM for the application domain, an endpoint of type load-balancer pointing at the internal ALB, a security group, and an endpoint policy such as "Payments-Ops-Releasers group and device risk LOW".

Lock the origin

Change the ALB security group so it accepts traffic only from the Verified Access endpoint's security group, and remove VPN routes to that subnet. In the app, verify the signed header and use sub / user_id for audit — never a client-supplied header.

Run in parallel, then retire VPN access per app

Publish the new DNS name, run both paths for a short period, compare logs, then remove VPN reachability one application at a time. Keep a break-glass path documented and tested.

AWS Console instructions

Verified Access lives in the VPC console:

  1. Console → VPC → Verified Access trust providers → Create Verified Access trust provider. Policy reference name idc; trust provider type User trust provider; user trust provider type IAM Identity Center. Add tags (Project=cea-lab, Lab=m05-l16, Environment=learn, Owner=<you>).
  2. Console → VPC → Verified Access instances → Create Verified Access instance. Select the trust provider you just created.
  3. Select the instance → Actions → Modify Verified Access instance logging configuration. Enable CloudWatch Logs to a log group named /hl/m05/verified-access with 7-day retention.
  4. Console → VPC → Verified Access groups → Create Verified Access group. Choose the instance, paste the group policy, enable the policy.
  5. Console → VPC → Verified Access endpoints → Create Verified Access endpoint. Group, application domain, ACM certificate, endpoint type Load balancer, protocol HTTPS, port 443, the internal ALB ARN, private subnets, security group, endpoint domain prefix hl, and the endpoint policy.
  6. In Route 53 (or your DNS provider), create a CNAME from the application domain to the endpoint domain shown on the endpoint's detail page.
  7. In IAM Identity Center → Applications, assign the relevant users or groups to the Verified Access application that was created automatically ⚠ VERIFY the exact assignment step in the current console.

AWS CLI

PROFILE=learn-sandbox
TAGS='Tags=[{Key=Project,Value=cea-lab},{Key=Lab,Value=m05-l16},{Key=Environment,Value=learn},{Key=Owner,Value=you}]'

# 1. User trust provider backed by IAM Identity Center; policies will refer to it as "idc"
TP_ID=$(aws ec2 create-verified-access-trust-provider \
  --trust-provider-type user \
  --user-trust-provider-type iam-identity-center \
  --policy-reference-name idc \
  --description "Harbourline workforce identity" \
  --tag-specifications "ResourceType=verified-access-trust-provider,$TAGS" \
  --query VerifiedAccessTrustProvider.VerifiedAccessTrustProviderId --output text \
  --profile $PROFILE)

# 2. Instance, then attach the trust provider
INST_ID=$(aws ec2 create-verified-access-instance \
  --description "hl-m05 verified access" \
  --tag-specifications "ResourceType=verified-access-instance,$TAGS" \
  --query VerifiedAccessInstance.VerifiedAccessInstanceId --output text --profile $PROFILE)

aws ec2 attach-verified-access-trust-provider \
  --verified-access-instance-id $INST_ID \
  --verified-access-trust-provider-id $TP_ID --profile $PROFILE

# 3. Logging: every allow/deny decision to CloudWatch Logs (create the log group first)
aws logs create-log-group --log-group-name /hl/m05/verified-access --profile $PROFILE
aws logs put-retention-policy --log-group-name /hl/m05/verified-access --retention-in-days 7 --profile $PROFILE
aws ec2 modify-verified-access-instance-logging-configuration \
  --verified-access-instance-id $INST_ID \
  --access-logs '{"CloudWatchLogs":{"Enabled":true,"LogGroup":"/hl/m05/verified-access"}}' \
  --profile $PROFILE

# 4. Group with a baseline policy (Cedar, read from a file)
GROUP_ID=$(aws ec2 create-verified-access-group \
  --verified-access-instance-id $INST_ID \
  --policy-document file://group-policy.cedar \
  --tag-specifications "ResourceType=verified-access-group,$TAGS" \
  --query VerifiedAccessGroup.VerifiedAccessGroupId --output text --profile $PROFILE)

# 5. Endpoint in front of an internal ALB (ARN, subnets, SG and cert from your Module 2/3 labs)
aws ec2 create-verified-access-endpoint \
  --verified-access-group-id $GROUP_ID \
  --endpoint-type load-balancer \
  --attachment-type vpc \
  --domain-certificate-arn arn:aws:acm:us-east-1:111122223333:certificate/EXAMPLE \
  --application-domain payments-exceptions.corp.harbourline.example \
  --endpoint-domain-prefix hl \
  --security-group-ids sg-0123456789abcdef0 \
  --load-balancer-options 'LoadBalancerArn=arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/hl-m05-internal/abc123,Port=443,Protocol=https,SubnetIds=[subnet-aaa,subnet-bbb]' \
  --policy-document file://endpoint-policy.cedar \
  --tag-specifications "ResourceType=verified-access-endpoint,$TAGS" \
  --profile $PROFILE

# Inspect what you built
aws ec2 describe-verified-access-endpoints --verified-access-group-id $GROUP_ID \
  --query "VerifiedAccessEndpoints[].{Id:VerifiedAccessEndpointId,Domain:EndpointDomain,Status:Status.Code}" \
  --profile $PROFILE

The two policy files:

group-policy.cedar
// Baseline for every payments-ops app: Harbourline staff with a verified email address.
permit(principal, action, resource)
when {
    context.idc.groups has "9a1b2c3d-1111-2222-3333-444455556666"   // Harbourline-Staff group ID
    && context.idc.user.email.verified == true
};
endpoint-policy.cedar
// Payments Exceptions: only the releasers group.
permit(principal, action, resource)
when {
    context.idc.groups has "5e6f7a8b-aaaa-bbbb-cccc-ddddeeeeffff"   // Payments-Ops-Releasers group ID
};

// Never from this known-bad test range, even for releasers (forbid always wins).
forbid(principal, action, resource)
when {
    ip(context.http_request.client_ip).isInRange(ip("198.51.100.0/24"))
};

How group and endpoint policies combine: the request must be permitted by the group policy and by the endpoint policy (if the endpoint has one). Within a policy document, Cedar's rule is the same as IAM's: an explicit forbid beats any permit, and no permit means deny.

Infrastructure as Code

VerifiedAccessStack.cs
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.Logs;
using Constructs;

namespace Harbourline.Security.Infra;

public sealed class VerifiedAccessStackProps : StackProps
{
    public required string InternalAlbArn { get; init; }
    public required string[] PrivateSubnetIds { get; init; }
    public required string VpcId { get; init; }
    public required string CertificateArn { get; init; }
    public required string ApplicationDomain { get; init; }
    public required string StaffGroupId { get; init; }
    public required string ReleasersGroupId { get; init; }
}

public sealed class VerifiedAccessStack : Stack
{
    public VerifiedAccessStack(Construct scope, string id, VerifiedAccessStackProps props) : base(scope, id, props)
    {
        Tags.SetTag("Project", "cea-lab");
        Tags.SetTag("Lab", "m05-l16");
        Tags.SetTag("Environment", "learn");

        var logGroup = new LogGroup(this, "AccessLogs", new LogGroupProps
        {
            LogGroupName = "/hl/m05/verified-access",
            Retention = RetentionDays.ONE_WEEK,
            RemovalPolicy = RemovalPolicy.DESTROY, // learning shortcut: production keeps logs
        });

        var trustProvider = new CfnVerifiedAccessTrustProvider(this, "IdcTrustProvider", new CfnVerifiedAccessTrustProviderProps
        {
            TrustProviderType = "user",
            UserTrustProviderType = "iam-identity-center",
            PolicyReferenceName = "idc",
            Description = "Harbourline workforce identity",
        });

        var instance = new CfnVerifiedAccessInstance(this, "Instance", new CfnVerifiedAccessInstanceProps
        {
            Description = "hl-m05 verified access",
            VerifiedAccessTrustProviderIds = [trustProvider.AttrVerifiedAccessTrustProviderId],
            LoggingConfigurations = new CfnVerifiedAccessInstance.VerifiedAccessLogsProperty
            {
                CloudWatchLogs = new CfnVerifiedAccessInstance.CloudWatchLogsProperty
                {
                    Enabled = true,
                    LogGroup = logGroup.LogGroupName,
                },
            },
        });

        var group = new CfnVerifiedAccessGroup(this, "PaymentsOpsGroup", new CfnVerifiedAccessGroupProps
        {
            VerifiedAccessInstanceId = instance.AttrVerifiedAccessInstanceId,
            PolicyEnabled = true,
            PolicyDocument = $$"""
                permit(principal, action, resource)
                when {
                    context.idc.groups has "{{props.StaffGroupId}}"
                    && context.idc.user.email.verified == true
                };
                """,
        });

        var vpc = Vpc.FromLookup(this, "Vpc", new VpcLookupOptions { VpcId = props.VpcId });
        var endpointSg = new SecurityGroup(this, "EndpointSg", new SecurityGroupProps
        {
            Vpc = vpc,
            Description = "Verified Access endpoint for payments-exceptions",
            AllowAllOutbound = false,
        });
        endpointSg.AddEgressRule(Peer.Ipv4(vpc.VpcCidrBlock), Port.Tcp(443), "To internal ALB only");

        _ = new CfnVerifiedAccessEndpoint(this, "PaymentsExceptions", new CfnVerifiedAccessEndpointProps
        {
            VerifiedAccessGroupId = group.AttrVerifiedAccessGroupId,
            EndpointType = "load-balancer",
            AttachmentType = "vpc",
            ApplicationDomain = props.ApplicationDomain,
            DomainCertificateArn = props.CertificateArn,
            EndpointDomainPrefix = "hl",
            SecurityGroupIds = [endpointSg.SecurityGroupId],
            LoadBalancerOptions = new CfnVerifiedAccessEndpoint.LoadBalancerOptionsProperty
            {
                LoadBalancerArn = props.InternalAlbArn,
                Port = 443,
                Protocol = "https",
                SubnetIds = props.PrivateSubnetIds,
            },
            PolicyEnabled = true,
            PolicyDocument = $$"""
                permit(principal, action, resource)
                when { context.idc.groups has "{{props.ReleasersGroupId}}" };
                """,
        });

        _ = new CfnOutput(this, "EndpointSecurityGroupId", new CfnOutputProps
        {
            Value = endpointSg.SecurityGroupId,
            Description = "Allow ONLY this SG on the internal ALB's listener port",
        });
    }
}

Both stacks assume an existing internal ALB and private subnets from earlier modules, an ACM certificate for the application domain, and IAM Identity Center enabled in the account. ⚠ VERIFY: the Terraform provider's argument names for Verified Access resources have changed across provider releases; run terraform validate against your pinned v6 provider.

Complete code

Verified Access forwards the user's claims to your application in the x-amzn-ava-user-context header as a JWT signed with ES384. The header name is not secret: if anything else can reach your app (a misconfigured security group, a forgotten VPN route), an attacker can send a forged header. The app must therefore check that the token was signed by the Verified Access public key and that the signer field is your instance ARN.

This ASP.NET Core minimal API does exactly that with no third-party JWT library — only System.Security.Cryptography. The verifier is a separate class so you can unit-test it offline with a locally generated key.

PaymentsExceptions/PaymentsExceptions.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <RootNamespace>Harbourline.Payments.Exceptions</RootNamespace>
  </PropertyGroup>
</Project>
PaymentsExceptions/VerifiedAccessTokenVerifier.cs
using System.Collections.Concurrent;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

namespace Harbourline.Payments.Exceptions;

public sealed record VerifiedAccessUser(string Subject, string? Email, bool EmailVerified);

public interface IPublicKeySource
{
    Task<string> GetPemAsync(string keyId, CancellationToken ct);
}

// Fetches PEM public keys from the regional Verified Access endpoint and caches them.
public sealed class HttpPublicKeySource(HttpClient http, string region) : IPublicKeySource
{
    private readonly ConcurrentDictionary<string, string> _cache = new();

    public async Task<string> GetPemAsync(string keyId, CancellationToken ct)
    {
        if (!Guid.TryParse(keyId, out _))
            throw new SecurityException("Key ID is not a GUID");   // stops URL injection via kid

        if (_cache.TryGetValue(keyId, out var pem)) return pem;
        var url = $"https://public-keys.prod.verified-access.{region}.amazonaws.com/{keyId}";
        pem = await http.GetStringAsync(url, ct);
        _cache[keyId] = pem;
        return pem;
    }
}

public sealed class SecurityException(string message) : Exception(message);

public sealed class VerifiedAccessTokenVerifier(
    IPublicKeySource keys, string expectedSignerArn, TimeProvider clock)
{
    public async Task<VerifiedAccessUser> VerifyAsync(string jwt, CancellationToken ct = default)
    {
        var parts = jwt.Split('.');
        if (parts.Length != 3) throw new SecurityException("Malformed token");

        using var header = JsonDocument.Parse(Base64UrlDecode(parts[0]));
        var h = header.RootElement;

        if (h.GetProperty("alg").GetString() != "ES384")
            throw new SecurityException("Unexpected algorithm");
        if (h.GetProperty("signer").GetString() != expectedSignerArn)
            throw new SecurityException("Token not signed by our Verified Access instance");

        if (h.TryGetProperty("exp", out var expEl) && expEl.ValueKind == JsonValueKind.Number)
        {
            var exp = DateTimeOffset.FromUnixTimeSeconds(expEl.GetInt64());
            if (clock.GetUtcNow() > exp.AddSeconds(30)) // small clock-skew allowance
                throw new SecurityException("Token expired");
        }

        var kid = h.GetProperty("kid").GetString() ?? throw new SecurityException("Missing kid");
        var pem = await keys.GetPemAsync(kid, ct);

        using var ecdsa = ECDsa.Create();
        ecdsa.ImportFromPem(pem);
        var signedData = Encoding.ASCII.GetBytes($"{parts[0]}.{parts[1]}");
        var signature = Base64UrlDecode(parts[2]);

        // JWT ES384 signatures are raw r||s (IEEE P1363), which is .NET's default format.
        if (!ecdsa.VerifyData(signedData, signature, HashAlgorithmName.SHA384))
            throw new SecurityException("Bad signature");

        using var payload = JsonDocument.Parse(Base64UrlDecode(parts[1]));
        return ParseUser(payload.RootElement);
    }

    // Handles both shapes: IAM Identity Center ("user": {...}) and OIDC (flat claims).
    private static VerifiedAccessUser ParseUser(JsonElement p)
    {
        if (p.TryGetProperty("user", out var u))
        {
            var id = u.GetProperty("user_id").GetString()!;
            string? email = null; var verified = false;
            if (u.TryGetProperty("email", out var e))
            {
                email = e.TryGetProperty("address", out var a) ? a.GetString() : null;
                verified = e.TryGetProperty("verified", out var v) && v.GetBoolean();
            }
            return new VerifiedAccessUser(id, email, verified);
        }

        return new VerifiedAccessUser(
            p.GetProperty("sub").GetString()!,
            p.TryGetProperty("email", out var em) ? em.GetString() : null,
            p.TryGetProperty("email_verified", out var ev) && ev.GetBoolean());
    }

    public static byte[] Base64UrlDecode(string s)
    {
        var b = s.Replace('-', '+').Replace('_', '/');
        b = b.PadRight(b.Length + (4 - b.Length % 4) % 4, '=');
        return Convert.FromBase64String(b);
    }
}
PaymentsExceptions/Program.cs
using Harbourline.Payments.Exceptions;

var builder = WebApplication.CreateBuilder(args);

var signerArn = builder.Configuration["VerifiedAccess:InstanceArn"]
    ?? throw new InvalidOperationException("Set VerifiedAccess:InstanceArn");
var region = builder.Configuration["VerifiedAccess:Region"] ?? "us-east-1";

builder.Services.AddHttpClient();
builder.Services.AddSingleton<IPublicKeySource>(sp =>
    new HttpPublicKeySource(sp.GetRequiredService<IHttpClientFactory>().CreateClient(), region));
builder.Services.AddSingleton(sp =>
    new VerifiedAccessTokenVerifier(sp.GetRequiredService<IPublicKeySource>(), signerArn, TimeProvider.System));
builder.Services.AddProblemDetails();

var app = builder.Build();

// Every request must carry a valid Verified Access token; otherwise 401 ProblemDetails.
app.Use(async (ctx, next) =>
{
    if (ctx.Request.Path == "/healthz") { await next(); return; }   // ALB health checks

    var token = ctx.Request.Headers["x-amzn-ava-user-context"].ToString();
    if (string.IsNullOrEmpty(token))
    {
        await Results.Problem(statusCode: 401, title: "Missing Verified Access context").ExecuteAsync(ctx);
        return;
    }
    try
    {
        var verifier = ctx.RequestServices.GetRequiredService<VerifiedAccessTokenVerifier>();
        var user = await verifier.VerifyAsync(token, ctx.RequestAborted);
        ctx.Items["va-user"] = user;
        await next();
    }
    catch (SecurityException ex)
    {
        app.Logger.LogWarning("Rejected Verified Access token: {Reason}", ex.Message);
        await Results.Problem(statusCode: 401, title: "Invalid Verified Access context").ExecuteAsync(ctx);
    }
});

app.MapGet("/healthz", () => Results.Ok("ok"));

app.MapGet("/whoami", (HttpContext ctx) =>
{
    var user = (VerifiedAccessUser)ctx.Items["va-user"]!;
    // Log the stable subject for audit, never the raw token.
    app.Logger.LogInformation("Exceptions queue viewed by {Subject}", user.Subject);
    return Results.Ok(new { user.Subject, user.Email, user.EmailVerified });
});

app.Run();

To test the verifier offline, generate a P-384 key, sign a token yourself and verify it with a fake key source:

PaymentsExceptions.Tests/VerifierTests.cs
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using Harbourline.Payments.Exceptions;
using Xunit;

public sealed class VerifierTests
{
    private const string Signer = "arn:aws:ec2:us-east-1:111122223333:verified-access-instance/vai-0abc123";

    private sealed class FakeKeys(string pem) : IPublicKeySource
    {
        public Task<string> GetPemAsync(string keyId, CancellationToken ct) => Task.FromResult(pem);
    }

    private static string B64(byte[] b) => Convert.ToBase64String(b).TrimEnd('=').Replace('+', '-').Replace('/', '_');

    private static string MakeToken(ECDsa key, string signer)
    {
        var header = B64(JsonSerializer.SerializeToUtf8Bytes(new
        {
            alg = "ES384", kid = Guid.NewGuid().ToString(), signer,
            exp = DateTimeOffset.UtcNow.AddMinutes(2).ToUnixTimeSeconds(),
        }));
        var payload = B64(JsonSerializer.SerializeToUtf8Bytes(new
        {
            user = new { user_id = "u-123", user_name = "ops.analyst", email = new { address = "ops.analyst@example.com", verified = true } },
        }));
        var sig = key.SignData(Encoding.ASCII.GetBytes($"{header}.{payload}"), HashAlgorithmName.SHA384);
        return $"{header}.{payload}.{B64(sig)}";
    }

    [Fact]
    public async Task Accepts_valid_token()
    {
        using var key = ECDsa.Create(ECCurve.NamedCurves.nistP384);
        var verifier = new VerifiedAccessTokenVerifier(new FakeKeys(key.ExportSubjectPublicKeyInfoPem()), Signer, TimeProvider.System);
        var user = await verifier.VerifyAsync(MakeToken(key, Signer), TestContext.Current.CancellationToken);
        Assert.Equal("u-123", user.Subject);
        Assert.True(user.EmailVerified);
    }

    [Fact]
    public async Task Rejects_wrong_signer()
    {
        using var key = ECDsa.Create(ECCurve.NamedCurves.nistP384);
        var verifier = new VerifiedAccessTokenVerifier(new FakeKeys(key.ExportSubjectPublicKeyInfoPem()), Signer, TimeProvider.System);
        var forged = MakeToken(key, Signer.Replace("vai-0abc123", "vai-attacker"));
        await Assert.ThrowsAsync<SecurityException>(() => verifier.VerifyAsync(forged, TestContext.Current.CancellationToken));
    }

    [Fact]
    public async Task Rejects_token_signed_by_another_key()
    {
        using var real = ECDsa.Create(ECCurve.NamedCurves.nistP384);
        using var attacker = ECDsa.Create(ECCurve.NamedCurves.nistP384);
        var verifier = new VerifiedAccessTokenVerifier(new FakeKeys(real.ExportSubjectPublicKeyInfoPem()), Signer, TimeProvider.System);
        await Assert.ThrowsAsync<SecurityException>(() => verifier.VerifyAsync(MakeToken(attacker, Signer), TestContext.Current.CancellationToken));
    }
}

The test project follows the standard pattern (xUnit v3 4.0.3 on Microsoft.Testing.Platform, <OutputType>Exe</OutputType>, a project reference to PaymentsExceptions).

Code explained line by line

  1. Microsoft.NET.Sdk.Web — the app is a normal ASP.NET Core service; Verified Access needs no AWS SDK in the app.
  2. HttpPublicKeySource — builds the documented regional URL https://public-keys.prod.verified-access.<region>.amazonaws.com/<kid> and caches each PEM key, because keys are reused across many requests.
  3. Guid.TryParse(keyId, ...) — the kid comes from an untrusted header. Rejecting anything that isn't a GUID stops an attacker from steering your HTTP client to another path (a simple SSRF guard).
  4. h.GetProperty("alg") != "ES384" — pinning the algorithm prevents "algorithm confusion" attacks such as alg: none.
  5. signer != expectedSignerArn — the most important check. Another AWS customer's Verified Access instance also produces validly signed tokens; only the signer ARN proves it is yours.
  6. The exp check with 30 seconds of skew — Verified Access tokens are short-lived (around two minutes per the documentation); rejecting old ones limits replay.
  7. ecdsa.ImportFromPem(pem) — the key endpoint returns PEM text, which .NET imports directly.
  8. VerifyData(..., HashAlgorithmName.SHA384) — JWS signs the ASCII bytes of base64url(header).base64url(payload). .NET's default ECDSA signature format is IEEE P1363 (r||s), which is what JWS uses, so no DER conversion is needed.
  9. ParseUser — IAM Identity Center tokens nest identity under user (user_id, email.address, email.verified); OIDC tokens use flat claims (sub, email, email_verified). The code supports both.
  10. Base64UrlDecode — JWT segments are base64url without padding; the method converts back to standard base64 and re-pads.
  11. The middleware in Program.cs runs on every request except /healthz (the ALB health check does not pass through Verified Access, so it has no header).
  12. Results.Problem(statusCode: 401, ...) — returns RFC 9457 ProblemDetails, matching the platform's error convention.
  13. ctx.Items["va-user"] — stores the verified user for the rest of the pipeline; endpoints never read the raw header again.
  14. Logging user.Subject — a stable, non-reassignable identifier is the right audit key; emails can change and are personal data.
  15. In the tests, ExportSubjectPublicKeyInfoPem() produces the same PEM shape the AWS endpoint serves, so the production code path is exercised exactly.

Security considerations

⚠ Learning shortcut — not for production

The lab uses a single Verified Access instance in a sandbox account, a CloudWatch log group with 7-day retention and RemovalPolicy.DESTROY, IAM Identity Center groups without device trust, and an application domain on a test certificate. In production: access logs delivered to S3 in the log-archive account with retention set by records management, a device trust provider for restricted apps, policies stored in Git with peer review and automated tests, an AWS WAF web ACL on the instance, and DNS plus certificates managed through change control.

  • Close the side doors. Verified Access is only zero trust if it is the only path. The ALB security group must allow only the endpoint security group, and VPN or peering routes into the subnet must be removed or restricted.
  • Verify the header in the app. Always check signature, algorithm and signer. Don't trust X-Forwarded-User-style headers from anywhere.
  • Use group IDs. A renamed group must not silently grant or remove access.
  • Prefer explicit forbids for hard rules. For example: forbid all access from outside approved countries for restricted apps, regardless of other permits.
  • Trust-context logging is personal data. Verified Access can include trust data (claims, device data) in logs. That helps investigations but contains employee personal data; agree retention and access with your DPO and HR, and document it in the record of processing.
  • Break-glass. If the IdP is down, nobody gets in. Keep a tested, audited emergency path (for example Session Manager with a break-glass role) and alert on every use.
  • Least privilege after the door. Verified Access proves "this person may reach Payments Exceptions". Whether they may release a specific payment is still the app's job — combine edge policy with in-app authorisation and four-eyes approval for high-value actions.
  • Non-HTTP endpoints (SSH/RDP/database) still need host-level controls: no shared accounts, session recording where policy requires it.

Banking use case

Harbourline's end-user computing team has two problems: 600 operations staff connect through a VPN concentrator due for replacement, and an internal audit finding says "access to the payments-release tool is controlled only by network location".

The security architecture review agrees a three-phase plan:

PhaseApplicationsPolicyResult
1Payments Exceptions, Reconciliation dashboard (HTTPS)Staff group + releasers/recon group; device must be Jamf- or CrowdStrike-managed with low riskVPN routes to these subnets removed; audit finding closed with Verified Access logs as evidence
2Internal admin consoles for Notifications Service and Partner GatewayEngineering group; access only during on-call or with an approved change ⚠ the time-window rule is implemented with a dedicated IdP group that the change tool adds people to, not in CedarStanding access to admin consoles removed
3Core Banking batch console (SSH)TCP endpoint; Connectivity Client; restricted groupJump host's public route removed; Session Manager kept as break-glass

Cost estimate for phase 1 (us-east-1, fictional usage): 2 HTTP apps × 730 hours × USD 0.27 ≈ USD 394 per month, plus about 150 GB processed × USD 0.02 = USD 3. That is compared with the VPN concentrator's licence and support costs. The decision record notes that the price per application makes Verified Access best suited to sensitive, frequently used apps; rarely used admin tools stay on Session Manager.

The compliance team, not the engineers, decides whether this satisfies the bank's internal policy for privileged access and the relevant PCI DSS requirements for any app inside the cardholder data environment.

Common mistakes

  • Leaving the VPN route in place → attackers bypass the policy → remove network paths once Verified Access is live; test from a VPN-connected laptop that the app is no longer reachable.
  • Using group display names in Cedar → renaming "Payments Ops" silently breaks or broadens access → use group IDs from the identity store.
  • Forgetting that both group and endpoint policies must allow → users get 403 even though the endpoint policy looks right → check the group policy too.
  • Health checks failing after locking the ALB → the ALB health check never had the header → exclude /healthz from header verification, and keep health checks internal.
  • Trusting the header without verifying signer → another account's Verified Access could be pointed at your app → always compare the signer ARN.
  • Expecting Verified Access to protect customer-facing APIs → it's a workforce access service → use Cognito/your CIAM, WAF and API Gateway for customers.
  • Rolling out device trust without an exception process → contractors locked out on day one → define the unmanaged-device policy before go-live.

Troubleshooting

SymptomLikely causeFix
Browser shows a Verified Access 403 after sign-inGroup or endpoint policy did not permit; wrong group ID; policy disabledRead the access log entry for the request; check PolicyEnabled and the group ID in the identity store
Endless redirect to the sign-in pageUser not assigned to the Verified Access application in IAM Identity Center, or third-party cookies blockedAssign the user or group; test in a clean browser profile
502 / 504 from the endpointEndpoint security group cannot reach the ALB, or the ALB listener doesn't match protocol/portAllow egress from the endpoint SG and ingress on the ALB SG from it; match Port/Protocol
Certificate warning on the app domainACM certificate doesn't cover the application domain or isn't issuedRequest a certificate for the exact domain; wait for ISSUED
App returns 401 "Invalid Verified Access context"Wrong VerifiedAccess:InstanceArn configured, or clock skewCompare with the instance ARN; check the container's clock
context.jamf.risk never matchesDevice trust provider not attached, browser extension missing, or wrong policy reference nameAttach the provider; install the extension; use the reference name you chose
TCP endpoint unreachableConnectivity Client not installed or not configured with the client config fileExport the client configuration and install it on the device ⚠ VERIFY current client setup steps

Cost and cleanup

Item (checked 2026-11-18)PriceLab exposure
HTTP(S) application hoursUSD 0.27 per application per hour (partial hours billed as full hours); lower rate at very high volume1 app × 2 hours ≈ USD 0.54
Data processedUSD 0.02 per GBNegligible
Non-HTTP(S) endpoint hoursUSD 0.20 per endpoint per hour, with 100 free connections per endpoint per hour, then USD 0.001 per connection-hourNot used in the lab
Internal ALB from earlier labsAbout USD 0.0225 per hour + LCUs2 hours ≈ USD 0.05
ACM public certificateFree—
CloudWatch LogsStandard ingestion pricingCents

Deploy-and-destroy budget: under USD 1 if you tear down within two hours. Free alternative: do the design-only exercise below (write the Cedar policies, the trust-boundary diagram and the .NET verifier with its offline tests) without deploying anything.

PROFILE=learn-sandbox
# Delete in reverse order: endpoint -> group -> detach provider -> instance -> provider -> logs
aws ec2 delete-verified-access-endpoint --verified-access-endpoint-id vae-0123456789abcdef0 --profile $PROFILE
# wait until the endpoint is gone before deleting the group
aws ec2 describe-verified-access-endpoints --verified-access-group-id $GROUP_ID --profile $PROFILE
aws ec2 delete-verified-access-group --verified-access-group-id $GROUP_ID --profile $PROFILE
aws ec2 detach-verified-access-trust-provider --verified-access-instance-id $INST_ID \
  --verified-access-trust-provider-id $TP_ID --profile $PROFILE
aws ec2 delete-verified-access-instance --verified-access-instance-id $INST_ID --profile $PROFILE
aws ec2 delete-verified-access-trust-provider --verified-access-trust-provider-id $TP_ID --profile $PROFILE
aws logs delete-log-group --log-group-name /hl/m05/verified-access --profile $PROFILE

# CDK / Terraform users
cdk destroy --profile learn-sandbox   # or: terraform destroy

# Confirm nothing tagged for the lab remains
aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=cea-lab \
  --query "ResourceTagMappingList[].ResourceARN" --profile $PROFILE
aws ec2 describe-verified-access-instances --query "VerifiedAccessInstances[].VerifiedAccessInstanceId" --profile $PROFILE

Exercises

  • 🟢 Guided: Write group and endpoint Cedar policies for the Reconciliation dashboard: Harbourline staff with verified email, members of the Recon-Analysts group, and never from 203.0.113.0/24. Then run the VerifierTests and add a fourth test proving that a token with alg set to HS256 is rejected.
  • 🟡 Challenge: Extend the endpoint policy so that members of Recon-Analysts need a CrowdStrike overall assessment above 70, while members of Recon-Supervisors need above 50. Explain why you wrote it as two permit statements instead of one with ||.
  • 🔴 Live problem: Tuesday 09:10. Twelve operations staff in the Leeds office report 403s on Payments Exceptions since 08:30. Nobody changed the Verified Access policies. Investigate and decide what you would check, in what order, and how you'd communicate while you investigate.

Assignment

Produce a "zero-trust access design" for three Harbourline internal apps in your portfolio repository: a trust-boundary diagram (Mermaid), the Cedar policies for each group and endpoint in separate .cedar files, a table mapping each app to its data classification and required signals, the cost estimate, the break-glass procedure, and the VerifiedAccessTokenVerifier with passing tests.

Solutions

Knowledge check

Interview questions

  • "What does zero trust mean to you, practically?" — No implicit trust from network location; every access to every application is authenticated, authorised and logged using identity, device and context; least privilege; and assume breach, so segment and monitor. It's a programme of changes, not a product purchase.
  • "How would you replace a bank's VPN for internal web apps on AWS?" — Inventory apps; federate the corporate IdP; put each app behind Verified Access endpoints with Cedar policies using group IDs and device posture; lock origin security groups to the endpoint; verify the signed header in apps; migrate app by app; keep a tested break-glass path.
  • "Where does Verified Access stop and application authorisation start?" — Verified Access decides reachability per request. Business authorisation (amount limits, four-eyes approval, data-level access) remains in the application, using the verified identity from the signed header.
  • "What are the risks of device-posture checks?" — Signal outages or vendor changes can lock out staff; posture data is employee personal data; the unmanaged-device path must be designed; and posture is only as good as the device management estate.

Certification practice

Completion checklist

  • I can explain zero trust in two sentences without naming a product
  • I can draw the Verified Access components and say how group and endpoint policies combine
  • I wrote Cedar policies using group IDs, email verification and an IP forbid
  • My .NET verifier checks algorithm, signer, expiry and signature, and its tests pass
  • I either deployed and destroyed a Verified Access endpoint or completed the design-only alternative
  • I confirmed no Verified Access instance or tagged resource remains

Key takeaways

  • Zero trust removes network location as a trust signal: each request to each app is decided on identity, device and context, with least privilege and full logging.
  • AWS Verified Access implements this for workforce apps: instances, user/device trust providers, groups, endpoints and Cedar policies, where group and endpoint policies must allow and forbid always wins.
  • The app must verify the signed x-amzn-ava-user-context JWT (ES384, signer = your instance ARN) and must not be reachable by any other path.
  • Verified Access controls reachability, not business authorisation; keep in-app checks and four-eyes controls.
  • It is priced per application hour (about USD 0.27 per HTTP app-hour), so use it for sensitive, frequently used apps and keep a cheaper path, such as Session Manager, for rare admin access and break-glass.

Further reading

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page