Skip to content

Route authentication and protection #3201

Discussion options

You must be logged in to vote

As a summary:

Routes are protected by the permissions given to the database user who is making the request. The user could be anonymous (set by db-anon-role) or an authenticated one through JWT. Only the schemas specified in db-schemas are exposed.

Is there any working example?

Suppose you have an existing database:

db: mydatabase
schemas: public, sales, accounting
roles: postgres, generic_user

And you set postgrest config like this:

db-uri = "postgres://postgres:password@localhost:5432/mydatabase"
db-schemas = "public"
db-anon-role = "generic_user"

Then only the relations inside the public schema will be exposed, and only those that can be accessed by generic_user (the anonymous role)…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wolfgangwalther
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3200 on January 30, 2024 18:36.