定义 Spring Security 用户角色
我将设计一个从另一个应用程序验证用户身份的应用程序。基本上,只有当用户经过身份验证(真或假)和用户角色时,我的应用程序才会获得。
我可以使用 spring security 来利用这个角色并提供细粒度的控制吗?
基本上,我不想使用 spring security 进行身份验证,而是进行授权。
如果可能的话,您能给我指出任何示例或文档吗?
谢谢。
I am going to design an application which authenticates user from another application . Basically my application is going to get only if the user is authenticated (true or false) and the user role .
Can I use spring security to make use of this role and give fine grained control ?
Basically , I do not want to use spring security for authentication , but for authorization.
If this is possible , can you point me to any example or documentation ?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确,您想查看用户是否已在另一个应用程序中经过身份验证,如果是,您想在新应用程序中授权该用户吗?
我认为您可以做的是在 spring security 过滤器链(http://goo.gl/uQpq9)中应用自定义身份验证过滤器,该过滤器检查其他应用程序中的身份验证。此时,您可以设置用户在新应用程序中获得的用户角色 (GrantedAutority)。
可以在这里找到一个简短的教程: http://teja.tejakantamneni .com/2008/08/spring-security-using-custom.html
我希望这就是您正在寻找的内容,
Jens
if I understand you right you want to look if a user is already authenticated in another application and if so you want to authorize the user in your new application?
I think what you can do is apply a custom authentication filter in the spring security filter chain (http://goo.gl/uQpq9) which checks for the authentication in your other application. At this point you would have the possibility to set the user's roles (GrantedAutority) the user gets in your new application.
A short tutorial can be found here: http://teja.tejakantamneni.com/2008/08/spring-security-using-custom.html
I hope this is what you are looking for,
Jens