← All courses
Architecture · Free course

Security & Auth Patterns

Every request to a Wisej.NET application carries more than one identity: the principal the host authenticated, the application principal your sign-in established, and the Windows token the process uses to open files. None of them is a permission. This course keeps the three apart and puts one server-side resource policy, checking grant, tenant and record, in front of every read. You build AccessOps, an operations portal with an intranet route for staff and a public route for partners. Module by module you add Windows integrated authentication on IIS and learn to tell a host failure from an application deny, open a confidential file inside one bounded impersonation scope and prove the token reverts, own a sign-in transaction that rotates the session ID and revokes a grant across every open tab, federate partners through OpenID Connect with the ASP.NET Core handlers, and add passkeys with the Wisej.NET WebAuthn extension, validating every assertion on the server. The capstone runs a 12-case evidence matrix against the cumulative portal, rehearses a rollback and presents the result against a security review checklist. Each module ends with a hands-on lab, a knowledge check and an AI coding exercise, and the complete AccessOps solutions are on GitHub. The course targets Wisej.NET 4.1.7 and says plainly which results need IIS and a Windows domain.

Protect a Wisej.NET application with Windows authentication on IIS, scoped impersonation, a custom sign-in, OpenID Connect federation and passkeys, behind one server-side resource policy.

Start this free course

Also available in: DeutschFrançaisItalianoEspañol

Curriculum

Module 1: Identity Boundaries in Wisej.NET

Module 1 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the identity boundaries walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    The three identities of a Wisej.NET request — host principal, application principal and effective Windows token — Application.User and the session lifecycle, and a resource-level deny at the service boundary that survives role revocation. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonTrace the three identities behind an AccessOps request · 14 min

    Trace the three identities behind an AccessOps request — a guided Module 1 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Security and Auth Patterns, Module one. Behind the AccessOps Documents screen, each request carries three separate identities, and none of them, on its own, is a permission.

    Take one request apart. The host principal is whoever I I S or Kestrel authenticated. The application principal is the account your sign-in established, with its tenant and grant. The effective token is what the file system checks, usually the application pool. A nightly job has no request at all.

    Reading the Application User property is a two-step lookup. A principal your sign-in assigned in this session wins; otherwise you get the host principal from the request. IsAuthenticated only means somebody signed in. And UserIdentity exists only in the .NET Framework build.

    Each step of a session raises its own event: start, refresh, timeout and exit. Rotating the session ID from a click leaves the browser holding the old one, so it belongs on a page load. StartTask restores the session for background work, while a plain pool thread gets nothing.

    On the left, the export handler checks a role and trusts the tenant the browser chose, so another tenant's record seventeen comes back. On the right, the service reads the grant as it stands now, refuses a revoked one, compares tenants, and only then lets the repository read.

    The sign-in click only verifies the account, parks it in the session, and reloads. On that load, the refresh handler rotates the session ID first and sets the principal second. A queued export cannot see the session, so it receives the subject as data and is checked again.

    Here is the debug-only diagnostics view in two browser profiles. The signed-in Reader shows the portal principal; the other profile falls back to an anonymous host principal. Both run as the same developer process account. The matrix logs each request, its session, the operation and the outcome.

    Now prove the denies with a number. Opening record seventeen in tenant A is allowed, and the read counter goes to one. Switching to tenant B is denied. Then an administrator revokes the grant from another session, and Export on the still-open screen is denied too. The counter stays at one.

    Your lab delivers tenant fixtures with a read-counting repository, the service gate, a diagnostics view that never ships in the release, the four-column identity matrix, and a policy harness run where both denies finish without a single repository read.

    Three identities, kept apart, and one decision made on the server before any data is read.

  4. Knowledge checkModule 1 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — AccessOps Identity Matrix · 45 min

    Objective: Create the AccessOps solution with tenants A and B each holding record 17 with distinct contents, a Reader account in tenant A and an unassigned account. Build a DocumentService that checks the current grant, tenant and record before calling a repository that counts its reads, establish the session principal from a trusted test verifier with ApplicationPrincipal, and add a diagnostics view (kept off public routes and removed before packaging) that shows the authentication type, the authenticated flag, a redacted subject and the effective OS identity. Trace startup, a click, a browser refresh and a background job in two browser profiles, request tenant B's record 17 as tenant A's Reader, revoke the Reader grant between page load and Export on an already open screen, and run the self-contained PolicyHarness to show the same allow and deny decisions without Wisej, IIS or an identity provider. Deliverables: AccessOps solution with tenant A and B fixtures and a read-counting repository; DocumentService resource gate with grant, tenant and record checks; Identity diagnostics view, removed from the packaged build; Four-column identity matrix for request, session, operation and outcome; PolicyHarness run with one allowed read and two denies at zero repository calls.

