@Override
    public Authentication authenticate(Authentication authentication)
        throws AuthenticationException {

      try {
        Object auth = getProxyFactory().createProxy(authentication);
        Method authenticate =
            ProxyUtils.findMethodByName(target.getClass(), "authenticate", auth.getClass());
        Object retVal = authenticate.invoke(target, auth);

        if (retVal != null) {
          return getProxyFactory().createProxy(retVal);
        }

      } catch (InvocationTargetException | IllegalAccessException | ProxyException e) {
        logger.error(e.getMessage(), e);
      }

      return null;
    }
 protected IProxyFactory getProxyFactory() {
   return ProxyUtils.getInstance().getProxyFactory();
 }
 @Override
 public boolean supports(Class aClass) {
   return ProxyUtils.isRecursivelySupported(
       "org.springframework.security.authentication.AuthenticationManager", aClass);
 }