The HTTP Basic authorization header is always added to the request no matter you call setUseParametersForClientAuthentication with true because the interceptor PreemptiveBasicAuthClientHttpRequestInterceptor is added in the constructor.
This configuration should be done by overriding a method or by adding a parameter in the constructor.
In unit tests class 'OAuth2TemplateTest', we should update the code:
if (expectedAuthorizationHeader != null) {
responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
}
by something like :
if (expectedAuthorizationHeader == null) {
// Expect 'Authorization' is not present
} else {
responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
}
The HTTP Basic authorization header is always added to the request no matter you call setUseParametersForClientAuthentication with true because the interceptor PreemptiveBasicAuthClientHttpRequestInterceptor is added in the constructor.
This configuration should be done by overriding a method or by adding a parameter in the constructor.
In unit tests class 'OAuth2TemplateTest', we should update the code:
by something like :