Module 2: IIS and Browser Integrated Authentication

Module 2 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the IIS Windows sign-in walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    Choosing the IIS site boundary, Windows Authentication providers and challenge order, browser negotiation and intranet policy, SPNs, Kerberos evidence, extended protection and proxies, and diagnosing a failure by layer. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonPut the AccessOps intranet route behind Windows sign-in · 14 min

    Put the AccessOps intranet route behind Windows sign-in — a guided Module 2 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module two puts the AccessOps staff screens behind Windows sign-in on I I S, and teaches you to tell a host failure from your own application's deny.

    Start by splitting the doors. Staff arrive through their own I I S application, where Windows authentication is on and anonymous access is off. Partners use a separate application, because the browser must reach the sign-in page and the callback before anyone has signed in. Behind both doors, the same document service still makes the decision.

    Watch the handshake. The first request comes back as four oh one, offering Negotiate. Edge retries with an authorization header, and the Windows user reaches the application. Seeing Negotiate proves nothing about Kerberos, though. Only a client ticket for the service name plus a matching server logon record does. Without both, write undetermined.

    The configuration is scoped to the lab application alone: anonymous off, Windows on in kernel mode, Negotiate first, then N T L M. Silent sign-in still depends on a single S P N owner, extended protection, the browser's intranet policy, and proxy affinity. A five hundred point nineteen error means a locked section, not a code bug.

    On .NET 10 there is no UserIdentity, so Program Main reads the Application User property and checks that it holds a Windows identity. If not, it shows a host fault page. Otherwise the account looks up its grant. When the Open click asks the service, a missing Reader grant throws before the repository runs.

    In the lab domain, the first reader passes the challenge and opens record seventeen. The trace keeps just the scheme and status codes, and one repository read is counted.

    Now a second domain account, without the Reader grant. Windows sign-in succeeds exactly the same way, yet the service refuses the record with zero reads. That is an application deny.

    When something breaks, work through the layers. A four oh one before Program Main is the host: check the I I S log, the S P N and browser policy. A five hundred point nineteen is a configuration lock. A refused read after a valid sign-in is your service. A failing file share is the second hop, covered in Module three.

    For Lab two, you publish the intranet route, capture a redacted challenge trace, and either prove the provider or record it as undetermined. You also record the application deny, write a layered diagnosis, and put the original I I S settings back.

  4. Knowledge checkModule 2 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — Windows Sign-In on IIS · 45 min

    Objective: Publish the AccessOps intranet route to an isolated HTTPS IIS application with a dedicated application pool, record the binding, target framework and authentication state, then apply the scoped windows-auth location settings to enable Windows Authentication and disable Anonymous. From a domain client, open the canonical FQDN as CONTOSO\reader1, record the challenge scheme, the follow-up outcome and the redacted application identity, query the HTTP SPN and compare the client ticket with server logon evidence, then sign in as a second account without Reader and capture an application deny after successful host authentication before restoring the original settings. The challenge, the negotiated provider and the SPN evidence can only be verified in the lab environment with IIS and a Windows domain (a workgroup shows challenges but cannot claim Kerberos, so record an undetermined result there); on a plain developer machine the PolicyHarness proves locally that an authenticated identity without the Reader grant is still denied with zero repository reads. Deliverables: Effective IIS authentication settings for the intranet and public routes; Redacted challenge trace with scheme, status and follow-up outcome; SPN and ticket evidence or an explicit undetermined-provider result; Host-authenticated user denied by the AccessOps policy, with a PolicyHarness case for the same rule; Layered diagnosis note separating IIS failure from application deny, with the rollback settings.

