Example usage for org.springframework.security.oauth.consumer.client OAuthRestTemplate postForEntity

List of usage examples for org.springframework.security.oauth.consumer.client OAuthRestTemplate postForEntity

Introduction

In this page you can find the example usage for org.springframework.security.oauth.consumer.client OAuthRestTemplate postForEntity.

Prototype

@Override
    public <T> ResponseEntity<T> postForEntity(String url, @Nullable Object request, Class<T> responseType,
            Object... uriVariables) throws RestClientException 

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);/*  w w  w . ja v  a 2 s.c o  m*/
    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;
}