changing v_oidc_users so that we return the user_id from resourceuser

table via a join on au.user_c = ru.id Also removing other ids that we
generally don't use to identify the user.
This commit is contained in:
simonredfern 2025-08-25 03:26:56 +02:00
parent 8e0e5c400e
commit b9254e96c4

View File

@ -167,24 +167,24 @@ DROP VIEW IF EXISTS v_oidc_users CASCADE;
-- and checking mbadattemptssinceresetorsuccess against max.bad.login.attempts prop
CREATE VIEW v_oidc_users AS
SELECT
id,
username,
firstname,
lastname,
email,
uniqueid,
validated,
provider,
password_pw,
password_slt,
createdat,
updatedat
FROM authuser
WHERE validated = true -- Only expose validated users to OIDC service
ORDER BY username;
ru.userid_ AS user_id,
au.username,
au.firstname,
au.lastname,
au.email,
au.validated,
au.provider,
au.password_pw,
au.password_slt,
au.createdat,
au.updatedat
FROM authuser au
INNER JOIN resourceuser ru ON au.user_c = ru.id
WHERE au.validated = true -- Only expose validated users to OIDC service
ORDER BY au.username;
-- Add comment to the view for documentation
COMMENT ON VIEW v_oidc_users IS 'Read-only view of authuser table for OIDC service access. Only includes validated users and excludes sensitive fields like password hashes. WARNING: Includes password hash and salt for OIDC credential verification - ensure secure access.';
COMMENT ON VIEW v_oidc_users IS 'Read-only view of authuser and resourceuser tables for OIDC service access. Only includes validated users and returns user_id from resourceuser.userid_. WARNING: Includes password hash and salt for OIDC credential verification - ensure secure access.';
\echo 'OIDC users view created successfully.'