Module 3: Windows Impersonation and Delegation

Module 3 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the scoped impersonation walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    Request identity versus effective token, scoped impersonation on .NET Framework and with WindowsIdentity.RunImpersonated on ASP.NET Core, the Wisej.NET impersonate setting and its ImpersonationBegin and ImpersonationEnd hooks, token reversion, and the Kerberos second hop. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonOpen a confidential AccessOps file as the signed-in user · 14 min

    Open a confidential AccessOps file as the signed-in user — a guided Module 3 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module three treats impersonation as a short scope, not a setting you leave on. AccessOps opens one approved file with the user's Windows token, and a folder permission proves it.

    Keep three facts apart. The application subject is the account and grant AccessOps decided on. The request identity is the Windows user I I S attached. The effective token is what Windows checks when the file opens, normally the pool. Two fixture folders, one readable only by the pool and one only by the user, prove which token was used.

    The impersonate setting in the Wisej.NET configuration raises two process-wide events around every request thread and every StartTask task, and ImpersonationBegin fires before ThreadBegin. On .NET Framework, the begin event impersonates the user unless a handler marks it handled. On .NET 10 the same events fire, but the thread keeps the pool token.

    So on .NET 10 the read builds its own scope. The reader takes only a document number from the browser, confirms a Windows user, lets the policy decide, and resolves the approved path on the server. It records the current identity, reads inside RunImpersonated, and records it again in a finally block. Never take a path from the screen, or keep a token.

    Here it runs in the lab. Before the scope, the pool token cannot read the user's folder. Inside it, the user's token reads eighteen kilobytes, and afterwards the pool is back. Fixture F three forces a missing file inside the scope: the exception is caught, and the after row still shows the pool. A document outside the grant is refused before any scope opens.

    Fixture F four reads locally but fails on the remote file share. That is the second hop, so do not touch the impersonation code yet. Check the first hop has a Kerberos ticket, because N T L M cannot be delegated. Check constrained delegation to the exact target. Check the backend permission last. Then choose delegated access or a restricted service identity.

    Be honest about where each proof can run. Token flips, the reversion trace, the impersonate comparison and the second hop need I I S, Windows authentication and real domain accounts. The policy harness runs on any developer machine and proves the six grant decisions, but it says nothing about tokens, folder permissions or delegation.

    Lab three asks for the scoped document reader, an identity matrix covering all three identities before, inside and after the scope, the forced-failure reversion trace, the impersonate comparison on .NET Framework over H T T P and WebSocket, and your classified second-hop decision.

    Keep the identities apart, open one file in one short scope, and let the server's decision always come first.

  4. Knowledge checkModule 3 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — Scoped Impersonation and the Second Hop · 45 min

    Objective: Add a confidential-documents reader to AccessOps with two folders, one readable only by the application pool and one only by a named domain lab user, and a ScopedDocumentReader built from the WindowsScopedRead (ASP.NET Core) or Net48ScopedRead (.NET Framework) helper that opens a file chosen by server-side ID. Record the app subject, request identity and effective identity before, inside and after the scoped read, force an exception on a missing approved fixture and show the ordinary identity resumes, compare the Wisej.NET impersonate setting off and on for a click and an Application.StartTask in HTTP and WebSocket modes on .NET Framework, and, where a second server exists, classify a remote SMB or SQL integrated failure by first hop, delegation and backend authorization. Impersonated reads, ACL outcomes and the second hop are verified only in the lab environment with IIS Windows Authentication and domain accounts; on a developer machine the PolicyHarness proves the application decision that must allow the read before any impersonation scope opens. Deliverables: ScopedDocumentReader with a server-resolved canonical path; Before, inside and after identity and outcome matrix; Forced-failure reversion trace; Impersonate setting and StartTask comparison across HTTP and WebSocket; Second-hop classification and migration decision for the remote resource.

