List of usage examples for org.springframework.security.oauth2.client.resource BaseOAuth2ProtectedResourceDetails setClientSecret
public void setClientSecret(String clientSecret)
From source file:ltistarter.oauth.OAuthUtils.java
public static ResponseEntity sendOAuth2Request(String url, String clientId, String clientSecret, String accessTokenURI, Map<String, String> params) { assert url != null; assert clientId != null; assert clientSecret != null; AuthorizationCodeAccessTokenProvider provider = new AuthorizationCodeAccessTokenProvider(); BaseOAuth2ProtectedResourceDetails resource = new BaseOAuth2ProtectedResourceDetails(); resource.setClientAuthenticationScheme(AuthenticationScheme.form); resource.setClientId(clientId);//from w w w. j av a 2s. c o m resource.setClientSecret(clientSecret); resource.setAccessTokenUri(accessTokenURI); resource.setGrantType("access"); OAuth2AccessToken accessToken = provider.obtainAccessToken(resource, new DefaultAccessTokenRequest()); OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(resource, new DefaultOAuth2ClientContext(accessToken)); ResponseEntity<String> response = restTemplate.postForEntity(url, params, String.class, (Map<String, ?>) null); return response; }
From source file:com.feedeo.rest.client.AbstractOAuth2RestClient.java
public void setClientSecret(String clientSecret) { OAuth2RestTemplate restOperations = (OAuth2RestTemplate) getRestOperations(); BaseOAuth2ProtectedResourceDetails resource = (BaseOAuth2ProtectedResourceDetails) restOperations .getResource();//from w ww. j a v a 2s .c om resource.setClientSecret(clientSecret); }
From source file:org.cloudfoundry.identity.client.UaaContextFactory.java
/** * Sets the client_id and client_secret on the resource details object * @param tokenRequest the token request containing the client_id and client_secret * @param details the details object that. will be configured *//*from w w w. j av a 2s.co m*/ protected void setClientCredentials(TokenRequest tokenRequest, BaseOAuth2ProtectedResourceDetails details) { details.setClientId(tokenRequest.getClientId()); details.setClientSecret(tokenRequest.getClientSecret()); }