我是否应该从Acegi Security实现一个基于自定义属性文件的授权标记以与authz配合使用?
我正在寻找处理视图级授权(根据用户角色隐藏标记)的最佳方法 执行此操作的典型方法是使用Acegi Security authz标记,如下所示:我是否应该从Acegi Security实现一个基于自定义属性文件的授权标记以与authz配合使用?,security,jsp,authorization,web-applications,spring-security,Security,Jsp,Authorization,Web Applications,Spring Security,我正在寻找处理视图级授权(根据用户角色隐藏标记)的最佳方法 执行此操作的典型方法是使用Acegi Security authz标记,如下所示: <authz:authorize ifAnyGranted="ROLE_FOO, ROLE_BAR, ROLE_BLAH"> <!-- protected content here --> </authz:authorize> com.lingoswap.home.editUserNameButton.ifAny
<authz:authorize ifAnyGranted="ROLE_FOO, ROLE_BAR, ROLE_BLAH">
<!-- protected content here -->
</authz:authorize>
com.lingoswap.home.editUserNameButton.ifAnyGranted=ROLE_FOO, ROLE_BAR, ROLE_BLAH
com.lingoswap.home.deleteAccountButton.ifNotGranted=ROLE_NOOB
com.lingoswap.home.deleteAccountButton.ifAnyGranted=ROLE_ADMIN
...
为了保护主页上的内容,我们将使用另一个受保护的标记(该标记大量借用了原始authz,可能是一个子类):
这种方法的优点如下:
LES2我做了一些类似于第二种方法的事情。因为我希望所有的安全定义都放在一个地方,所以我为过滤器安全接口实现了自己的对象定义源
<security:protect component="com.lingoswap.home.editUserNameButton">
<!-- edit user name button -->
</security:protect>
<security:protect component="com.lingoswap.deleteAccountButton">
<!-- show the awesome delete account button that's not for nincompoops -->
</security:protect>