I have a Postgres database where we have multiple tables and views. I have done Postgrest setup to expose it to the application. Along with the Postgrest API, I also have swagger which is working fine.
Now in postgrest API, we have PGRST_DB_ANON_ROLE required env variable which basically works for anonymous user. Now swagger UI only shows tables and views where the anonymous user has select permission on the tables/views.
I have also implemented token-based authentication. I want data to be secured and read should also be restricted from anonymous user.
Case 1 - I have given schema usage permission to the anonymous user. (no select permission on tables/views) Result - Swagger UI does not show endpoints for tables/views
Case 2 - I have given schema usage permission to the anonymous user and also select permission on tables/views. Result - Swagger Ui shows endpoints but now read endpoints works without any authentication(token).
I want to show the tables/views endpoint in swagger but read endpoint should also be accessed with an authentication token.