Announcement Announcement Module
No announcement yet.
Rest service with ldap authentication and OAuth 1.0 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ()));
    factory.setAdditionalOAuthParameters(additionalOAu thParameters);

    but it doesn't work! i don't see any header called Authorization in HTTPWatch

    thank you!

  • #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.


    • #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.