spring-attic / spring-social

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.
http://projects.spring.io/spring-social
Apache License 2.0
619 stars 351 forks source link

OAuth2Template's useParametersForClientAuthentication field does not work properly #75

Open bbaia opened 11 years ago

bbaia commented 11 years ago

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));  
}