Jan 16th, 2012, 07:34 AM
Rest service with ldap authentication and OAuth 1.0
i have a REST service with ldap authentication (Spring Security 3.1) and Spring OAuth 1.0.0.M5. I'm trying to consume this service but i can't avoid authentication using OAuthREstTemplate like this:
OAuthClientHttpRequestFactory factory = (OAuthClientHttpRequestFactory) oauthRestTemplate.getRequestFactory();
Map<String, String> additionalOAuthParameters = new HashMap<String, String>();
additionalOAuthParameters.put("Authorization","Bas ic " + Base64.encodeBase64("UserTest:Temporal01".getBytes ()));
but it doesn't work! i don't see any header called Authorization in HTTPWatch
Jan 17th, 2012, 04:31 AM
I'm not really an OAuth1 user so I don't know if I can help a lot, but you appear to be trying to use HTTP Basic for user authentication at the same time as OAuth, which is probably wrong? Shouldn't you use one or the other?
By the way, it looks to me like your implementation might not be thread safe (wouldn't all clients share the same RestTemplate?) And I think you need to set additional headers on the resource, not on the request factory, but that would also not be thread safe, unless all your requests come from the same user.
Jan 17th, 2012, 05:38 AM
i'm following the example sparklr/tonr and it has Oauth and basic authentication.
This code is an example to show how i add parameters to oauthRestTemplate and nothing appears in http header.