Attribute sources
An attribute source is a SQL database a realm reads people’s attributes from. Values are written onto each person’s directory entry, where a token or assertion can carry them.
A typical use is an HR table holding each person’s cost centre and grade.
The source reads that person’s row when they sign in and writes
costCenter and employeeType onto their entry. An attribute claim then
puts cost_center in their tokens.
Sources are configured per realm on Directory → Attribute sources
(/admin/attribute-sources) or through /admin-api/attribute-sources.
What a source says
| Database | PostgreSQL, or MySQL / MariaDB. SQL Server and Oracle come in a later release. |
| Host, port, database, user | Where to connect. The connection always uses TLS and always verifies the server’s certificate; there is no plaintext option. Server name sets the name the certificate is checked against (the host, when empty). |
| Trusted CA certificates | The database’s trust chain, pasted as PEM. Each source has its own, and the page shows each certificate’s subject, expiry and SHA-256 fingerprint. When a source has its own chain, that chain alone is trusted, unless you tick also trust the public roots. A source with no chain uses the public roots, since it has nothing else to verify against. A chain that doesn’t parse, or has an expired or not-yet-valid certificate, is refused (STS-ATTR-0015). CA file adds a PEM file from this service’s disk to the chain. |
| Password from | Where the password is read from: file, aws, gcp, azure or vault (OpenBao), using the same providers as the key-encryption key. Choose none for a database that needs no password. The password itself is never stored or shown here. An empty location means the key-encryption key’s location, and field picks a value out of a JSON secret. |
| Table or view, key column | The one row a person has is the row whose key column holds their key attribute (uid by default, or employeeNumber, entryUUID, …). If you need a join, create a view in your database. |
| Columns | column=attribute, one per line: which column is written onto which attribute of the person’s entry. |
| Read | When a person is read (see below). |
| On failure | keep (the default): the values already on the entry stand and the sign-in goes ahead. refuse: the sign-in is refused. |
Adding a source — /admin/attribute-sources/new
The Add tab on Directory → Attribute sources takes you to the form.
The id, host, database, user, table, key column and at least one column
mapping are required: each is outlined in red and marked required, as on
/admin/users/new, and the note above the form names them. Every other field
is optional and starts at the default the service applies when it is left
out: PostgreSQL, the dialect’s port, no password, the key attribute uid,
read at sign-in, an hour between scheduled reads, a two-second timeout,
keep on failure. A refused add keeps every box as you typed it, with the
reason at the top of the window. GET /admin-api/attribute-sources/new
answers the same fields, each with required.
Choose a database user that can read only that table or view. The service
only ever sends one statement, `SELECT