- Add conditional rendering to Router,
- with boolean extracted from
/user API?
- Maybe something as simple as
isAdmin = (await fetch("/user").then(response => response.json())).authorities.some(a => a.authority === "ROLE_ADMIN")?
- Or using JWT? That seems to be the "correct" way.
Reading:
Add Auth to React App
Spring.io: React and Spring, part 5: Security
Spring.io: Security Architecture Topic
Baeldung: React and Spring Security
guides.grails.org: React App with Spring Security