Java/MySql 如何实现基于角色的访问控制? [英] How to implement role-based access control Java/MySql?
问题描述
我打算开始一个基于网络的项目,它涉及用户注册,就像论坛/CMS一样,但我的障碍是我不知道如何实现所谓的基于角色的访问控制.
I am planing to start a web-based project that involves user registrations just like forums/CMS, but my barrier is that I have not idea how to implement the so-called role-based access control.
我在谷歌上搜索了基于角色的访问控制",我在结果书中发现了以下内容:设计模式.
I googled for "role-based access control" and I found in the results books about: Design Patters.
这与我的需要有关吗?有关于实现这个想法的教程吗?是在数据库端实现还是在语言编程端实现?
Is this related to what I need? Is there a tutorial about implementing this idea? Is the implementation on database-side or language programming-side?
有参考吗?有标题吗?
推荐答案
设计你的表格,让用户可以根据你的系统拥有一个或多个角色
Design your tables such that user can have one or multiple role based on your system
定义您对群组页面的访问权限
Define your access to pages for group
admin.allowed = .*
user.allowed=/home/.*,/profile/.*
在一些属性文件中
创建一个 Web 过滤器,从会话中读取用户并确定角色,并查看请求的页面是否被允许,如果不允许则重定向到其他页面
Create a Web Filter that reads the user from session and determines the role and sees if the page it is being requested is allowed if not it redirects to some other page
另见
这篇关于Java/MySql 如何实现基于角色的访问控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!