Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

09 External identity

Another OpenID provider can prove a claim. Uses: permission to sign up, linking, a tenant rule (“a valid company login is required”).

  • Authorization code with PKCE, state and nonce, all bound to the browser. iss is checked (RFC 9207) where the provider sends it, and one redirect URI is used for each provider.
  • The ID token’s signature is always verified, with keys from the provider’s published set. The key fixes the algorithm.
  • The identity is the pair (iss, sub). An email address is never used as a key for an account.
  • email_verified counts only for a provider that the application lists as authoritative for that domain.
  • Tokens from the provider are discarded, unless the application asks for them and stores them itself.

The way back

The provider’s redirect comes from another site, so the browser does not send the session there. The callback checks the answer, opens no session, and puts the checked identity into a __Host- cookie (HttpOnly, SameSite=Lax, five minutes, for one purpose). A page of the application then uses it: for a signup, or with a fresh login for a link. A start needs an allowed Origin.

Required company login

A signup with an identity of this provider has the required login.

A tenant can require a recent login at its own provider and a passkey. The requirement has a maximum age. When the company removes a person, the next check fails, and the person cannot enter the tenant.

Linking needs a fresh login. Two users cannot link one (iss, sub) in a realm.