Skip to content

ADR: Identity and the session token, explained

ADR: Identity and the session token, explained for a new developer

Status
accepted
Date
2026-09-03

The Operating Contract asks for a junior-developer record for any foundational configuration this project touches, and ADR: Accounts and per-user bids touched the composition root, the request pipeline and the database schema in one change. That record says what was decided. This one says what the words mean.

Read it beside api/TheYard.Api/Program.cs and api/TheYard.Api/Shared/Auth/Tokens.cs. The samples below are those files, read from this build.

In plain words

This page explains, for a developer new to ASP.NET Core, how the site knows who is calling it. Accounts and password hashes live in a library (ASP.NET Core Identity), and a signed proof of who you are (a token) travels in a cookie the page's scripts cannot read.

What that is worth: a developer can add a protected endpoint or a user field by following the page's own checklist, and the organization's sign-in code can be maintained by its newest hire, with the signing key kept out of the repository.

Context

Before this change the API had no idea who was calling it. There was one set of bids in memory, and "you are the high bidder" meant "the only person in the room is". Adding accounts meant answering four questions that a newcomer to ASP.NET Core will meet in that order:

  1. Where do usernames and password hashes live, and who writes that code?
  2. Once somebody proves who they are, how does the next request know?
  3. How does the server read that proof back without trusting the browser?
  4. How does an endpoint say "not for strangers"?

The answers are Identity, a signed token, a cookie the page cannot read, and RequireAuthorization(). Each gets a section.

1. What Identity is

ASP.NET Core Identity is two things wearing one name.

The first is a schema: seven tables, all prefixed AspNet, holding users, their password hashes, their roles, their external logins and their claims. You can see them created in api/TheYard.Infrastructure/Migrations/20260903084932_AccountsAndPerUserBids.cs. This project uses one of the seven. The other six are along for the ride because the store that manages the first one knows how to manage all of them.

The second is a service, UserManager<YardUser>, which is the only thing the endpoints actually call. It hashes passwords with PBKDF2 and a per-user salt, it normalises email addresses so that Steve@Example.com and steve@example.com cannot both register, and it enforces the password rules configured beside it. None of that is hard to describe and all of it is easy to get subtly wrong, which is the argument for not writing it here.

YardUser is the project's own user row. It inherits everything Identity needs and adds one column:

public sealed class YardUser : IdentityUser
{
    public long CreatedAtMs { get; set; }
}

That is the whole customisation. Inheriting from IdentityUser rather than copying its fields is what lets AddEntityFrameworkStores<YardDbContext> find the columns it expects.

AddIdentityCore versus AddIdentity

This distinction traps people, so here it is plainly.

AddIdentity<TUser, TRole>() registers the user store and Identity's own cookie authentication scheme, its sign-in manager, its redirect-to-login-page behaviour, and a set of cookies named .AspNetCore.Identity.Application. It is built for a server-rendered site with login pages.

AddIdentityCore<TUser>() registers the user store and stops. No authentication scheme, no redirects, no second cookie.

This API is a JSON service behind a React page, and it already has an authentication scheme, described in section 3. Calling AddIdentity here would install a second, competing one, and the symptom would be a 302 redirect to a login page that does not exist where a 401 was expected. AddIdentityCore is the one line that avoids all of that.

// The hour's allowance of new accounts, for the whole site (ADR: The one write
// a stranger can make). Configurable because the tests need to reach it, and
// because a number that cannot be changed without a deploy is a number nobody
// tunes.
services.AddSingleton(new RegistrationLimit(
    configuration.GetValue("Accounts:RegistrationsPerHour", RegistrationLimit.DefaultPerHour),
    () => DateTimeOffset.UtcNow));

