Skip to content

M4-S1 — The identity server: single sign-on, sign-in keys and human verification

Section titled “M4-S1 — The identity server: single sign-on, sign-in keys and human verification”
ModuleM4 — The operator side of the hand-offs
After this session you canConnect an organization’s single sign-on from the administrator’s worksheet, look after the identity server’s keys, and bring sign-in back when human verification takes it down.
TimeFacilitated: 35 min · On your own: 35 min
Before you startM3-S2: the release healthy. From ACSA: the single sign-on worksheet.
Go deeperIdentity server & external providers · Rotating a tenant’s sign-in keys · Human verification: technical reference

◆ Orientation (1 min) — Yasmin’s worksheet arrives

Section titled “◆ Orientation (1 min) — Yasmin’s worksheet arrives”

Northwind’s administrator, Yasmin Farah, has sent you the single sign-on worksheet she filled in during ACSA: provider name entra, button text Northwind, staff domain only, existing staff link once with their password, new people refused, names and emails updated at every sign-in. Northwind’s Entra administrator has sent the directory ID, the application ID and, through the password manager, the client secret. Your part: make the button appear and work, and keep the identity server healthy around it.

▤ Concept (6 min) — What the identity server does, and what you configure

Section titled “▤ Concept (6 min) — What the identity server does, and what you configure”

Osos runs its own sign-in service, the identity server (nw-osos-identity). It shows the sign-in pages, checks passwords and second factors, issues the tokens the gateway checks on every request, and hands sign-in over to an organization’s own provider when single sign-on is set up. Its issuer is the address it signs tokens as: in your lab http://localhost, in production for example https://signin.northwind.example.com when identity has its own host (identity.ingress.enabled with identity.ingress.hostName).

Single sign-on: from worksheet to provider

Section titled “Single sign-on: from worksheet to provider”

There is no screen and no API for external providers. Each one is a document you write into the externalproviders collection of the identity server’s users database (in your lab, nw-identity). The identity server reads the active providers on every sign-in, so a new or changed document works at the next sign-in, without a restart.

Worksheet (ACSA M3-S3)Provider document
C1 provider name entraname (also part of the callback address)
C2 button text Northwindtitle: the button reads Sign in with Northwind
C3 domainsdomains: the ids of the Domain records it appears on
C4 existing accounts: link once with passwordsupportManualLinking: {enabled: true}
C5 new people: refusesupportSignup: {enabled: false}
C7 update name and email at every sign-insyncProfileOnSignIn: true
Entra directory IDpart of authorizationURL, tokenURL, logoutUrl
Entra application ID and client secretclientID, clientSecret

The callback Entra must allow is the issuer followed by /ext-auth/<name>/redirect. That is the address A2 the administrator registered from the A1 you gave them. For Entra, the profile comes from Microsoft Graph’s /me address, and its id is the same value the directory import stores, so imported people are recognized on their first single sign-on without linking (M4-S2).

The client secret is stored as a plain field in the users database. Treat that database, and every backup of it, as holding live credentials of the organization’s identity provider.

Look after it. To check a provider, open the sign-in page on a listed domain: it shows Sign in to your account using and the button, and the identity log records ExtAuth: <n> providers found. Before the secret expires, replace clientSecret in the document; to hide the provider, set active: false or remove a domain id.

The identity server signs tokens with signing keys and protects sign-in sessions with cookie keys. Where they come from depends on the deployment:

Single tenant (your lab, most customers)Multi-tenant
Cookie keysidentity.oidc.cookieKeys; left empty, generated once on install and keptPer tenant, created at onboarding
Signing keysGenerated by the identity server, or PEM files from the Secret named in identity.oidc.signingKeys.existingSecretPer tenant, created at onboarding
RotationChange the values or the Secret, upgrade, restart identityA call to the tenant registry API, one keyset per tenant
After rotationPlan for sessions and tokens issued before itOld signing keys keep working 24 hours, old cookie keys 14 days

Stored keys are encrypted with the field-encryption root key (M4-S3). Without that key, a restored users database cannot read its own sign-in keys.

The identity server puts a proof-of-work challenge in front of sign-in, two-factor verification and password reset. It is on by default (identity.config.altchaEnabled: "true", a string), and it fails closed: if the verification service (nw-osos-altcha) or its Redis is down, nobody can sign in, verify a second factor or reset a password. The widget also needs a secure browser context: HTTPS, or localhost as in your lab.

This is the opposite of the check builders put on public forms, which the gateway applies and which fails open (a form still submits if verification is unavailable). ACSA taught you to tell the two apart for administrators; for you the difference is which one can take sign-in down.

Recovery when it does. Set identity.config.altchaEnabled: "false", helm upgrade, then restart the identity pods, which only read the value at start. Repair the verification service or Redis, then switch it back on the same way. Never leave it off without a decision: it is off for everyone.

