我正在尝试理解PostgREST教程的初始步骤。
在提到的教程中,建议按以下方式创建两个不同的角色,分别命名为web_anon和authenticator:
create role web_anon nologin;
grant usage on schema api to web_anon;
grant select on api.todos to web_anon;
create role authenticator noinherit login password 'mysecretpassword';
grant web_anon to authenticator;
据我所知,PostgREST服务器从客户端接收Rest API请求,没有任何关于用户(角色)的信息。而且,据我所知,无法登录到数据库的nologin角色。(他们能发送查询吗?)
所以问题是:
1.我们为什么需要两个不同的角色? web_anon的角色是什么,authenticator的角色是什么?
2.nologin角色在postgres中能做什么?
3.PostgREST接收rest API查询时,使用哪个用户将查询发送和执行到数据库?