// Identity is registered whether or not a store came up, because the store
// is now a per-request choice: the same UserManager serves the relational
// accounts on one request and the document accounts on the next, and a
// request on a backend that has no accounts is refused by the endpoint before
// it asks for one (ADR: One container, both stores).
services
    .AddIdentityCore<YardUser>(options =>
    {
        // Long over ornate. A length requirement is the only one of these
        // that measurably helps, and the rest mostly teach people to write
        // the password down (NIST 800-63B says so at more length).
        options.Password.RequiredLength = 8;
        options.Password.RequireNonAlphanumeric = false;
        options.Password.RequireUppercase = false;
        options.Password.RequireDigit = false;
        options.User.RequireUniqueEmail = true;
        // #region lockout
        // Five wrong passwords buys five minutes off.
        //
        // Without this, POST /api/auth/login
        // is an unmetered password oracle against real accounts: the endpoint
        // is public, there is no throttle in front of it, and every attempt
        // costs an attacker one request. Five and five is the usual shape and
        // the reason it works is arithmetic rather than strength: it turns
        // thousands of guesses a minute into twelve an hour, per account,
        // which is the difference between a wordlist finishing and not.
        //
        // The refusal after a lockout says the same sentence as a wrong
        // password, deliberately. A distinct "this account is locked" is a
        // reply that confirms the address is registered here, and the login
        // endpoint already goes out of its way not to be that
        // (ADR: A password guess should cost something).
        options.Lockout.MaxFailedAccessAttempts = 5;
        options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5);
        options.Lockout.AllowedForNewUsers = true;
        // #endregion lockout
    });
// #region user-store-per-request
// The store behind UserManager, chosen by the request: Identity's own tables
// on the relational backend, one document per account on the document one
// (ADR: Accounts on a document store), each registered under its store's key by the
// store's own registration, so the backend itself names no adapter (ADR: The onion cut
// into vertical slices, rule 4). One of the four scoped registrations in the
// application, and the reason the per-request context exists.
services.AddScoped<IUserStore<YardUser>>(services =>
    services.GetKeyedService<IUserStore<YardUser>>(services.GetRequiredService<CurrentBackend>().Key)
        ?? throw new InvalidOperationException("this request's store keeps no accounts; RequestAccounts answers null before this is reached"));

// The handlers take RequestAccounts rather than UserManager, because UserManager is built
// over the request's store, and a store that did not come up has no accounts to build it
// over. RequestAccounts asks first and answers null, so no handler meets the throw above.
services.AddScoped(services => new RequestAccounts(() =>
    services.GetRequiredService<CurrentBackend>().Backend.Ready
        ? services.GetRequiredService<UserManager<YardUser>>()
        : null));
// #endregion user-store-per-request
// #region account-handlers
// One handler per route (ADR: The onion cut into vertical slices, rule 7), each handed the
// request's accounts through the Identity adapter, or none where the request's store keeps
// no accounts, which every handler answers as unavailable.
services.AddScoped(provider => provider.GetRequiredService<RequestAccounts>().Users is { } users
    ? new AccountsOnThisStore(new IdentityAccountStore(users))
    : new AccountsOnThisStore(null));
services.AddSingleton<IResetTokens>(provider => new TokenResets(provider.GetRequiredService<TokenIssuer>()));
services.AddSingleton(provider => new ResetLinkMaker(provider.GetRequiredService<IResetTokens>(), provider.GetRequiredService<IResetLinks>()));
services.AddScoped(provider => new RegisterHandler(Store(provider), provider.GetRequiredService<RegistrationLimit>(), () => Clocks.UtcNow().ToUnixTimeMilliseconds()));
services.AddScoped(provider => new SignInHandler(Store(provider)));
services.AddScoped(provider => new SignOutHandler(Store(provider)));
services.AddScoped(provider => new WhoAmIHandler(Store(provider)));
services.AddScoped(provider => new OperatorResetLinkHandler(Store(provider), provider.GetRequiredService<ResetLinkMaker>()));
services.AddScoped(provider => new ForgotHandler(Store(provider), provider.GetRequiredService<IEmailSender>(), provider.GetRequiredService<ForgotLimit>(), provider.GetRequiredService<ResetLinkMaker>()));
services.AddScoped(provider => new ResetPasswordHandler(Store(provider), provider.GetRequiredService<IResetTokens>(), provider.GetRequiredService<IResetLinks>()));
// #endregion account-handlers
// What the JWT reader does with a token, per request and with its dependencies handed in
// (RefuseSession.cs): read it from the cookie, then refuse a session that has ended.
services.AddScoped<RefuseSession>();
services.AddScoped<SessionEvents>();

