Skip to main content

Value References

A configuration value can name something the deployment holds instead of carrying it. ThunderID recognizes two prefixes, and an import replaces each with the value held under that name in the deployment's variable store.

PrefixRefers toRead back from the store
sec:a secret, such as a client secretnever
var:an ordinary value, such as a client IDas it is
yaml
resource_type: application
id: 0198f3a1-7c2e-7b10-9a44-5d3e8f21c6b7
name: Orders
inboundAuthConfig:
- type: oauth2
config:
clientId: var:APPLICATION__0198F3A17C2E7B109A445D3E8F21C6B7__CLIENT_ID
clientSecret: sec:APPLICATION__0198F3A17C2E7B109A445D3E8F21C6B7__CLIENT_SECRET

The two are independent collections, so the same name may exist in both. The prefix is what says which one a reference means. A value with neither prefix is not a reference and is used as it is, and so is a value that only contains a reference among other text: a reference is a whole value.

The part after the prefix is the name the store holds the value under. It matches the name an export generates for that field, so configuration exported from a control plane and the values a deployment holds agree without a second mapping to keep in sync. See Export Resources for how those names are derived.

A List of Values​

A field that takes a list, such as an application's redirect URIs, refers to one variable as the list's only item. The variable holds the deployment's items as a JSON list of strings, so each deployment can have as many as it needs. A variable holding a plain string stands in for one item.

yaml
redirectUris:
- var:APPLICATION__0198F3A17C2E7B109A445D3E8F21C6B7__REDIRECT_URIS

With APPLICATION__0198F3A17C2E7B109A445D3E8F21C6B7__REDIRECT_URIS set to ["https://orders.example.com/callback", "https://orders.example.com/silent"], the application is written with both URIs. A list item that is not a reference is kept beside them. Only a var: reference expands into items. A sec: reference is always one value, even when the secret it names reads as a JSON list.

A control plane exports an empty list as it is, with no reference, so no gateway has to hold a value for it. A client that signs no user in, for example, exports redirectUris: [].

Why Reference Instead of Store​

A reference lets configuration move between deployments without carrying values with it. The configuration says which value a resource needs; the deployment says what that value is. Two deployments can then run the same configuration with different client IDs and secrets, and the configuration itself holds nothing sensitive.

How a Reference Resolves​

Before an imported resource is written, each reference in it is replaced with the value the deployment's variable store holds: a var: reference from its variables, a sec: reference from its secrets. The resource is then written exactly as if the value had been typed in, so it is stored the way that field always is. A client secret is hashed, a secret property is encrypted, and a client ID is stored as the identifier it is looked up by.

Because the value is put in when the resource is written, changing a variable or a secret later does not change resources already written. Import the configuration again to apply a changed value.

Where a Secret May Stand​

A sec: reference is accepted only in a field that holds a credential: an application's or agent's clientSecret, an application's flowSecret, a connection's secret such as clientSecret, authToken, apiSecret or an outbound authentication password, an authorization details type's processor credential, such as a bearer token or a basic password, and a user's or agent's credentials. These are the fields an export writes a sec: placeholder into, and the fields whose stored value is never returned. A user's stored credential is a hash, so an export of it carries no value: an import that updates a user and resolves such a credential to nothing leaves the stored one as it is, while a user it creates is refused without one.

A document that refers to a secret from any other field, such as a name, a description, a redirect URI or a user attribute, is refused with IMP-1007 before the secret is read. Resolved there, the secret would be stored as an ordinary value that the field's API returns, or that the resource sends to another system. A sec: reference under a YAML anchor is refused for the same reason. A var: reference may stand in any field.

A control plane applies the same rule when it captures a configuration version: a configuration with a secret reference outside a credential field is refused with GTW-1026 before a version is kept, and a diff of an earlier version that still holds one lists it under misplacedSecrets.

When a Value Is Not Held​

A resource that refers to a name the store does not hold is refused, and the import's result for it names every reference it lacked, with the code IMP-1006. Other resources in the same import are unaffected. The reference text is never written in place of the value: a client secret stored as sec:NAME would reject every authentication, for a reason that no longer mentions the name.

Set the missing values in the store, then import again.

A Reference Is Not a Value​

The store holds what a reference stands for, so it does not accept a reference as a value. Setting a variable or a secret to var:NAME or sec:NAME, or to a JSON list of strings with such an item in it, is refused with the code VAR-1011. A value that only begins with var: but is not a reference name, such as a URL carrying one in its query, is stored as it is, and so is a list that is not one of strings.

A placeholder copied into the store in place of a value would otherwise be handed to a resource at import, or, when it names the variable it is stored under, resolve without end.

On a Control Plane​

A control plane keeps configuration as references and holds no values, so an import there leaves references as they are. They are resolved by the deployment the configuration is applied to.

An agent's owner given by references is kept the same way. Each of its id, idType, and isLocal may be a var: reference, and a value given as itself beside one is still checked. The control plane never looks up such an owner, and returns it with the references as written, so its isLocal is text there. See Agent Owners.

Values Captured on a Control Plane​

