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”| Module | M4 — The operator side of the hand-offs |
| After this session you can | Connect 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. |
| Time | Facilitated: 35 min · On your own: 35 min |
| Before you start | M3-S2: the release healthy. From ACSA: the single sign-on worksheet. |
| Go deeper | Identity 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”The identity server
Section titled “The identity server”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 entra | name (also part of the callback address) |
| C2 button text Northwind | title: the button reads Sign in with Northwind |
| C3 domains | domains: the ids of the Domain records it appears on |
| C4 existing accounts: link once with password | supportManualLinking: {enabled: true} |
| C5 new people: refuse | supportSignup: {enabled: false} |
| C7 update name and email at every sign-in | syncProfileOnSignIn: true |
| Entra directory ID | part of authorizationURL, tokenURL, logoutUrl |
| Entra application ID and client secret | clientID, 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.
Sign-in keys
Section titled “Sign-in keys”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 keys | identity.oidc.cookieKeys; left empty, generated once on install and kept | Per tenant, created at onboarding |
| Signing keys | Generated by the identity server, or PEM files from the Secret named in identity.oidc.signingKeys.existingSecret | Per tenant, created at onboarding |
| Rotation | Change the values or the Secret, upgrade, restart identity | A call to the tenant registry API, one keyset per tenant |
| After rotation | Plan for sessions and tokens issued before it | Old 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.
Human verification on the sign-in pages
Section titled “Human verification on the sign-in pages”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.
The second-factor keys
Section titled “The second-factor keys”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.
-
Find the id of the domain the lab is served on:
db.domains.find({}, {_id: 1, host: 1}). Note the_idof the record whosehostlist holdslocalhost. -
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>'],}) -
Open
http://localhostin 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.
-
Confirm it in the log:
kubectl -n northwind logs deploy/nw-osos-identity --since=5m | grep ExtAuth. You see the providers found andentraregistered. -
Write the callback address the administrator must register in Entra for the lab, and for production with the issuer
https://signin.northwind.example.com. -
Rotate the client secret, as you would before it expires:
db.externalproviders.updateOne({name: 'entra'}, {$set: {clientSecret: 'lab-only-rotated-secret'}}). -
Switch the provider off:
db.externalproviders.updateOne({name: 'entra'}, {$set: {active: false}}), reload the sign-in page, and see the button gone. -
Type
exitto leave mongosh.
Check.
- Step 3 showed Sign in with Northwind, with no restart of anything.
- The identity log names the
entraprovider. - 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 see | What to do |
|---|---|
db.domains.find returns nothing | You are in the wrong database. Check identity.config.mongodb.url in nw-values.yaml and connect to that database name. |
| The button does not appear | Check 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 function | Use UUID().toString().split('"')[1], or type any new UUID string as _id. |
| The sign-in page never finishes loading its challenge | Human 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”You inserted a provider document and the button does not appear. The identity log says ExtAuth: 0 providers found. What is the likely cause?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
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?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
Public forms on Northwind’s site still accept submissions during an outage of the verification service, but nobody can sign in. Why the difference?
Check your answer
The correct answer is B. Open the explanation under each option to see why.
You set identity.config.altchaEnabled: "false" and ran helm upgrade, but sign-in still fails.
What is missing?
Check your answer
The correct answer is C. Open the explanation under each option to see why.
In a multi-tenant deployment you rotate one tenant’s signing keys. What happens to tokens issued an hour before?
Check your answer
The correct answer is A. Open the explanation under each option to see why.
↺ Recap (1 min) — Sign-in you can run
Section titled “↺ Recap (1 min) — Sign-in you can run”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.