{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-sso-connection-schema.json",
  "title": "SsoConnection",
  "description": "An enterprise single sign-on (OpenID Connect) connection.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-sso-connections-api-openapi.yml#/components/schemas/SsoConnection",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "displayName": {
      "type": "string"
    },
    "vendor": {
      "type": "string",
      "description": "Free text; `generic-oidc` when not set."
    },
    "issuer": {
      "type": "string",
      "description": "The OpenID Connect issuer URL (`https://`, no trailing slash)."
    },
    "clientId": {
      "type": "string"
    },
    "clientSecretPreview": {
      "type": "string",
      "const": "••••••••",
      "description": "Always this mask: the client secret is stored encrypted and is never returned."
    },
    "emailDomains": {
      "type": "string",
      "description": "Comma-separated, lower-case (a leading `@` and a trailing dot are removed)."
    },
    "domainsVerifiedAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ],
      "description": "When DNS proved the domains; null until verified. An unverified connection is not offered at sign-in."
    },
    "provenAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ],
      "description": "When a sign-in first completed with the current issuer, client and domains; null until then."
    },
    "lastSignInAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ],
      "description": "The latest sign-in through this connection. Only the list fills it; create and update answer null."
    },
    "jitProvisioning": {
      "type": "boolean",
      "description": "Create a person on their first sign-in."
    },
    "defaultRoleId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The role a new person gets at the workspace root when no rule applies."
    },
    "claimMapping": {
      "anyOf": [
        {
          "$ref": "#/$defs/SsoClaimMapping"
        },
        {
          "type": "null"
        }
      ]
    },
    "extraScopes": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Scopes requested on top of `openid email profile`, space-separated."
    },
    "lastClaims": {
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "null"
        }
      ],
      "description": "The claims of the last sign-in (a person's email, name and groups). Null unless the caller also holds `user.view` for the whole workspace."
    },
    "lastClaimsAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "redirectUri": {
      "type": "string",
      "description": "The redirect URI to register in the identity provider."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    }
  },
  "required": [
    "id",
    "displayName",
    "vendor",
    "issuer",
    "clientId",
    "clientSecretPreview",
    "emailDomains",
    "domainsVerifiedAt",
    "provenAt",
    "lastSignInAt",
    "jitProvisioning",
    "defaultRoleId",
    "claimMapping",
    "extraScopes",
    "lastClaims",
    "lastClaimsAt",
    "enabled",
    "redirectUri",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "SsoClaimMapping": {
      "type": "object",
      "properties": {
        "locationClaim": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The claim whose value names a location (matched to a location's name or Location ID)."
        },
        "rules": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "claim": {
                "type": "string",
                "description": "The identity-provider claim to read, e.g. `groups`."
              },
              "match": {
                "type": "string",
                "enum": [
                  "equals",
                  "contains"
                ]
              },
              "value": {
                "type": "string"
              },
              "roleId": {
                "type": "string",
                "description": "The role to grant when the rule matches."
              },
              "at": {
                "type": "string",
                "enum": [
                  "location",
                  "root",
                  "node"
                ],
                "description": "Where to grant it: the location named by `locationClaim`, the workspace root, or the fixed `nodeId`."
              },
              "nodeId": {
                "description": "The location for an `at: node` rule.",
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "claim",
              "match",
              "value",
              "roleId",
              "at"
            ]
          }
        },
        "noMatch": {
          "type": "string",
          "enum": [
            "default",
            "deny"
          ],
          "description": "When no rule matches: give `defaultRoleId` at the root, or refuse the sign-in."
        }
      },
      "required": [
        "locationClaim",
        "rules",
        "noMatch"
      ],
      "description": "Rules that turn identity-provider claims into a role at a location."
    }
  }
}