如何为Spring/React应用程序创建RBAC?

huangapple go评论66阅读模式
英文:

How can I create RBAP for Spring/React app?

问题

我有一个管理员仪表板 React Bootstrap 模板,我想为它创建后端。
我已经使用 Spring 在一个单独的端口上构建了一个独立的 REST API,该 API 查询一个 Postgres 数据库。前端只是获取这个 API。
问题是我想根据权限/角色拥有不同的用户角色:不同的导航栏项目,不同的页面内容等等。
我尝试过使用 spring-security,它在访问 API 时有效,但我不知道如何将其连接到前端。
如何在独立的 React 前端、Spring API 后端的 Web 应用中实现基于角色的访问控制(RBAC)?

英文:

I have an Admin Dashboard React Bootstrap Template and I want to create the backend for it.
I have built a separated REST API on a separate port using Spring that queries a Postgres DB. The frontend just fetches the API.
The problem is that I want to have different user roles: different Navbar items, different page content, etc. based on permissions/role.
I've tried using spring-security and it works when accessing API, but I don't know how to connect it to the front.
How can I implement RBAC for a separate React Front, Spring API Back web app?

答案1

得分: 1

Spring Security在前端方面没有直接的支持,尽管Spring有几篇博文描述了JavaScript前端如何与受Spring Security保护的后端进行协调。

关键的洞察力是为了向前端传输用户详细信息而设立的 /user 端点。

英文:

Spring Security doesn't have any direct support for front-ends, though Spring does have a few blog posts that describe how a JavaScript front-end can coordinate with a Spring Security-protected back-end.

The key insight is a /user endpoint for transmitting the user's details to the front-end.

huangapple
  • 本文由 发表于 2020年9月22日 23:35:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/64013066.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定