用户授权 Java SE
我需要创建具有不同用户角色(管理员和简单用户)的用户授权。管理员将拥有更多的功能。 那么,我应该使用哪些类或引擎来实现对我的桌面应用程序的用户授权? 我应该使用 javax.security.auth.login 中的类吗?
I need to create a user authorization with different user's roles (admin and simple user). Admin will have more functional abilities.
So, what classes or engines should I use to implement user authorization to my destkop application?
Should I use classes in javax.security.auth.login
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在桌面应用程序中实现授权的两种最常见方法是:
The two most common ways to implement authorization in a desktop application are:
如果您还没有,请查看 Apache Shiro。它比 JAAS 更容易使用,并且可以与任何类型的应用程序一起使用,无论是桌面应用程序、基于 Web 的应用程序还是移动应用程序。
If you haven't already, check out Apache Shiro. It's MUCH easier to work with than JAAS and will work with any kind of application, whether it's desktop, web based, or mobile.
Bouncy Castle 拥有良好的密码加密系统。您可以使用数据库或 XML 文件来存储用户和角色数据。密码必须加密。然后解决 JMenuBar 和 JMenu 的问题,以启用/禁用或设置为可见/不可见每个角色应该看到的内容。使用此解决方案,您只需要 Bouncy-Castle 罐子。
Bouncy Castle have a good password encryption system. You can use a database or an XML file to store the users and roles data. The password must be encrypted. Then work around your JMenuBar and JMenu's to enable/disable or set to visible/not-visible what every role is supposed to see. With this solution you only need the Bouncy-Castle jar.