services
    .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =>
        // Resolved from the request's own services for each request, so the events are
        // handed the request's store and accounts by constructor.
        options.EventsType = typeof(SessionEvents));
// The token's signature and lifetime are checked against the session issuer's rules.
services.AddOptions<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme)
    .Configure<TokenIssuer>((options, tokens) => options.TokenValidationParameters = tokens.Validation);
services.AddAuthorization();

Live from api/TheYard.Api/Features/Accounts/Module.cs, region auth, read from this build at 99df7a8.

Why a scoped DbContext sits beside the factory

ADR: The relational store registered AddDbContextFactory<YardDbContext>, which hands out a fresh context on request rather than registering one. Everything in this application is a singleton and loads its data once, so a factory was the right shape.

Identity's Entity Framework store does not use a factory. It asks the container for a YardDbContext directly, once per request, because that is the pattern every ASP.NET Core sample uses. So the composition root adds one adapter between the two:

builder.Services.AddScoped(services =>
    services.GetRequiredService<IDbContextFactory<YardDbContext>>().CreateDbContext());

"Scoped" means one instance per HTTP request, disposed when the request ends. That matters because a DbContext is not thread-safe and holds a change tracker, so sharing one across requests would let two callers see each other's half-finished work. This registration is the only scoped one in the application, and the comment above it in Program.cs says why it exists so that nobody deletes it as an oddity.

2. What signing a token means

A JWT is three base64 chunks joined by dots: a header saying which algorithm was used, a payload of claims, and a signature. Two things about it surprise people.

It is not encrypted. Anyone holding the token can read the claims. Paste one into any JWT decoder and the email address is right there. That is why Issue puts the account id and the email in it and nothing else: everything in the payload is disclosed to whoever gets hold of it, and everything else the application needs it can look up.

The signature is what makes it trustworthy. HMAC-SHA256 takes the header, the payload and a secret key, and produces a fixed-length value. Change one character of the payload and the value no longer matches. Since only the server knows the key, only the server can produce a signature that validates, so a token that validates is one this server issued. Forging one means guessing 32 random bytes.

/// <summary>
/// The claims are the user's id, the name to greet them by, the store the
/// account lives in, and a fingerprint of its security stamp, and nothing else. A token is sent on every
/// request and is readable by anyone holding it, so anything in here is
/// both bandwidth and disclosure; everything the application needs beyond
/// identity it can look up.
/// </summary>
public string Issue(string userId, string email, string store, string? securityStamp) => Issue(userId, email, store, securityStamp, _lifetime);

/// <summary>The same token with a lifetime of the caller's choosing; the tests use it to make a token that is already a few days old.</summary>
public string Issue(string userId, string email, string store, string? securityStamp, TimeSpan lifetime) =>
    IssueWithFingerprint(userId, email, store, Fingerprint(securityStamp), lifetime);

/// <summary>
/// The same token from a stamp fingerprint already in hand: what a renewal re-issues, since
/// the request carries the fingerprint and not the stamp.
/// </summary>
public string IssueWithFingerprint(string userId, string email, string store, string stampFingerprint, TimeSpan lifetime)
{
    return Handler.CreateToken(new SecurityTokenDescriptor
    {
        Issuer = Issuer,
        Audience = Audience,
        Subject = new ClaimsIdentity(
        [
            new Claim(ClaimTypes.NameIdentifier, userId),
            new Claim(ClaimTypes.Name, email),
            new Claim(StoreClaim, store),
            new Claim(StampClaim, stampFingerprint),
        ]),
        Expires = DateTime.UtcNow.Add(lifetime),
        SigningCredentials = _credentials,
    });
}

