Postgrest 是 postgreeSQL 数据库的 REST API。我正在使用具有以下配置的 postgrest v9.0.0:
db-uri = "postgres://remote_worker:1HyiYai@localhost:5432/myDb"
db-schema = "public"
db-anon-role = "remote_worker"
jwt-secret = "1HyiYaiMTAAJ1pluZnBtAMnTUH19E3gg"
db-pool = 10
db-pool-timeout = 10
server-host = "!4"
server-port = 3000
我假设如果我在配置中输入jwt-secret参数,它会自动导致只有 jwt 授权才能工作。
但是,即使只是在浏览器中输入-> http://localhost:3000/myTable ?Id=eq.2,我也可以在未经授权的情况下发出请求。或在命令行-> curl http://localhost:3000/Kits
同时,当我使用授权参数发出请求时,例如 curl http://localhost:3000/Kits -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoicmVtb3RlX3dvcmtlciJ9.wAzG0zeHPYBflP4PhipUh0W8pvPLCbOQ2M4NFNTOSg" 然后请求只通过正确的令牌。
如何禁用匿名执行请求?