Two values you set in M2-S1 protect second factors: identity.config.totpEncryptionKey encrypts the stored authenticator secrets, and identity.config.recoveryCodePepper protects the recovery codes. Both are set once. A new TOTP key cannot read the old secrets; a new pepper invalidates every recovery code already issued. If a second factor is sent by WhatsApp, real messages go out only when whatsapp.sendEnabled is true (M4-S2); outside production, whatsapp.testRecipients lists the only numbers that receive them.

⛏ Lab (19 min) — Connect Northwind’s single sign-on

Section titled “⛏ Lab (19 min) — Connect Northwind’s single sign-on”

Goal. The Northwind provider registered from the worksheet, its button shown on the sign-in page, its secret rotated, and the provider switched off again for the rest of the course.

Before you start. The lab has no real Microsoft Entra. You use obviously fake directory and application IDs and a lab secret, so the button appears but must not be selected. Open a mongosh session on the identity database in a terminal: kubectl -n datastores exec -it mongo-0 -- mongosh --quiet nw-identity.

  1. Find the id of the domain the lab is served on: db.domains.find({}, {_id: 1, host: 1}). Note the _id of the record whose host list holds localhost.

  2. Insert the provider, replacing <domain id> with the value from step 1:

    db.externalproviders.insertOne({
    _id: crypto.randomUUID(),
    name: 'entra',
    title: 'Northwind',
    active: true,
    authorizationURL: 'https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/authorize',
    tokenURL: 'https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token',
    logoutUrl: 'https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/logout?post_logout_redirect_uri={redirect_uri}',
    clientID: '11111111-1111-1111-1111-111111111111',
    clientSecret: 'lab-only-not-a-real-secret',
    scope: ['openid', 'profile', 'email', 'User.Read'],
    matchingClaim: 'email',
    profileEndpoint: {
    url: 'https://graph.microsoft.com/v1.0/me',
    id: 'id',
    mappingSchema: [
    {name: 'account_information.email_address', expression: 'profile.mail || profile.userPrincipalName'},
    {name: 'account_information.username', expression: 'profile.mail || profile.userPrincipalName'},
    {name: 'account_information.isExternal', value: true},
    {name: 'account_information.externalUserId', key: 'id'},
    {name: 'basic_info.first_name.en', key: 'givenName'},
    {name: 'basic_info.last_name.en', key: 'surname'},
    ],
    },
    syncProfileOnSignIn: true,
    supportManualLinking: {enabled: true},
    supportSignup: {enabled: false},
    domains: ['<domain id>'],
    })
  3. Open http://localhost in a new private window. Under the password form, the page shows Sign in to your account using and the button Sign in with Northwind. Do not select it.

    Screenshot pending The lab's Sign in page with the line Sign in to your account using and the Sign in with Northwind button under the password form What to notice: no restart was needed. The identity server read the new document on this sign-in request.

  4. Confirm it in the log: kubectl -n northwind logs deploy/nw-osos-identity --since=5m | grep ExtAuth. You see the providers found and entra registered.

  5. Write the callback address the administrator must register in Entra for the lab, and for production with the issuer https://signin.northwind.example.com.

  6. Rotate the client secret, as you would before it expires: db.externalproviders.updateOne({name: 'entra'}, {$set: {clientSecret: 'lab-only-rotated-secret'}}).

  7. Switch the provider off: db.externalproviders.updateOne({name: 'entra'}, {$set: {active: false}}), reload the sign-in page, and see the button gone.

  8. Type exit to leave mongosh.

Check.

  • Step 3 showed Sign in with Northwind, with no restart of anything.
  • The identity log names the entra provider.
  • Your two callback addresses end in /ext-auth/entra/redirect.
  • After step 7, the button is gone and the password form still works.
  • No real secret, directory ID or application ID was typed anywhere.

Pass condition. All five checks hold.

If something goes wrong

What you seeWhat to do
db.domains.find returns nothingYou are in the wrong database. Check identity.config.mongodb.url in nw-values.yaml and connect to that database name.
The button does not appearCheck active: true, and that domains holds the _id of the record listing localhost, as a string. The log line in step 4 says whether the provider was found at all.
crypto.randomUUID is not a functionUse UUID().toString().split('"')[1], or type any new UUID string as _id.
The sign-in page never finishes loading its challengeHuman verification cannot run: see the worked scenario below, and check nw-osos-altcha is ready.
Model answer

The provider is the document in step 2; for production you would replace the three fake values with the worksheet’s B1, B2 and the secret from the password manager, and list the staff domain’s id only.

Callback addresses:

  • Lab: http://localhost/ext-auth/entra/redirect
  • Production: https://signin.northwind.example.com/ext-auth/entra/redirect

