code: public void setAuthenticationToken(Authentication authentication) {
          if( logger.isDebugEnabled() ) {
              logger.debug("New authentication token: " + authentication);
          }
  
          HttpComponentsHttpInvokerRequestExecutor executor
                  = (HttpComponentsHttpInvokerRequestExecutor) getHttpInvokerRequestExecutor();
          DefaultHttpClient httpClient = (DefaultHttpClient) executor.getHttpClient();
          BasicCredentialsProvider provider = new BasicCredentialsProvider();
          httpClient.setCredentialsProvider(provider);
          httpClient.addRequestInterceptor(new PreemptiveAuthInterceptor());
          UsernamePasswordCredentials usernamePasswordCredentials;
          if (authentication != null) {
              usernamePasswordCredentials = new UsernamePasswordCredentials(
                      authentication.getName(), authentication.getCredentials().toString());
          } else {
              usernamePasswordCredentials = null;
          }
          provider.setCredentials(AuthScope.ANY, usernamePasswordCredentials);
      }
docs: Handle a change in the current authentication token.
  This method will fail fast if the executor isn't a CommonsHttpInvokerRequestExecutor.
  @see org.valkyriercp.security.AuthenticationAware#setAuthenticationToken(org.springframework.security.core.Authentication)