prole/pg-knoe-auth/test/integration/sql/valid_token.sql
chrisfu 57886f9268 feat(pg-knoe-auth): import upstream PostgreSQL JWT auth extension; compile in knoe-db image
- Copy pg-knoe-auth/ wholesale from upstream/knoe-db/20260523 (Task 1 of
  docs/plans/junie/upstream-knoe-db-20260523-integration.md).
- Extension: PG18 OAUTHBEARER JWT validator using libcurl + OpenSSL RS256.
- knoe-db/Dockerfile: add libcurl4-openssl-dev to dev deps; COPY src/ and
  build with make USE_PGXS=1 install after tds_fdw.
- NOT enabled in the default database build (absent from 20_create_extensions.sh).
  To enable: CREATE EXTENSION pg_knoe_auth; (requires pg_hba.conf oauth_issuer).

Closes Task 1 of upstream-knoe-db-20260523-integration.md.
2026-05-23 21:52:06 -07:00

13 lines
603 B
SQL

-- valid_token: properly signed JWT authenticates to correct role
-- Requires mock_jwks.py running and pg_knoe_auth loaded.
-- The \getenv + \connect with token is handled by the test harness wrapper;
-- here we verify the extension is loaded and the GUC is set.
SHOW shared_preload_libraries;
SELECT current_setting('pg_knoe_auth.role_claim');
SELECT current_setting('pg_knoe_auth.audience');
-- Verify the module is present in pg_preload_libraries
SELECT count(*) > 0 AS pg_knoe_auth_loaded
FROM pg_catalog.pg_file_settings
WHERE name = 'shared_preload_libraries'
AND setting LIKE '%pg_knoe_auth%';