They match the worksheet’s A2, which the administrator built from A1 (the issuer you gave them) and C1 (entra). After the administrator’s tests pass, she turns off passwords on the staff domain herself, on the Domain record (worksheet C9); that is not your step.

◇ Worked scenario (2 min) — Monday, 07:58: nobody can sign in

Section titled “◇ Worked scenario (2 min) — Monday, 07:58: nobody can sign in”

The service desk reports that nobody can sign in. The sign-in page loads, people type their password, and the page never completes. People already signed in keep working.

Decide: is it the gateway? No. People already signed in can still use the API, so the gateway, Redis lookups and tokens work. The failure is in the sign-in flow itself.

Decide: what fails closed in that flow? Human verification on the identity pages. You check kubectl -n northwind get pods -l app=osos-altcha: the pod is in CrashLoopBackOff, and its log shows it cannot reach Redis, whose node was drained overnight without a replacement.

Decide: fix Redis first, or switch verification off? Restoring Redis takes your database team an hour. Sign-in is down now for the whole organization. You switch verification off (identity.config.altchaEnabled: "false", upgrade, restart the identity pods), confirm one sign-in, and log the decision with a time. When Redis is back and the altcha pod is ready, you switch it on the same way and confirm sign-in again. In the incident note you record why verification was off, for how long, and that it is back on.

✓ Practice (6 min) — Check your understanding

Section titled “✓ Practice (6 min) — Check your understanding”
PracticeChoose one answer.

You inserted a provider document and the button does not appear. The identity log says ExtAuth: 0 providers found. What is the likely cause?

  1. Explanation for A

    ✗ Incorrect

    Not this one: providers are read on every sign-in request; no restart is needed. See Single sign-on: from worksheet to provider.

  2. Explanation for B

    ✓ Correct

    Correct: only active providers in the identity server’s users database are found. See Single sign-on: from worksheet to provider.

  3. Explanation for C

    ✗ Incorrect

    Not this one: that would fail after the button is selected, not hide the button. See Single sign-on: from worksheet to provider.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

Your backup policy sends nightly copies of the identity server’s users database to a shared archive that the whole IT department can read. Why is that a problem now?

  1. Explanation for A

    ✗ Incorrect

    Not this one: passwords are not stored in clear; the problem is another field. See Single sign-on: from worksheet to provider.

  2. Explanation for B

    ✓ Correct

    Correct: anyone who reads the backup can impersonate the application at the identity provider. Restrict the backups like the secret itself. See Single sign-on: from worksheet to provider.

  3. Explanation for C

    ✗ Incorrect

    Not this one: that is about restoring, not about who can read them. See Sign-in keys.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

Public forms on Northwind’s site still accept submissions during an outage of the verification service, but nobody can sign in. Why the difference?

  1. Explanation for A

    ✗ Incorrect

    Not this one: they can, when a builder turns it on; that check behaves differently. See Human verification on the sign-in pages.

  2. Explanation for B

    ✓ Correct

    Correct: only the sign-in check can take authentication down. See Human verification on the sign-in pages.

  3. Explanation for C

    ✗ Incorrect

    Not this one: both use the same verification service; they react differently when it is down. See Human verification on the sign-in pages.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

You set identity.config.altchaEnabled: "false" and ran helm upgrade, but sign-in still fails. What is missing?

  1. Explanation for A

    ✗ Incorrect

    Not this one: the setting is read by the identity server, not the gateway. See Human verification on the sign-in pages.

  2. Explanation for B

    ✗ Incorrect

    Not this one: the identity pods read the value only when they start. See Human verification on the sign-in pages.

  3. Explanation for C

    ✓ Correct

    Correct: environment values are read at start-up, so restart the identity Deployment after the upgrade. See Human verification on the sign-in pages.

Check your answer

The correct answer is C. Open the explanation under each option to see why.

PracticeChoose one answer.

In a multi-tenant deployment you rotate one tenant’s signing keys. What happens to tokens issued an hour before?

  1. Explanation for A

    ✓ Correct

    Correct: rotation adds a new key and keeps the old one for a period, so nobody is signed out at the moment of rotation. See Sign-in keys.

  2. Explanation for B

    ✗ Incorrect

    Not this one: the old key is kept for a period. See Sign-in keys.

  3. Explanation for C

    ✗ Incorrect

    Not this one: each tenant has its own keys; a rotation touches one tenant only. See Sign-in keys.

Check your answer

The correct answer is A. Open the explanation under each option to see why.

You can connect an organization’s single sign-on from the administrator’s worksheet, check, rotate and disable it, look after the identity server’s keys, and bring sign-in back when human verification fails closed.

Next. In M4-S2 you run the directory import the administrator scoped, connect the senders that make the platform’s messages leave it, and set the brand people see.