A control plane writes the values its references name to its first gateway as you create and change resources, so the gateway holds them when a configuration version is applied to it. Each value is stored under the name the export refers to it by: a client ID, an agent's owner, or a resource server's identifier among the gateway's variables, a client secret, a Flow Secret, or a password among its secrets. A list, such as an application's redirect URIs, is stored among the variables as the JSON list of its items, which is what its reference expands from.

The control plane captures values when you write these resources:

ResourceWrites that capture values
Applicationcreate, update
Agentcreate, update
Usercreate, credential update
Connection (identity provider or SMS sender)create, update
Resource servercreate, update
Authorization details type (processor credential)create, update

A captured value comes from the write itself, while the control plane still holds it in plain text. This is the only point at which a generated client secret or Flow Secret can be captured, because the control plane stores only its hash.

Capture follows these rules:

  • First gateway only. Values go to the first gateway of the pipeline (gateway.pipeline), the one auto apply deploys to, which is the gateway marked isDefault in the Gateway API when no pipeline is set. With neither, nothing is captured. Set a value on any other gateway yourself.
  • HTTPS only. The control plane sends a value, and the gateway's management key, only to a gateway whose baseUrl starts with https://. A gateway on plain HTTP receives nothing.
  • Never blocks the write. The values are worked out as the resource is written, and sent to the gateway in the background, so a slow or unreachable gateway does not slow the write. A send that fails is tried again, waiting longer each time up to a minute, ten times in all, and each failure is logged by name, never by value. A newer value for the same name replaces one still on its way. A value that never arrived is reported as missing when you try to apply a version that needs it, and you can set it on the gateway then. A version applied right after a write may find the value not there yet; the apply reports it missing, and the next one finds it. A value still on its way is held in the memory of the node that worked it out, so a restart of that node drops it; it is then reported as missing in the same way.
  • Replaces what is there. A value is set whether or not the gateway already holds that name, so writing a resource again replaces the value the gateway held under its name.
  • An agent's owner only when the write sets it. The owner is captured when an agent is created, and when an update changes the owner. An update that leaves the owner as it was captures none, so an owner set on the first gateway for that agent stays until the owner is changed on the control plane.
  • An application's Flow Secret only when the write sets it. The Flow Secret is captured when an application is created, and when an update sets a new one, as regenerating it does. An update that leaves it as it was captures none, so the value the first gateway holds stays. An application exports a reference to its Flow Secret only when it holds one.
  • Values, never references. A value that is itself a reference, or a list holding one among its items, is not captured. The export keeps those as they are, so the gateway holds nothing under the name, and a reference stored as a value would never resolve.

Variables Filled on Start​

A value is captured only when a resource is written, so a resource written before one of its fields was exported as a reference has no value for that field on the gateway. When a control plane starts, it writes to its first gateway each variable its applications, agents, and resource servers refer to that the gateway does not hold, with the value the control plane holds.

  • Missing values only. A value the gateway holds is never replaced, and neither is one a write has already put on its way, so restarting the control plane changes nothing the gateway already has.
  • Variables only. A secret is never filled, because the control plane holds only its hash.
  • First gateway only. Like a captured value, a filled value goes only to the first gateway.
  • Waits for the gateway. A gateway that does not answer is asked again, waiting longer each time, as many times as a captured value is sent. A gateway that refuses the lookup is not asked again.

Upgrading to Owner References​

A control plane that exports an agent's owner as references, after upgrading from one that did not, fills the first gateway as above. Every other gateway still lacks the owner values of the agents written before the upgrade, so the next version applied to it is refused until they are set. The dry run, and the console's deploy dialog, list each one. An older data plane cannot read an owner resolved from references, so upgrade data planes before their control plane.

Upgrading to Flow Secret References​

A control plane that exports an application's Flow Secret as a sec: reference, after upgrading from one that did not, cannot fill any gateway with it: a Flow Secret set before the upgrade was never captured, and the control plane holds only its hash. The next version applied that sends such an application is refused until the gateway holds its Flow Secret, and the dry run, and the console's deploy dialog, list each one. For each, regenerate the Flow Secret on the control plane, which captures the new value to the first gateway, or set the value on the gateway yourself. Set it on every other gateway yourself, and give the new Flow Secret to the application's backend. A data plane on an earlier release refuses such an application as a misplaced secret (IMP-1007), so upgrade data planes before their control plane.

Limits​

  • Renames. Changing an application's name, an agent's resolved display label, or a user's username changes the names its values are exported under. For agents, the label comes from the schema's display setting, which selects name by default and falls back to the agent ID. The control plane captures the client ID under the new name, but not a client secret or password it was not given in the same write, because it holds only their hashes. Set the value under the new name on the gateway yourself.
  • Imported connections. Configuration imported into a control plane writes connections without capturing their values. Applications, agents, and users imported into a control plane are captured.
  • Name collisions. When two resources' names normalize to the same value name, a full export adds a suffix such as _2 to one of them. A capture sees one resource at a time and uses the name without the suffix, so set the suffixed value on the gateway yourself.
  • Overlapping updates. Two updates to the same resource that run at the same moment can be captured in the opposite order, leaving the earlier value on the gateway until the next write.

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.