扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
系统安全
AppFuse 使用 Acegi 进行安全管理。Acegi 的配置信息位于 web\WEB-INF\classes\security.xml。事实上,Acegi 是被集成到 Spring 当中的,因此这个文件是 Spring 的配置文件格式。在 web\WEB-INF\web.xml 中,该文件被指定在应用启动前会被加载:
清单 5. web.xml 关于 Spring 配置文件的定义
...
<!-- Context Configuration locations for Spring XML files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext-*.xml,/WEB-INF/security.xml</param-value>
</context-param>
... |
本文关于系统安全的实现如下:
...
<table name='role'>
<column>id</column>
<column>name</column>
<column>description</column>
<row>
<value>1</value>
<value>admin</value>
<value><![CDATA[Administrator role (can edit Users)]]></value>
</row>
<row>
<value>2</value>
<value>user</value>
<value><![CDATA[Default role for all Users]]></value>
</row>
<row>
<value>3</value>
<value>hr</value>
<value><![CDATA[Role for employee mangement]]></value>
</row>
</table>
... |
// initialize drop-downs
if (getAvailableRoles() == null) {
List roles = |
// initialize drop-downs
if (getAvailableRoles() == null) {
List roles = |
rolelabel_admin=系统管理员
rolelabel_user=普通用户
rolelabel_hr=人事管理 |
<bean id="filterInvocationInterceptor"
class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="objectDefinitionSource">
<value>
PATTERN_TYPE_APACHE_ANT
/clickstreams.jsp*=admin
/flushCache.*=admin
/passwordHint.html*=ROLE_ANONYMOUS,admin,user
/reload.*=admin
/signup.html*=ROLE_ANONYMOUS,admin,user
/users.html*=admin
/employees.html*=hr
/**/*.html*=admin,user
</value>
</property>
</bean> |
<!--Employee-START--> <Menu name="EmployeeMenu" title="employeeList.title" |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。