Module 4: Custom Sign In and Session Security

Module 4 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the partner sign-in walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    Owning the sign-in transaction, establishing the application principal and rotating the session ID, issuing host cookies only over HTTP, logout as revocation of a server-side grant, and closing request forgery, WebSocket origin and redirect paths. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonBuild the AccessOps partner sign-in and revoke it everywhere · 14 min

    Build the AccessOps partner sign-in and revoke it everywhere — a guided Module 4 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module four moves to the public partner route. There is no Windows challenge here, so AccessOps runs the whole sign-in, and signing out has to hold in every open tab.

    Treat sign-in as a transaction on the server. First the throttle, then the password check, then the account and its tenant, then a revocable grant with an expiry, and only at the end the principal. If any step fails, the user sees the same single sentence, while the real reason goes to the audit table.

    On Wisej.NET 4.1.7, rotating the session ID inside a click goes wrong. The server switches, but the browser keeps sending the old ID, starts a new session, and the sign-in is lost. So the click verifies, parks the result and reloads the tab. On that page load, the refresh handler rotates the ID and then establishes the principal.

    Here is the login service. The throttle runs before anything else. An unknown name is still checked against a dummy credential, so it costs the same time as a real one. A disabled account or an unapproved tenant is refused. Then an eight-hour grant is created, the result is parked, and the tab reloads.

    Cookies need response headers, and a WebSocket frame has none. So a click can never set an H T T P only cookie. Instead, a separate secure endpoint, mapped ahead of Wisej.NET, redeems a single-use handle and signs in with the cookie scheme. Wisej.NET keeps its own session ID in the tab's session storage, which is not your authentication cookie.

    The startup file holds everything that needs headers. The cookie scheme is H T T P only, always secure and strictly same-site, and it rechecks the grant on each host request. A state-changing sign-out post validates antiforgery, an upgrade from a foreign origin is refused, and the return address must be a local path.

    Now it runs. A wrong password, then a disabled account: both get the identical message, and the audit trace records which one it was. With the right password, the tab reloads, the session ID changes, and the documents console replaces the login view.

    Two profiles are open. Signing out in the first revokes the grant on the server. The second tab still shows Export, yet its click is denied with zero repository reads. A forged sign-out post, a foreign origin, and an outside return address all fail as well.

    Lab four collects the throttled login with generic failures, rotation on the page load, the cookie endpoint, a grant store enforced across tabs, and the tested state chart.

  4. Knowledge checkModule 4 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — Partner Sign-In and Grant Revocation · 45 min

    Objective: Give the AccessOps partner route its own sign-in: a login view on the anonymous public route that verifies a fixture identity through a supported verifier or a training mock that never ships, rejects a bad credential and a disabled account with the same generic message, resolves the local account and tenant, establishes the principal with ApplicationPrincipal and rotates the session ID. Back it with a GrantStore of opaque, expiring, revocable login grants that the export service checks before every read, add an HTTPS sign-in and sign-out endpoint for the host cookie, then open two browser profiles, revoke the grant with the second tab open and retry the export in both tabs and after a refresh, and test a forged post, an off-origin WebSocket upgrade and an external continuation URL. Deliverables: Login view with generic failures, throttling and disabled-account handling; Principal establishment with session ID rotation; HTTPS cookie endpoint with redacted Set-Cookie attributes; GrantStore with revocation enforced across open tabs; Auth-state transition chart and forged post, wrong origin and continuation URL tests.

