The source headers, LICENSE files, and license metadata had drifted apart. Align the entire project to MIT: - Convert every source-file header to the MIT text across all comment styles (Go, TS, TSX, JS, MJS, SQL, CSS, GraphQL, shell), including SPDX-License-Identifier tags - Set the root and cookie-banner LICENSE files to the MIT text with a "MIT License" title line - Switch the package.json license fields, Docker image label, and cookie-banner README to MIT - Update docs and the genmodels header generator accordingly - Normalize copyright lines to a single format (Copyright (c) <year(s)> Probo Inc <hello@probo.com>.): unify the hello@getprobo.com and hello@probo.inc emails to hello@probo.com and the comma-separated years to a hyphenated range Genuine third-party references are intentionally left untouched: the Lucide icon attributions (Lucide is ISC) and the trivy dependency license allowlist. Signed-off-by: Sacha Al Himdani <sacha@probo.com>
114 lines
4.4 KiB
SQL
114 lines
4.4 KiB
SQL
-- Copyright (c) 2026 Probo Inc <hello@probo.com>.
|
|
--
|
|
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
-- of this software and associated documentation files (the "Software"), to deal
|
|
-- in the Software without restriction, including without limitation the rights
|
|
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
-- copies of the Software, and to permit persons to whom the Software is
|
|
-- furnished to do so, subject to the following conditions:
|
|
--
|
|
-- The above copyright notice and this permission notice shall be included in
|
|
-- all copies or substantial portions of the Software.
|
|
--
|
|
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
-- SOFTWARE.
|
|
|
|
-- OAuth2 Authorization Server tables
|
|
|
|
CREATE TYPE oauth2_client_visibility AS ENUM ('private', 'public');
|
|
CREATE TYPE oauth2_client_token_endpoint_auth_method AS ENUM ('client_secret_basic', 'client_secret_post', 'none');
|
|
CREATE TYPE oauth2_device_code_status AS ENUM ('pending', 'authorized', 'denied', 'expired');
|
|
|
|
CREATE TABLE iam_oauth2_clients (
|
|
id TEXT PRIMARY KEY,
|
|
tenant_id TEXT NOT NULL,
|
|
organization_id TEXT NOT NULL,
|
|
client_secret_hash BYTEA,
|
|
client_name TEXT NOT NULL,
|
|
visibility oauth2_client_visibility NOT NULL,
|
|
redirect_uris TEXT[] NOT NULL,
|
|
scopes TEXT[] NOT NULL,
|
|
grant_types TEXT[] NOT NULL,
|
|
response_types TEXT[] NOT NULL,
|
|
token_endpoint_auth_method oauth2_client_token_endpoint_auth_method NOT NULL,
|
|
logo_uri TEXT,
|
|
client_uri TEXT,
|
|
contacts TEXT[],
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL
|
|
);
|
|
|
|
CREATE TABLE iam_oauth2_authorization_codes (
|
|
id TEXT PRIMARY KEY,
|
|
client_id TEXT NOT NULL REFERENCES iam_oauth2_clients(id),
|
|
identity_id TEXT NOT NULL,
|
|
redirect_uri TEXT NOT NULL,
|
|
scopes TEXT[] NOT NULL,
|
|
code_challenge TEXT,
|
|
code_challenge_method TEXT,
|
|
nonce TEXT,
|
|
auth_time TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
expires_at TIMESTAMP WITH TIME ZONE NOT NULL
|
|
);
|
|
|
|
CREATE TABLE iam_oauth2_access_tokens (
|
|
id TEXT PRIMARY KEY,
|
|
hashed_value BYTEA NOT NULL,
|
|
client_id TEXT NOT NULL REFERENCES iam_oauth2_clients(id),
|
|
identity_id TEXT NOT NULL,
|
|
scopes TEXT[] NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
CONSTRAINT iam_oauth2_access_tokens_hashed_value_unique UNIQUE (hashed_value)
|
|
);
|
|
|
|
CREATE TABLE iam_oauth2_refresh_tokens (
|
|
id TEXT PRIMARY KEY,
|
|
hashed_value BYTEA NOT NULL,
|
|
client_id TEXT NOT NULL REFERENCES iam_oauth2_clients(id),
|
|
identity_id TEXT NOT NULL,
|
|
scopes TEXT[] NOT NULL,
|
|
access_token_id TEXT NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
revoked_at TIMESTAMP WITH TIME ZONE,
|
|
CONSTRAINT iam_oauth2_refresh_tokens_hashed_value_unique UNIQUE (hashed_value)
|
|
);
|
|
|
|
CREATE TABLE iam_oauth2_device_codes (
|
|
id TEXT PRIMARY KEY,
|
|
device_code_hash BYTEA NOT NULL,
|
|
user_code TEXT NOT NULL,
|
|
client_id TEXT NOT NULL REFERENCES iam_oauth2_clients(id),
|
|
scopes TEXT[] NOT NULL,
|
|
identity_id TEXT,
|
|
status oauth2_device_code_status NOT NULL,
|
|
last_polled_at TIMESTAMP WITH TIME ZONE,
|
|
poll_interval INT NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
CONSTRAINT iam_oauth2_device_codes_device_code_hash_unique UNIQUE (device_code_hash),
|
|
CONSTRAINT iam_oauth2_device_codes_user_code_unique UNIQUE (user_code)
|
|
);
|
|
|
|
CREATE TABLE iam_oauth2_consents (
|
|
id TEXT PRIMARY KEY,
|
|
identity_id TEXT NOT NULL,
|
|
client_id TEXT NOT NULL REFERENCES iam_oauth2_clients(id),
|
|
scopes TEXT[] NOT NULL,
|
|
redirect_uri TEXT NOT NULL,
|
|
code_challenge TEXT NOT NULL,
|
|
code_challenge_method TEXT NOT NULL,
|
|
nonce TEXT NOT NULL,
|
|
state TEXT NOT NULL,
|
|
approved BOOLEAN NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL
|
|
);
|