Share one sign-in across every host name
A realm reached under several host names can share one sign-in across them, and present one issuer to every app.
API
A realm can be reached under more than one host name, such as a regional name beside a global one:
foobar.cvyuh.com and foobar-eu.cvyuh.com. You can give users one session across those names, and give every app
the same issuer, whichever name it uses.
Before you start:
- Who can do it: a realm administrator, in a group that holds
RealmOwner(Delegated administration).RealmViewercan read the settings but not change them. - Where: today this is done through the API; Call the API shows how to get
$CVYUH_SESSION. - First: the realm answers on each host name, as Hostnames describes.
How it behaves
Section titled “How it behaves”One session, where the cookie reaches. The session cookie is set only on the host the user signed in on, unless
the platform names cookie domains (cookieDomains). Host names under one of those domains share the session: signed
in on one, signed in on all, and one sign-out ends it everywhere. Host names under different domains each sign the
user in separately.
One issuer, if you want it. By default each host name is its own issuer, so an app using foobar-eu.cvyuh.com sees
tokens from https://foobar-eu.cvyuh.com/oauth2. With a base URL set, every app sees the same issuer, and the discovery
document, its endpoints, the issuer in tokens and the return links are all built on that one address. Host names that
differ only in letter case or port are already the same issuer.
| Your apps… | Base URL |
|---|---|
| each use one host name | Not needed |
| may use either host name, and check the issuer | Set it |
| call APIs that trust exactly one issuer | Set it |
Set it up
Section titled “Set it up”-
Check the realm answers on each host name. Each one serves its own discovery document:
Terminal window curl https://foobar-eu.cvyuh.com/oauth2/.well-known/openid-configuration -
Set the base URL:
Terminal window curl 'https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl?id=baseUrl' \-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \-H "Content-Type: application/json" \-d '{ "url": "https://foobar.cvyuh.com" }'It must be an
httpsorigin: lower-case host, an optional port other than 443, no path, no trailing slash.
Check it worked
Section titled “Check it worked”Open https://foobar.cvyuh.com/oauth2/.well-known/openid-configuration and
https://foobar-eu.cvyuh.com/oauth2/.well-known/openid-configuration. With a base URL set, both show the same issuer.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Saving the base URL is refused | It isn’t an https origin: upper-case letters, port 443 written out, a path or a trailing slash | Write it as https://foobar.cvyuh.com |
| Users sign in again on the second host name | The host names aren’t under one cookie domain | Expected: a base URL shares the issuer, not the session |
| An app rejects tokens after the change | It checks the old issuer | Update the app’s issuer to the base URL |
Change it later
Section titled “Change it later”PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl/baseUrl with a new url.
Related
Section titled “Related”- Realm base URL: the setting and its rules.
- Discovery document: what apps read from the realm.