// #region reset-tokens
/// <summary>
/// A password reset link's token: the same signature as a session, a
/// different audience so the session pipeline refuses it, an hour of
/// life, and a fingerprint of the password hash it was minted against so
/// it dies the moment the password changes (ADR: Accounts and per-user
/// bids, addendum). No table of tokens to keep, no token provider that
/// needs a key ring the container does not have.
/// </summary>
private const string ResetAudience = "theyard-reset";
public static readonly TimeSpan ResetLifetime = TimeSpan.FromHours(1);

public string IssueReset(string userId, string store, string? passwordHash)
{
    return Handler.CreateToken(new SecurityTokenDescriptor
    {
        Issuer = Issuer,
        Audience = ResetAudience,
        Subject = new ClaimsIdentity(
        [
            new Claim(ClaimTypes.NameIdentifier, userId),
            new Claim(StoreClaim, store),
            new Claim("fingerprint", Fingerprint(passwordHash)),
        ]),
        Expires = DateTime.UtcNow.Add(ResetLifetime),
        SigningCredentials = _credentials,
    });
}

/// <summary>The claims of a valid, unexpired reset token, or null for anything else, a session token included.</summary>
public async Task<(string UserId, string Store, string Fingerprint)?> ReadResetAsync(string? token)
{
    if (string.IsNullOrWhiteSpace(token))
    {
        return null;
    }

    var parameters = Validation.Clone();
    parameters.ValidAudience = ResetAudience;
    var result = await Handler.ValidateTokenAsync(token, parameters);
    if (!result.IsValid)
    {
        return null;
    }

    // The handler writes the long claim type as its short name and, on
    // its own, reads it back short; the bearer pipeline maps it long. Both
    // spellings are read so this does not depend on which handler minted it.
    string? id = (result.ClaimsIdentity.FindFirst(ClaimTypes.NameIdentifier) ?? result.ClaimsIdentity.FindFirst("nameid"))?.Value;
    string? store = result.ClaimsIdentity.FindFirst(StoreClaim)?.Value;
    string? fingerprint = result.ClaimsIdentity.FindFirst("fingerprint")?.Value;
    return id is null || store is null || fingerprint is null ? null : (id, store, fingerprint);
}

/// <summary>Sixteen hex characters of the password hash's SHA-256; the hash itself never leaves the store.</summary>
public static string Fingerprint(string? passwordHash) =>
    Convert.ToHexStringLower(System.Security.Cryptography.SHA256.HashData(Encoding.UTF8.GetBytes(passwordHash ?? "")).AsSpan(0, 8));
// #endregion reset-tokens

/// <summary>
/// The session cookie's options: HttpOnly, and Secure when the browser reached
/// us over TLS. Behind the edge this process is spoken to over plain HTTP; the
/// forwarded-headers middleware reads X-Forwarded-Proto from the proxies it
/// trusts and sets the request's scheme, so `IsHttps` is true on a request that
/// was HTTPS the whole way to the visitor (ADR: The order of the request pipeline).
/// Until then this read the header itself (ADR: Edge deploy economics).
/// </summary>
/// <param name="context">The request the cookie answers.</param>
/// <param name="lifetime">How long the cookie lives.</param>
public static CookieOptions CookieFor(HttpContext context, TimeSpan lifetime) => new()
{
    HttpOnly = true,
    Secure = context.Request.IsHttps,
    SameSite = SameSiteMode.Lax,
    Path = "/",
    MaxAge = lifetime,
};

Live from api/TheYard.Api/Shared/Auth/Tokens.cs, region issue, read from this build at 99df7a8.

