Announcement Announcement Module
No announcement yet.
AuthenticationManager not autowiring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AuthenticationManager not autowiring


    Im trying to autowire my authenticationManager in my CallbackHandler...something like this:

    public class ServerPasswordCallback implements CallbackHandler {

    protected Logger log = Logger.getLogger(ServerPasswordCallback.class);

    AuthenticationManager authenticationManager;

    public void handle(Callback[] callbacks) throws IOException,
    UnsupportedCallbackException {

    //if a type of WSPasswordhandler comes by,
    WSPasswordCallback pc = null;
    for (Callback callback : callbacks) {
    if (callback instanceof WSPasswordCallback) {
    pc = (WSPasswordCallback)callback;

    But I cant get the @Autowired to work...The authenticationManager stays empty. I have declared the alias on it like:

    <security:authentication-manager alias="authenticationManager">
    <security:authentication-provider user-service-ref="customUserDetailsService">

    and if i autowire the AuthenticationManager in a junit works fine. Can somebody tell me why this wont work in my callback handler?

    Im using Spring 3.0.5.RELEASE with Spring security 3.0.1.RELEASE and WSS4J 1.5.10 of

    Best regards!
    Last edited by misterPom; Feb 4th, 2011, 04:47 AM.

  • #2
    Please use [ code][/code ] tags when posting code, that way it remains readable.

    Is the bean you want to use for autowiring defined in the same context as the AuthenticationManager or a child context of the context that defines the authenticationmanager. Also is the context enabled for autowiring (ie. context:annotation-config or context:component-scan).

    Also maker sure you aren't instantiating a component yourself use the one defined/scanned in the applicationcontext.


    • #3
      I used <context:component-scan in my applicationContext.xml. In applicationContext-security.xml I declared the AuthenticationManager. I missed it that the AuthenticationManager is not on my scan path ofcourse...stupid mistake. I added context:annotation-config to the security context and it wires fine. Thanks!