Module 5: Federation with OpenID Connect

Module 5 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the partner federation walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    OAuth versus OpenID Connect, the authorization code flow with PKCE through the ASP.NET Core cookie and OpenID Connect handlers registered in Startup.cs before app.UseWisej(), token validation, issuer and subject account mapping into the Wisej.NET session, local-login fallback and sign-out of both sessions. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonLet partners sign in to AccessOps with their own identity provider · 14 min

    Let partners sign in to AccessOps with their own identity provider — a guided Module 5 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module five hands partner sign-in to the partner's own organisation. Their identity provider checks the password and second factor, so AccessOps never stores a partner password.

    First, know which token is for whom. An OAuth access token lets a client call one particular API, and it proves nothing about who is at the keyboard. OpenID Connect adds the ID token, which says who signed in. Even then, the tenant and roles come from AccessOps data, never from a claim.

    Follow the code flow. AccessOps starts a challenge with a state value, a nonce and a P K C E verifier it keeps to itself. The partner signs in at the provider, the browser returns with a code, and AccessOps redeems that code over the back channel. The ID token is validated before anything else happens.

    There is no federation component in Wisej.NET 4.1.7. Instead, ASP.NET Core's own cookie and OpenID Connect handlers sit in the startup code, ahead of Wisej.NET. The authority is pinned, the secret comes from the environment, P K C E is on, and only three scopes are requested. A plain H T T P lab needs lax correlation cookies.

    The callback arrives outside any Wisej.NET session. So the token-validated event parks the identity on the server and gives the browser a one-time handle, never a token. The next page load redeems it and maps the issuer and subject, not the email, to a local account. Then exactly one grant is issued and the principal is set.

    Now run it. Dana clicks the work account button and lands at Contoso Identity, where she types her password and approves on her phone. The callback returns, the code is exchanged, the mapper finds account forty-one, and the portal opens for tenant A with a single grant.

    The happy path proves little, so test the failures. A changed state value, a replayed callback, a valid token from an unapproved tenant, and a cancelled consent are all rejected before the grant store runs, with zero new grants. The log keeps a redacted reason, never a code, a token or the secret.

    Signing out ends two sessions, and each needs its own proof. Revoking the local grant means a tab that was already open is refused on Export, with zero reads. Ending the provider session means the next attempt prompts for credentials once more.

    Lab five collects the handlers, the issuer and subject mapper that creates one grant, a fallback for service accounts only, five transaction outcomes, and a sign-out covering both sessions.

  4. Knowledge checkModule 5 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — Partner Federation with OIDC · 45 min

    Objective: Add partner federation to AccessOps: register the app with a test OpenID Connect provider and tenant, configure the cookie and OpenID Connect handlers in Startup.cs before app.UseWisej() for the authorization code flow with PKCE, an exact HTTPS callback, the canonical origin preserved through the proxy and the client secret loaded at runtime, and hand the validated identity to the Wisej.NET session where an account mapper looks up the issuer and subject, assigns the tenant and roles from AccessOps data and creates exactly one login grant. Keep the Module 4 local login as the fallback for service accounts, run one successful sign-in, then use the disposable fixtures to change the state, replay a consumed callback, sign in from an unapproved tenant and simulate a provider denial, showing no app grant is created in any of the four, and finish with a sign-out that revokes the local grant and ends the provider session. Deliverables: Cookie and OpenID Connect handler configuration in Startup.cs with secrets out of source; Issuer and subject account mapper creating one grant per sign-in; Local-login fallback for service accounts; Five transaction outcomes: one success and four rejections with no grant; Sanitized sequence diagram and sign-out covering both sessions.

Module 6: Passkeys with the WebAuthn Extension