ClockSkew deserves a note. The library defaults to five minutes of slack on expiry, which is a sensible allowance when two different servers with two different clocks are involved. Here one process both issues and validates the token, so five minutes of extra life is slack with no purpose behind it. Thirty seconds is the setting.

Where the key comes from

Auth:SigningKey is configuration: an environment variable in the container, a user secret locally, a secret store in a real deployment. When it is absent the process generates 32 random bytes and logs that it did.

That behaviour is deliberate and its cost is stated out loud: a restart with no configured key signs everybody out, because the new process cannot validate tokens the old one signed. The alternative a repository must never take is a committed default. A signing key in source control is every session forever for anyone who can read the repository, and it stays true after the file is deleted because git keeps history.

The token proves who you are. Whoever holds it is you, which is the property that makes bearer tokens convenient and also the one that makes them dangerous.

The common alternative is localStorage: the page keeps the token in a variable and sets an Authorization header on each request. That works, and it means every script running on the page can read the token. Any injected script, any compromised dependency, any browser extension with page access can take it and use it from anywhere.

HttpOnly = true tells the browser to withhold the cookie from JavaScript entirely. document.cookie does not show it. The page never has the token, so the page cannot leak it, and the client code gets shorter rather than longer: src/api/auth.ts never touches a token at all.

The other attributes each earn their place:

  • SameSite = Lax stops the cookie from riding along on a cross-site POST, which is the shape a CSRF attack takes. Lax rather than Strict so that arriving from an external link still finds you signed in.
  • Secure tells the browser to send the cookie over HTTPS only. It is computed rather than hardcoded, because behind the edge this process is spoken to over plain HTTP even when the visitor's connection was HTTPS the whole way. X-Forwarded-Proto is the header that carries that fact across the hop, and ADR: Edge economics explains the hop.
  • Path = "/" so one cookie covers the API and the page. Deleting a cookie means re-sending it with the same path and same-site attributes, which is why the logout endpoint calls the same CookieFor helper the login endpoint does. Get that wrong and the browser keeps a second cookie of the same name on a different path, and the user stays signed in after signing out.

4. How the server reads it back

AddJwtBearer expects the token in an Authorization: Bearer ... header. This project puts it in a cookie, so one event hook redirects the lookup:

options.Events = new JwtBearerEvents
{
    OnMessageReceived = context =>
    {
        if (context.Request.Cookies.TryGetValue(TokenIssuer.CookieName, out string? cookie))
        {
            context.Token = cookie;
        }
        return Task.CompletedTask;
    },
};

OnMessageReceived runs before validation and its job is to answer "where is the token". Setting context.Token says: here, use this. Everything after that point is the normal path, signature check included, so nothing about validation has been weakened by moving where the token was found.

Two lines in the pipeline finish the job:

app.UseAuthentication();
app.UseAuthorization();

Order matters and the names are easy to blur. Authentication is "who are you": it reads the token and builds HttpContext.User. Authorization is "may you": it checks that principal against whatever the endpoint requires. Authentication has to run first, because authorization cannot check a principal nobody built yet. Put these two after the endpoints and every request arrives anonymous.

Both run on every request, including the ones that do not require an account. That is on purpose. A signed-in visitor loading the listing gets a populated HttpContext.User, which is how GET /api/bids knows whose badges to draw without a separate request.

5. What RequireAuthorization does

.RequireAuthorization() attaches metadata to one endpoint saying a principal is required. The authorization middleware reads that metadata and, finding no authenticated user, ends the request with 401 before the handler runs.

Four endpoints carry it: placing a bid, buying now, clearing your bids, and the bid history. Reading stays open, so an anonymous visitor still watches the auction and cannot bid in it.

