Spring Security
  1. Spring Security
  2. SEC-1213

Enhance Security Config Schema and GlobalMethodSecurityBeanDefinitionParser to allow for "Order" to be set on the MethodSecurityMetadataSourceAdvisor.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5, 3.0.0 M1
    • Fix Version/s: 3.0.0 RC1
    • Component/s: Namespace
    • Labels:
      None

      Description

      I am currently must manually configure Spring Security and cannot make use of the <global-method-security> simply because I need to set the "Order" property on MethodSecurityMetadataSourceAdvisor when it is created. I need this because I have several aspects which make use of the ability of Spring AOP's Ordering feature on my Service classes. This simple oversight results in going from a few lines of xml to tens of lines of manually configured Spring Security xml. An xml attribute would do.

      "beans.xml"
         <!-- I want to do this, notice the order="40" attribute-->
        <global-method-security secured-annotations="enabled" jsr250-annotations="enabled" order="40" /> 
      

      The current GlobalMethodSecurityBeanDefinitionParser doesn't allow for the "Order" property to be set:

      "GlobalMethodSecurityBeanDefinitionParser.java"
          private void registerAdvisor(ParserContext parserContext, Object source) {
              RootBeanDefinition advisor = new RootBeanDefinition(MethodSecurityMetadataSourceAdvisor.class);
              advisor.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
              advisor.setSource(source);
              advisor.getConstructorArgumentValues().addGenericArgumentValue(SECURITY_INTERCEPTOR_ID);
              advisor.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(DELEGATING_METHOD_DEFINITION_SOURCE_ID));
            
               // I need the Order property set here to order the Advice.
              
              parserContext.getRegistry().registerBeanDefinition(BeanIds.METHOD_SECURITY_METADATA_SOURCE_ADVISOR, advisor);
          }
      
      

        Activity

        Hide
        Luke Taylor added a comment -

        I've added an "order" attribute to global-method-security.

        Show
        Luke Taylor added a comment - I've added an "order" attribute to global-method-security.
        Hide
        Shawn Stephens added a comment -

        You rock! Thanks a ton.

        Show
        Shawn Stephens added a comment - You rock! Thanks a ton.

          People

          • Assignee:
            Luke Taylor
            Reporter:
            Shawn Stephens
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: