Java 授权中的角色概念
我正在写以下内容Java 授权中的角色概念,java,security,authorization,rbac,abac,Java,Security,Authorization,Rbac,Abac,我正在写以下内容 public interface SecurityService{ public Error tryLogin(String usr, String psw); public String getRoleCurrentUser(); //Attention here } 当然,还会有一些实现。比如说现在我有, public SpringSecurityService{ @Autowired AuthenticationManager
public interface SecurityService{
public Error tryLogin(String usr, String psw);
public String getRoleCurrentUser(); //Attention here
}
当然,还会有一些实现。比如说现在我有,
public SpringSecurityService{
@Autowired
AuthenticationManager authenticationManager;
public Error tryLogin(String usr, String psw){
//Implementation here
}
public String getRoleCurrentUser(){
String role = null;
//Getting the role of the current user
//and if the user authorized
//assigning it to the role local variable
return role;
}
}
在SecurityService
界面中,我使用了角色概念。我的问题是,角色概念的使用是否将代码与spring安全性结合起来
或者角色概念是一个严格的脚本概念,因此任何负责授权的安全框架都应该理解角色概念。我强烈建议不要实现您自己的逻辑。只要在这么多失败的尝试中四处搜索就可以了 有很多框架可以让您实现所需的适当级别的访问控制。有些甚至在评论中提到 看看:
- 春季安全
- 阿帕奇西罗酒店
- WSO2是
- 基于角色的访问控制(-)
- 基于属性的访问控制(-)
- 是实现ABAC的标准
RoleBasedSecurityService
。希望是清楚的