// Register, sign in, sign out, and who am I. The token never reaches the page:
// it is set as an httpOnly cookie on the way out and read from the cookie on the
// way back in, so a script on the page cannot read it and cannot be tricked into
// sending it somewhere else (ADR: Accounts and per-user bids).
app.MapPost("/api/auth/register", Register)
    .WithName("Register")
    .WithTags("Accounts")
    .WithSummary("Create an account on this store and sign in")
    .WithDescription("Answers the account and sets the session cookie. A few dozen registrations an hour are allowed "
        + "across all strangers, and a refused password gives the slot back.")
    .ProducesProblem(StatusCodes.Status400BadRequest)
    .ProducesProblem(StatusCodes.Status429TooManyRequests)
    .ProducesProblem(StatusCodes.Status503ServiceUnavailable);

app.MapPost("/api/auth/login", Login)
    .WithName("Login")
    .WithTags("Accounts")
    .WithSummary("Sign in and receive the session cookie")
    .WithDescription("One sentence for every way this can fail, including a locked account, so the reply never says "
        + "which addresses are registered here. Five wrong passwords lock an account for five minutes.")
    .ProducesProblem(StatusCodes.Status400BadRequest)
    .ProducesProblem(StatusCodes.Status401Unauthorized)
    .ProducesProblem(StatusCodes.Status503ServiceUnavailable);

// #region password-reset
// A password reset in two halves (ADR: Accounts and per-user bids, addendum).

// The operator mints a link from the Admin tab, behind the key, for an
// address on this site's store: an hour of life, one use, because the token
// carries a fingerprint of the password hash it was minted against and the
// hash changes when the password does. The visitor opens the link, chooses a
// new password, and is signed in. The same second half will serve an emailed
// link when there is a sender to send it; only who hands the link over
// changes.
app.MapPost("/api/admin/reset-links", OperatorResetLink)
    .WithName("OperatorResetLink")
    .WithTags("Accounts")
    .Produces(StatusCodes.Status200OK)
    .ProducesProblem(StatusCodes.Status404NotFound)
    .ProducesProblem(StatusCodes.Status503ServiceUnavailable);

// "Forgot password": the same link, sent by the site instead of handed over
// by the operator. Public, so it answers one sentence whether or not the
// address has an account here, and one email per address per five minutes.
// Without a sender configured it says so and points at the operator.
app.MapPost("/api/auth/forgot", Forgot)
    .WithName("ForgotPassword")
    .WithTags("Accounts")
    .WithSummary("Email a reset link to an address")
    .WithDescription("One sentence back whether or not the address has an account here, and one email per address "
        + "per five minutes. A container with no sender configured says so.")
    .ProducesProblem(StatusCodes.Status400BadRequest)
    .ProducesProblem(StatusCodes.Status503ServiceUnavailable);

app.MapPost("/api/auth/reset", Reset)
    .WithName("ResetPassword")
    .WithTags("Accounts")
    .WithSummary("Use a reset link to choose a new password and sign in")
    .WithDescription("The link works once, for an hour, on the site it was minted for. A refused password leaves the "
        + "old one in place.")
    .ProducesProblem(StatusCodes.Status400BadRequest)
    .ProducesProblem(StatusCodes.Status503ServiceUnavailable);
// #endregion password-reset

app.MapPost("/api/auth/logout", Logout)
    .WithName("Logout")
    .WithTags("Accounts")
    .WithSummary("Sign out")
    .WithDescription("Deletes the session cookie and answers the anonymous account. Never fails.");

app.MapGet("/api/auth/me", WhoAmI)
    .WithName("WhoAmI")
    .WithTags("Accounts")
    .WithSummary("Who the session belongs to on this store")
    .WithDescription("Signed out is an answer, not a 401: a session opened on the other store reads as signed out here.");

Live from api/TheYard.Api/Features/Accounts/AccountEndpoints.cs, region auth-endpoints, read from this build at 99df7a8.

Inside an endpoint that requires it, http.UserId() reads the account id from the validated claims:

