Source:
public DataFlowOperations dataFlowOperations() throws Exception{ RestTemplate template = DataFlowTemplate.prepareRestTemplate(restTemplate); final HttpClientConfigurer httpClientConfigurer = HttpClientConfigurer.create(new URI(properties.getServerUri())) .skipTlsCertificateVerification(properties.isSkipSslValidation()); if (StringUtils.hasText(this.properties.getAuthentication().getAccessToken())) { template.getInterceptors().add(new OAuth2AccessTokenProvidingClientHttpRequestInterceptor(this.properties.getAuthentication().getAccessToken())); logger.debug("Configured OAuth2 Access Token for accessing the Data Flow Server"); } else if (StringUtils.hasText(this.properties.getAuthentication().getClientId())) { ClientRegistration clientRegistration = clientRegistrations.findByRegistrationId("default"); OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration); OAuth2AccessTokenResponse res = clientCredentialsTokenResponseClient.getTokenResponse(grantRequest); String accessTokenValue = res.getAccessToken().getTokenValue(); template.getInterceptors().add(new OAuth2AccessTokenProvidingClientHttpRequestInterceptor(accessTokenValue)); logger.debug("Configured OAuth2 Client Credentials for accessing the Data Flow Server"); } else if(!StringUtils.isEmpty(properties.getAuthentication().getBasic().getUsername()) && !StringUtils.isEmpty(properties.getAuthentication().getBasic().getPassword())){ httpClientConfigurer.basicAuthCredentials(properties.getAuthentication().getBasic().getUsername(), properties.getAuthentication().getBasic().getPassword()); template.setRequestFactory(httpClientConfigurer.buildClientHttpRequestFactory()); } else { logger.debug("Not configuring security for accessing the Data Flow Server"); } return new DataFlowTemplate(new URI(properties.getServerUri()), template); }

Target:
public DataFlowOperations dataFlowOperations() throws Exception{ RestTemplate template = DataFlowTemplate.prepareRestTemplate(restTemplate); final HttpClientConfigurer httpClientConfigurer = HttpClientConfigurer.create(new URI(properties.getServerUri())) .skipTlsCertificateVerification(properties.isSkipSslValidation()); if (StringUtils.hasText(this.properties.getAuthentication().getAccessToken())) { template.getInterceptors().add(new OAuth2AccessTokenProvidingClientHttpRequestInterceptor(this.properties.getAuthentication().getAccessToken())); logger.debug("Configured OAuth2 Access Token for accessing the Data Flow Server"); } else if (StringUtils.hasText(this.properties.getAuthentication().getClientId())) { ClientRegistration clientRegistration = clientRegistrations.findByRegistrationId(DEFAULT_REGISTRATION_ID); OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration); OAuth2AccessTokenResponse res = clientCredentialsTokenResponseClient.getTokenResponse(grantRequest); String accessTokenValue = res.getAccessToken().getTokenValue(); template.getInterceptors().add(new OAuth2AccessTokenProvidingClientHttpRequestInterceptor(accessTokenValue)); logger.debug("Configured OAuth2 Client Credentials for accessing the Data Flow Server"); } else if(!StringUtils.isEmpty(properties.getAuthentication().getBasic().getUsername()) && !StringUtils.isEmpty(properties.getAuthentication().getBasic().getPassword())){ httpClientConfigurer.basicAuthCredentials(properties.getAuthentication().getBasic().getUsername(), properties.getAuthentication().getBasic().getPassword()); template.setRequestFactory(httpClientConfigurer.buildClientHttpRequestFactory()); } else { logger.debug("Not configuring security for accessing the Data Flow Server"); } return new DataFlowTemplate(new URI(properties.getServerUri()), template); }