AnsweredAssumed Answered

Override authenticationService

Question asked by ajv on Jan 27, 2008
Hi,

I'm trying to override the authenticationService using method injection (I want to change only one method).

So, I configure authentication-services-context.xml like this:

   <bean id="authenticationService" class="org.alfresco.repo.security.authentication.AuthenticationServiceImpl">
           <property name="authenticationDao">
               <ref bean="authenticationDao" />
           </property>
           <property name="ticketComponent">
               <ref bean="ticketComponent" />
           </property>
           <property name="authenticationComponent">
               <ref bean="authenticationComponent" />
           </property>
      <replaced-method name="updateAuthentication" replacer="authenticationReplacer" />
   </bean>

   <bean id="authenticationReplacer" class="org.alfresco.custom.AuthenticationServiceImplCustom"/>


The new class implements MethodReplacer interface:

public class AuthenticationServiceImplCustom implements MethodReplacer {
   
   private static Log s_logger = Functions.createLog(AuthenticationServiceImplCustom.class);
   
   public Object reimplement (Object target, Method method, Object [] args) throws Throwable {
      try {
         Functions.reportLog(s_logger, "Update Password NEW!!….");
         Functions.reportLog(s_logger, "Params: ");
         for (int i = 0; i < args.length; i++) {
            Functions.reportLog(s_logger, i + ".- " + args[i]);
         }
         
      } catch (Exception e) {
         e.printStackTrace();
      }
      return null;
   }

}

When I change the user password, the updateAuthentication method was not replaced…. :cry:

What am I doing wrong to override this method?
Thanks in advanced (and sorry by my english).

Outcomes