diff --git a/obp-api/src/main/scripts/sql/create_oidc_user_and_views.sql b/obp-api/src/main/scripts/sql/create_oidc_user_and_views.sql index 7903619e5..75da5ff6d 100644 --- a/obp-api/src/main/scripts/sql/create_oidc_user_and_views.sql +++ b/obp-api/src/main/scripts/sql/create_oidc_user_and_views.sql @@ -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.'