Access Keys:
Skip to content (Access Key - 0)

Apply Security to Managers and DAOs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

You can secure methods on a per-role basis in security.xml. This file is merged into your WEB-INF directory from AppFuse's common-web project. However, you can override it by copying it into your own project's src/main/webapp/WEB-INF directory. Here is the current code you'll need to modify to security more beans:

    <!-- Apply method-level interceptor to userManager bean -->
    <aop:config>
        <aop:advisor id="managerSecurity" advice-ref="methodSecurityInterceptor" 
            pointcut="execution(* org.appfuse.service.UserManager.*(..))"/>
    </aop:config>

    <bean id="methodSecurityInterceptor" class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="accessDecisionManager" ref="accessDecisionManager"/>
        <property name="objectDefinitionSource">
             <value>
                 org.appfuse.service.UserManager.getUsers=admin
                 org.appfuse.service.UserManager.removeUser=admin
             </value>
        </property>
    </bean>

The easiest way to copy the security.xml file into your project is:

  1. Run mvn package.
  2. Copy target/yourproject-version/WEB-INF/security.xml to src/main/webapp/WEB-INF.
Adaptavist Theme Builder (4.0.0-M8) Powered by Atlassian Confluence 3.1, the Enterprise Wiki.