Example usage for org.springframework.security.oauth.consumer BaseProtectedResourceDetails setId

List of usage examples for org.springframework.security.oauth.consumer BaseProtectedResourceDetails setId

Introduction

In this page you can find the example usage for org.springframework.security.oauth.consumer BaseProtectedResourceDetails setId.

Prototype

public void setId(String id) 

Source Link

Usage

From source file:ltistarter.oauth.OAuthUtils.java

public static ResponseEntity sendOAuth1Request(String url, String consumerKey, String sharedSecret,
        Map<String, String> params, Map<String, String> headers) {
    assert url != null;
    assert consumerKey != null;
    assert sharedSecret != null;
    BaseProtectedResourceDetails prd = new BaseProtectedResourceDetails();
    prd.setId("oauth");
    prd.setConsumerKey(consumerKey);/*from  www .  j a v  a2s  .  c om*/
    prd.setSharedSecret(new SharedConsumerSecretImpl(sharedSecret));
    prd.setAdditionalParameters(params);
    prd.setAdditionalRequestHeaders(headers);
    OAuthRestTemplate restTemplate = new OAuthRestTemplate(prd);
    ResponseEntity<String> response = restTemplate.postForEntity(url, params, String.class,
            (Map<String, ?>) null);
    return response;
}