-
Jan 16th, 2012, 07:34 AM
#1
Rest service with ldap authentication and OAuth 1.0
Hello,
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 ()));
factory.setAdditionalOAuthParameters(additionalOAu thParameters);
but it doesn't work! i don't see any header called Authorization in HTTPWatch
thank you!
-
Jan 17th, 2012, 04:31 AM
#2
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
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules