package com.appdirect.sdk.web.oauth;

import java.io.IOException;
import java.net.URI;
import java.util.Base64;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;


public class BasicAuthRestTemplate extends RestTemplate {
    private final String username;
    private final String password;

    public BasicAuthRestTemplate(String username, String password) {
        super(clientHttpRequestFactory());
        this.username = username;
        this.password = password;
    }

    private static ClientHttpRequestFactory clientHttpRequestFactory() {
        return new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
    }


    @Override
    protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException {
        ClientHttpRequest request = super.createRequest(url, method);

        String authorization = Base64.getEncoder().encodeToString((this.username + ":" + this.password).getBytes());
        request.getHeaders().set(HttpHeaders.AUTHORIZATION, "Basic " + authorization);

        return request;
    }
}

@@ -644,16 +644,65 @@
 assword;
+%0A    private static final String BASIC = %22Basic%22;
 %0A%0A    pu
@@ -1416,16 +1416,13 @@
 ON, 
-%22Basic %22
+BASIC
  + a

Adding constant