docs: @Override
      public Authentication authenticate(Authentication authentication) throws AuthenticationException {
          if (authentication == null) {
              return authentication;
          }
          UsernamePasswordAuthenticationToken output = null;
          if (authentication instanceof UsernamePasswordAuthenticationToken) {
              output = (UsernamePasswordAuthenticationToken) authentication;
          } else {
              output = new UsernamePasswordAuthenticationToken(authentication, authentication.getCredentials(),
                              authentication.getAuthorities());
              output.setAuthenticated(authentication.isAuthenticated());
              output.setDetails(authentication.getDetails());
          }
          return delegate.authenticate(output);
      }