Module 6 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the passkey sign-in walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    WebAuthn relying party design, enrollment from a verified account, registration and authentication ceremonies with the Wisej.NET WebAuthn extension, server-side validation of every assertion, a concurrency-safe credential store and account recovery. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonAdd passkey sign-in to AccessOps · 14 min

    Add passkey sign-in to AccessOps — a guided Module 6 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module six adds passkeys to the partner sign-in page. The Wisej.NET WebAuthn extension runs the browser side, and AccessOps makes every decision on the server.

    Be clear about what the extension gives you: four static methods. Two run the browser ceremonies, one hints whether a platform authenticator exists, and Validate checks a signature against a key you stored. That is all. Freshness, origin, account ownership, the counter, the store and the grant are AccessOps code.

    Settle the relying party first. Its ID is a bare domain, localhost in the lab; change it later and everyone registers again. Allowed origins are an exact list, never a pattern. Because GetAsync sends no relying party ID, register and sign in on the same host. The server keeps only public data.

    Enrollment begins only from an account that already signed in another way, because registration proves nothing about the person. Sign-in creates a fresh one-time challenge, calls GetAsync, and lets the user pick a discoverable passkey. Nothing counts as signed in until every policy check and the store commit have passed.

    On the left, a handler trusts a valid signature and signs in. On the right, the challenge is consumed first, so a failed attempt burns it. Only the keys of the returned user handle are tried. Then type, exact origin, the relying party hash, presence, verification and the counter are checked, and a cancelled prompt shows fixed text.

    The credential store commits with one conditional database update, so a delete cannot slip in between a read and a write. One changed row means Updated; otherwise it is a conflict or not found, never a blind retry. The race test reads twice, deletes, and proves neither stale copy can sign in.

    Now it runs. Account A confirms the passkey prompt, the commit succeeds, and one grant is issued. Then the refusals: A's passkey offered for account B, a foreign origin, a replayed response and a cancelled prompt all end without a grant.

    On the review page, the partner deletes the passkey from a lost phone. The owner comes from the session principal, so nobody can delete someone else's key, and the delete stays final. Recovery goes through another verified sign-in before a new passkey is added.

    Lab six collects passkey enrollment and sign-in, the server-side assertion checks, the compare-and-swap credential store, five outcomes with two store races, and a written device-loss recovery plan.

  4. Knowledge checkModule 6 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — Passkey Sign-In and Credential Store · 45 min

    Objective: Add passkeys to AccessOps with the Wisej-4-WebAuthn extension on a stable HTTPS hostname or a documented localhost secure context: check browser support, sign in as account A through the Module 4 or Module 5 flow and enroll a labeled credential with CreateAsync, then sign out and authenticate with GetAsync and server-side Validate, map the local account and recheck the current grant before showing records. Store credentials in a PasskeyCredentialStore keyed by RP ID and credential ID with a unique constraint and a compare-and-swap commit that returns Updated, Conflict or NotFound, add a credential review page where a signed-in user renames or deletes only their own credentials, and reject account A's credential for account B, an unapproved origin, a replayed challenge and a cancelled prompt with no new grant, then read a credential twice in a store integration test and show a stale update and a delete-before-commit fail. Deliverables: Passkey enrollment and sign-in with the WebAuthn extension; Server-side assertion validation with one-time challenges; PasskeyCredentialStore with atomic compare-and-swap commits; Five outcomes: one valid sign-in and four rejections, with store race tests; Credential review page and account recovery plan.

Module 7: Production Design and Capstone

