encountered a problem today
I have a system, which is role-based permission control.
the front end naturally controls the view that should be displayed according to the role.
but in order to prevent others from directly using httpclient access, then the background must also control the corresponding permissions.
when interacting, all I can know is who the user is
so that I can know his role.
then I want to know how control is controlled at the code level.
how to control that a role can access only one type of url?
my idea is
1. The background needs to maintain the url of the whole system (that is, the interface provided)
2. Maintain the views needed by the system (menus, buttons, etc., because the use of the interface is basically bound to the view)
3. View and role binding, user and role binding
it would be troublesome to do so
1. The workload of maintaining the url of the whole system is very large
2. The workload of the interface URL corresponding to the maintenance view is also very large
3. The resource-based RESTFUL interface has many parameters on url, and the regularization will be more complex, and there are many cases
later, I saw that permission control can be done like this in SHIRO
in an interface, such as springmvc interface
@RequireRoles("admin")
@RequestMapping("/{id}")
public void get(){
xxx
}
how can I do this? if the roles needed for the direct interface are intercepted at the interface layer using Annotation, the workload will be greatly reduced. But the kind of role that we have seen so far can only be hardcode.. Cannot be obtained dynamically from the database.
so there are three questions.
1) how do you deal with this situation?
2) is it reasonable for me to have a very heavy workload? Is there an improved method
3) is it possible for shiro to control role permissions directly at the interface layer and obtain the required roles from the database?
Warriors, thank you very much!
-the following add-
the front and rear ends are verified by token, which is for sure. What I want to ask is that after the token verification is passed,
then I have
1. Currently visited URL
2. Current user, role of current user
I find it troublesome to maintain URL for roles. To ask if there is a better solution