Example usage for org.springframework.security.oauth2.client OAuth2RestTemplate put

List of usage examples for org.springframework.security.oauth2.client OAuth2RestTemplate put

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.client OAuth2RestTemplate put.

Prototype

@Override
    public void put(URI url, @Nullable Object request) throws RestClientException 

Source Link

Usage

From source file:com.ge.predix.test.utils.PrivilegeHelper.java

public BaseResource putResource(final OAuth2RestTemplate acsTemplate, final BaseResource resource,
        final String endpoint, final HttpHeaders headers, final Attribute... attributes) throws Exception {

    resource.setAttributes(new HashSet<>(Arrays.asList(attributes)));

    String value = URLEncoder.encode(resource.getResourceIdentifier(), "UTF-8");

    URI uri = new URI(endpoint + ACS_RESOURCE_API_PATH + value);
    acsTemplate.put(uri, new HttpEntity<>(resource, headers));
    return resource;
}

From source file:com.ge.predix.test.utils.PrivilegeHelper.java

public BaseSubject putSubject(final OAuth2RestTemplate acsTemplate, final BaseSubject subject,
        final String endpoint, final HttpHeaders headers, final Attribute... attributes)
        throws UnsupportedEncodingException {

    subject.setAttributes(new HashSet<>(Arrays.asList(attributes)));
    URI subjectUri = URI.create(
            endpoint + ACS_SUBJECT_API_PATH + URLEncoder.encode(subject.getSubjectIdentifier(), "UTF-8"));
    acsTemplate.put(subjectUri, new HttpEntity<>(subject, headers));
    return subject;
}