Spring Security
  1. Spring Security
  2. SEC-1162

Incorrect warning created when using <authentication-manager alias="foo"/> to give AuthenticationManager an id to reference

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0 M2
    • Component/s: Namespace
    • Labels:
      None
    • Environment:
      Latest stable version of all plugins.
      Eclipse Ganymede, version: 3.4.2, Build id: M20090211-1700.
      Java SE 6 from Sun.
      Xubuntu 8.04.

      Description

      When using Spring Security using <authentication-manager alias="foo"/> makes it possible to reference the AuthenticationManager used with the id foo. However this is not noticed by Spring IDE which adds a warning of the form: Referenced bean 'foo' not found

      It should be noted that the code works when it's run. See Spring Forum thread for more details.

        Activity

        Hide
        Kent Larsson added a comment -

        I didn't know which Component this issue relates to, please change it into the proper one.

        Show
        Kent Larsson added a comment - I didn't know which Component this issue relates to, please change it into the proper one.
        Hide
        Christian Dupuis added a comment -

        Luke, this is a problem in AuthenticationManagerBeanDefinitionParser not using the Tooling API to register the authenticationManager bean and the alias.

        Show
        Christian Dupuis added a comment - Luke, this is a problem in AuthenticationManagerBeanDefinitionParser not using the Tooling API to register the authenticationManager bean and the alias.
        Hide
        Luke Taylor added a comment -

        Christian,

        I've made an attempt at fixing this issue by registering a BeanComponentDefintion for the AuthenticationManager, but I've had some problems.

        Firstly, I couldn't get the AuthenticationManager bean instance to appear in Spring IDE unless I explicitly declare a "source" object. Could you confirm whether Spring IDE will show beans which do not have a source property? The AuthenticationManager is registered internally by the namespace, so it doesn't really make sense for it to be attached to a specific HTML element.

        I managed to get the alias to appear (and the error to go away) by using the method:

        pc.getReaderContext().fireAliasRegistered(BeanIds.AUTHENTICATION_MANAGER, alias, pc.extractSource(element));

        after registering the alias using

        pc.getRegistry().registerAlias(BeanIds.AUTHENTICATION_MANAGER, alias);

        Is that the correct approach? The alias just appears as a little bean icon with a square round it and the alias name next to it. There is no indication of what it actually aliases. The warning in the XML editor only goes away when the AuthenticationMananger bean is visible, so I would like to find a better solution for that, other than giving it a source object.

        Show
        Luke Taylor added a comment - Christian, I've made an attempt at fixing this issue by registering a BeanComponentDefintion for the AuthenticationManager, but I've had some problems. Firstly, I couldn't get the AuthenticationManager bean instance to appear in Spring IDE unless I explicitly declare a "source" object. Could you confirm whether Spring IDE will show beans which do not have a source property? The AuthenticationManager is registered internally by the namespace, so it doesn't really make sense for it to be attached to a specific HTML element. I managed to get the alias to appear (and the error to go away) by using the method: pc.getReaderContext().fireAliasRegistered(BeanIds.AUTHENTICATION_MANAGER, alias, pc.extractSource(element)); after registering the alias using pc.getRegistry().registerAlias(BeanIds.AUTHENTICATION_MANAGER, alias); Is that the correct approach? The alias just appears as a little bean icon with a square round it and the alias name next to it. There is no indication of what it actually aliases. The warning in the XML editor only goes away when the AuthenticationMananger bean is visible, so I would like to find a better solution for that, other than giving it a source object.
        Hide
        Luke Taylor added a comment -

        I spoke with Christian some time ago and this is the correct expected. With a Spring IDE build using the latest namespace code, the alias now appears and there are no errors.

        Show
        Luke Taylor added a comment - I spoke with Christian some time ago and this is the correct expected. With a Spring IDE build using the latest namespace code, the alias now appears and there are no errors.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: