acegi struts-menu

acegi的配置,注册securityContextHolderAwareRequestFilter,将securityContextHolderAwareRequestFilter加到filterChainProxy中
<bean id="securityContextHolderAwareRequestFilter" class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter"/>

<bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
        <property name="filterInvocationDefinitionSource">
            <value>  
                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON 
                PATTERN_TYPE_APACHE_ANT 
                /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,exceptionTranslationFilter,filterSecurityInterceptor,logoutFilter,rememberMeProcessingFilter
            </value>
        </property>
    </bean>

这样配制是为了让struts-menu得到权限(struts-menu内置了对acegi的支持)

strusts-menu的写法,roles后是角色
<Menu  name="usermenu" title="用户管理" roles="ROLE_USER">
            <Item title="人员管理" image="/xwweb/images/case-pub.png" page=""/>
            <Item title="角色管理" image="/xwweb/images/activate.png" page="" />
 </Menu>


页面的写法,注意permissions = "rolesAdapter"
<menu:useMenuDisplayer name="DropDown" permissions = "rolesAdapter">
            <table cellpadding=0 cellspacing=0>
              <tr>
                <td>
                  <menu:displayMenu name="infomenu" target="filewindow"/>
                </td>
              </tr>
               <tr>
                <td>
                  <menu:displayMenu name="usermenu" target="filewindow"/>
                </td>
              </tr>
            </table>
 </menu:useMenuDisplayer>

你可能感兴趣的:(java,apache,struts,ant,Acegi)