Realm base URL
Give your realm one issuer and one set of addresses, whichever host name an app arrives on.
AvailableAPIRFC 8414
A realm can answer on several host names: one per site, such as foobar.cvyuh.com beside foobar-eu.cvyuh.com. By
default each host name is its own issuer, the name the realm signs its tokens under, so tokens from
foobar-eu.cvyuh.com name https://foobar-eu.cvyuh.com/oauth2. Set a base URL and every address the realm hands out
is built on it instead: apps see one issuer, whichever host they reach.
You’d want it when apps or APIs check the issuer strictly and may arrive by more than one host name, or when a sign-in may start on one host name and finish on another. If your realm has one host name, you don’t need it.
Before you begin
Section titled “Before you begin”- Privilege:
MODIFYon the realm’sbaseUrlsetting, whichRealmOwnergives. - Where: the API.
- First: the host name you’ll use must be one of the realm’s host names, and your
session is in
$CVYUH_SESSION(Call the API).
How it works
Section titled “How it works”Without a base URL, the issuer is built from the host name the request came in on, in lower case and without any
port. A sign-in code issued under one host name is refused under another (invalid_grant), since each is its own
issuer; the code isn’t spent, so the app can still redeem it where it got it.
With a base URL, the issuer, the endpoints in the discovery documents and the return links all start with it, exactly as stored, so the issuer never varies by a character. It is also how a port other than 443 appears in the realm’s addresses: without a base URL, the port is left out.
Set it up
Section titled “Set it up”Write the realm’s baseUrl setting, whose id is baseUrl:
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" }'Change it later with a PATCH to https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl/baseUrl, and check the
result in https://foobar.cvyuh.com/oauth2/.well-known/openid-configuration: its issuer is the base URL plus
/oauth2.
What happens when it fails
Section titled “What happens when it fails”| Answer | Cause | What to do |
|---|---|---|
400 | Not an https origin: a path, query, fragment, trailing slash, upper case, or http | Send only https:// and the host, with a port if it isn’t 443 |
400, “url names the default https port; leave it out so the issuer is the same either way” | The URL ends in :443 | Leave the port out |
409, SINGLETON_EXISTS | You created it a second time | PATCH the existing one |
What apps see when it changes: every token from then on names the new issuer. An app or API that checks the issuer refuses tokens until it’s told the new one, and refresh tokens issued under the old issuer are refused.
Limits and defaults
Section titled “Limits and defaults”| What | Default | Can it change |
|---|---|---|
| Base URL | None: each host name is its own issuer | Set one |
| Form | https:// and a lower-case host, optional port other than 443 | No |
Troubleshooting
Section titled “Troubleshooting”- Apps refuse tokens straight after the change. They still expect the old issuer. Update their configured issuer, or let their library rediscover it from the discovery document.
- Requests to the base URL reach no realm. Its host isn’t one of the realm’s host names. Add it to the host names.
- Users are asked to sign in again on another host name. The base URL doesn’t move the sign-in cookie: see Good to know.
Audit record
Section titled “Audit record”Each change to the base URL is a change record naming who made it, before and after. Read it as the setting’s
change history:
GET https://foobar.cvyuh.com/api/v0/am/objects/v1/baseUrl/baseUrl/history.
Good to know
Section titled “Good to know”- Changing it changes the issuer every app sees. Tell the apps and APIs that check the issuer before you change it.
- It doesn’t move the sign-in cookie. The cookie is set for the host the user signed in on, or for the cookie domains your realm is set up with. It reaches another of the realm’s host names only when both sit under one of those domains.
Related
Section titled “Related”- One sign-in across every host name: the task, start to finish.
- Sign in at either site: a realm served from more than one site.
- Discovery: the documents the base URL shapes.