
1 hmz0327 2022-09-19 09:38:50 +08:00 client 里好像可以创建 role |
2 hmz0327 2022-09-19 09:40:53 +08:00 创建 user 时可以指定 clientRoles |
3 yaott2020 OP clientRole 和 role 要怎么关联呢 |
4 Casbin PRO @yaott2020 用 casdoor ,可以很容易设置角色的应用权限: https://casdoor.cn/ |
5 yaott2020 OP @Casbin 就是刚从 casdoor 切过来。。。感觉 casdoor bug 还挺多的。。。 |
6 hmz0327 2022-09-19 11:31:45 +08:00 在 Configure->Roles 里创建的是 realmRole ,Client 里创建的 Role 是 clientRole ,它们的权限范围是不一样的。 |
7 hmz0327 2022-09-19 11:39:58 +08:00 我也刚用没多久,懂得也不太多 |
9 hmz0327 2022-09-19 13:11:48 +08:00 在用户设置里面是可以关联多个的,切换另一个 client 然后关联就行了。 |
10 hmz0327 2022-09-19 13:12:53 +08:00 在 UserRepresentation 类里,clientRoles 是个 Map 类型。 protected Map<String, List<String>> clientRoles; |
11 clickhouse 2022-09-19 13:42:53 +08:00 不确定 lua-resty-openidc 是否可以拿到用户在特定 client 或者 realm 的 role 信息, 如果可以的话直接判断就行。 如果只能拿到用户基本信息,可以依靠 keycloak 本身去做权限判断和拦截,用这个插件: https://github.com/sventorben/keycloak-restrict-client-auth |
12 yaott2020 OP 11 楼方法可行 |