/// <summary>
/// The caller's account id on an endpoint that required one. Throwing here
/// would mean authorization let through a token with no subject, which is
/// not a case to handle gracefully; it is a case to find out about.
/// </summary>
public static string UserId(this HttpContext context) =>
    context.User.FindFirstValue(ClaimTypes.NameIdentifier)
    ?? throw new InvalidOperationException("An authorized request carried no account id");

/// <summary>The caller's account id, or null where signing in is optional.</summary>
public static string? UserIdOrNull(this HttpContext context) =>
    context.User.FindFirstValue(ClaimTypes.NameIdentifier);

Live from api/TheYard.Api/Shared/Auth/Tokens.cs, region who, read from this build at 99df7a8.

It throws rather than returning null. Reaching that line with no id would mean authorization admitted a token with no subject, and a graceful fallback there hides a broken pipeline behind a working-looking page. UserIdOrNull() is the sibling for endpoints where signing in is optional.

What to change when

  • A new endpoint that changes something: .RequireAuthorization() on the map call, HttpContext in the parameter list, http.UserId() for the owner. A test in api/TheYard.Tests/AuthTests.cs should assert it answers 401 to a caller with no cookie, because that is the assertion that fails when somebody copies the endpoint above it and forgets the attribute.
  • A new field on the user: add the property to YardUser, then dotnet ef migrations add <Name> --project api/TheYard.Infrastructure --startup-project api/TheYard.Api. The startup project argument is required and ADR: The relational store explains why.
  • A password rule: the options block inside AddIdentityCore. Length is the requirement with evidence behind it; the composition rules mostly teach people to write the password down, and NIST 800-63B says so at more length.
  • The token's contents: TokenIssuer.Issue. Remember that every claim is readable by anyone holding the token and is sent on every request.
  • A real deployment: set Auth__SigningKey in the container's environment from a secret store. Nothing else changes, and nothing about the key ever enters the repository.

Where it sits

This walkthrough covers host Api code, AddIdentityCore in Composition/AuthRegistration.cs and TokenIssuer in Tokens.cs, plus YardUser and the Identity tables in Infrastructure. Choosing AddIdentityCore over AddIdentity keeps the host small: the JSON API takes the user store it needs and leaves out a cookie scheme and login redirects it would have to fight. A missing Auth:SigningKey costs a sign-out for everyone on restart, which the deploy now avoids by passing one key to both sites. A system that had to revoke a session mid-flight would choose server-side sessions over a self-contained token.

Files

Addendum, 2026-10-03: a second scoped registration

This registration is no longer the only scoped one. RequestAccounts (api/TheYard.Api/Features/Accounts/RequestAccounts.cs) is registered per request beside it in Composition/AuthRegistration.cs, so the account handlers take it as a parameter instead of reaching into the service container. It asks whether the request's store came up before it opens UserManager, which means no handler ever meets the throw in the user store factory.

Enforced by

Not machine-checked. Held by review.

Store

The Yard, home

Steven StoutStaff .NET engineerRemote

Production .NET that stays up. Built with AI, measured on every version.

Steven Stout

Hi, I'm Steve. I build the systems that make delivery boring in the best way, then coach people inside them.

  • 200+

    production releases, none took the platform down

    Conway Investment Research, 2019 to 2024. Sole engineer for the first three years on a live financial advisory platform.

    See how
  • 50%

    shorter release cycle

    Storee Construction, 2024 to 2026. Four ASP.NET applications onto one .NET 10 platform on Azure, with a four-person team I hired and mentored.

    See how

01Verified

Steven Stout

A real person, and the work is mine.

  • Identity

    Checked by LinkedIn, not by me.

    LinkedIn verified my government ID.

  • Running system

    You are looking at it.

    Version 1.0.5.273 is live. Nothing ships unless it passes the automated gates first.

That's who I am. Here's how I work.

02Strengths