Module 7 of Security & Auth Patterns — the Wisej.NET identity and authentication track. Read the lesson guide and the lab / exam guide, watch the production review walkthrough, pass the knowledge check, then complete the hands-on lab in AccessOps.

  1. ReadingLesson Guide · 14 min

    Two entry points with one resource policy, scale and failure behavior across nodes, timeouts and revocation ownership, correlated incident evidence, and a rehearsed release and rollback for the AccessOps capstone. What this means for a developer securing the sign-in, identity and authorization paths of a production Wisej.NET app — and how to read this module.

    Read the lesson guide (PDF)

  2. ReadingLab / Exam Guide · 10 min

    What you'll build in the hands-on lab, the suggested approach, and the required deliverables.

    Read the lesson guide (PDF)

  3. Video lessonDefend the AccessOps release in a production review · 14 min

    Defend the AccessOps release in a production review — a guided Module 7 walkthrough, built step by step in AccessOps. Runs right here in the player.

    Narration transcript

    Module seven is the capstone. AccessOps is about to go live for staff and partners at once, on several server nodes, and you have to defend that release.

    Staff come in through I I S with Windows sign-in. Partners come in over H T T P S with a local password, OpenID Connect or a passkey. Both lanes produce the same grant shape and end at one record policy, which reads the current grant, then checks tenant and record. A deny never touches the repository.

    Draw the trust boundaries as a ledger. For each identity, from the host principal to the passkey and the Wisej.NET session, write where it comes from, why it is trusted, when it expires and who can revoke it. Then give every timeout a single owner, so none of them is left to chance.

    Wisej.NET sessions live in one node's memory, so the load balancer needs sticky affinity, and a lost node loses its sessions. Node A dies after the provider redirect, yet node B can finish, because grants, hand-off handles and passkey challenges sit in a shared store: an unused handle is consumed once; otherwise, the user signs in again.

    Every node runs the same startup. Forwarded headers are trusted only from the known proxy. One shared data protection key ring and application name let node B read cookies that node A wrote. Configuration files are never served for download. And the record policy reads the grant from the store on every call, never from the session.

    When something breaks, find the first boundary that failed. A four oh one before the application runs is the ingress. A refusal after sign-in is policy. A failing remote share is the token or delegation. Then the callback route, then passkey validation. Each audit event is redacted and correlated per click, with its own logging scope.

    The release review screen now runs all twelve evidence cases, one row at a time, against the complete AccessOps portal you built.

    Each deny shows which boundary refused and that the repository was never called. Cases needing I I S, the domain or a real provider get a rerun plan.

    The stop conditions were agreed before rollout, and one is hit: a replayed callback was accepted as a fresh sign-in. The runbook turns the partner route off and repeats the stale-tab case, which is still denied. Code and configuration roll back, but the grant store never does.

    Lab seven is your release review, defended in ten minutes with the diagrams, matrices and runbook.

  4. Knowledge checkModule 7 Knowledge Check · 10 min · Pass mark 80%
  5. ReadingAI Coding Exercise · 20 min

    Build this module's AccessOps sample with ChatGPT or Claude from a ready-made prompt that points the model at this module's specification, then review, run and extend what it gives you — including against our own reference build on GitHub.

    Read the lesson guide (PDF)

  6. Hands-on labLab — AccessOps Release Review · 45 min

    Objective: Complete the AccessOps capstone on the cumulative portal: draw the trust boundaries with owners for IIS, the directory, the identity provider, the app and the credential store, write the route matrix (framework target, IIS mode, challenge, host principal, app principal, execution identity, revocation owner), and run the 12-case evidence matrix from the brief — intranet Reader read, host-authenticated deny, tenant A requesting tenant B's record 17, scoped read with reversion, second hop, session rotation, revoked grant from a stale tab, external return URL and forged post, single grant per federated callback, unapproved tenant or bad state, passkey replay, wrong owner or deleted credential, and a restart or second-node callback — recording for each the boundary that denied and proof that no data access or grant followed. Simulate one failure such as a wrong SPN, node loss during a callback or a lost authenticator, practise the runbook, and present the allow and deny traces and the rollback in a ten-minute review against the security review checklists; cases that need IIS, the domain or a live provider and ran on fixtures or the PolicyHarness are labeled with an exact rerun plan. Deliverables: Trust-boundary diagram and route matrix; Cumulative AccessOps portal with sanitized configuration, role and tenant map and policy tests; 12-case evidence matrix with denying boundary and fixture labels; Deployment and rollback runbook with owners and stop conditions; Completed security review checklist and oral review notes scored against the rubric.