Ten strengths, each with the proof beside it. The numbers match my resume and LinkedIn, and the live ones are read from this site as you look.

  • 01

    Keeps production alive

    200+ releases on a live financial platform, and none took it down. Sole engineer for the first three years.

    See the Conway work

  • 02

    Simplifies messy systems

    Four ASP.NET applications onto one .NET 10 platform on Azure, and a release cycle 50% shorter.

    See the Storee work

  • 03

    Marries dev and infrastructure

    Blue-green releases at Storee that flipped in about 5 seconds with nobody signed out, and Azure Front Door at two employers.

    See this site's cloud

  • 04

    Designs data that holds up

    White-label clients on one shared database, the isolation built into the data, and no cross-client issues.

    See the Conway work

  • 05

    Keeps AI-written code honest

    15 quality numbers that may only improve: 273 releases in a row with none worse.

    See the quality numbers

  • 06

    Resourceful

    $30,000+ cut from Azure and vendor spend at Conway. This site's Azure bill is public, resource by resource.

    See the bill

  • 07

    Builds people up

    Hired and mentored a four-person team. 13 colleagues recommend me by name.

    Read the recommendations

  • 08

    Takes ideas to production

    This site: designed, built and run solo, with 352 versions measured through one gate.

    How it was built

  • 09

    Writes clearly

    Posts on real engineering problems, in plain words.

    Read the blog

  • 10

    Owns decisions

    153 decision records, each with its tradeoff and the call I made.

    See the decision records

Built with AI. Gated so quality never slides.

Steven Stout’s showcase: a used-vehicle auction on .NET and React, built and run by one engineer, live on Azure, with its decisions written down.

No quality number has gotten worse at any release since 1.0.5.1 on 10 November: 273 releases in a row.

One engineer, an AI agent and a gate that checks 15 quality numbers on every release. 352 versions measured, with every result public, the worst days included.

82 releases in the last 7 days, each through the same gate.

Async methods with no CancellationToken, may only fall

11091.0.3.1391.0.5.2731.0.4.115, the ratchet
Every number, on the Quality page

TheYard, right nowLive

Answering in

unread

02505007501,000

server time at p95, the usual five minutes of the last day.

Azure this month

unread

the bill, by resource, read from Azure. The Admin tab shows every line.

Since the last roll

unread

 

rolled in place by the pipeline, behind one gate.

People who have visited

unread

30 days agotoday

Scanners, my own tools' and my own reads left out.

03Start here

04Where teams are heading

How I see engineering with AI, and the setup on this site that backs it.

AI-augmented teams · Architecture and ownership

AI writes more of the code. Someone still has to own what ships.

Teams are going to be heavily AI-augmented. That moves the senior job toward architecture and technical ownership: deciding what to build in pieces small enough to verify, and owning what ships.

  • Task tracking will get automated too. Judgment stays human: seeing a design fail at scale before it does.
  • On this site the AI's first design held the whole catalogue in memory. I caught it when the App Service plan hit 82 per cent and moved the work to the store.

What the AI wrote, what I decided

07Tech stack

  •    
  •    
  •    

Read from the build, never typed by hand

What TheYard runs on

What we use, where it runs, its AWS twin, the version as built, and the file that proves it.

Cloud patterns, not one vendor: every Azure piece in this stack has a named AWS twin. Mapped, not yet run on AWS.

  • .NET 1114 projects
  • React 19.3TypeScript 7.0
  • Azure9 Bicep files
  • 11GitHub Actions workflows
The whole stack, with the file that proves each line

The last release the gate stopped was 1.0.5.258 on 2 December, at its browser 1 of 2 job.

08How it is built

09How it is run

10Who and why

Next step

11What has to work, where is it today, and what does success look like?

Book 20 minutes opens an email to me with those three questions in it, and I answer with a time.

Book 20 minutes

Your email app should have opened with this message. If it did not, copy it and send it from any mailbox.

Or message me on LinkedIn