@Override public RestOperations getApi(String accessToken, String secret) { return new GenericApiBinding(getConsumerKey(), getConsumerSecret(), accessToken, secret).getRestTemplate(); }
/** * After construction, include option to decorate the {@link RestTemplate} followed by an optional * configuration step. Many providers initialize sub-APIs, and this provides a convenient hook. * @throws Exception if any error occurs decorating the RestTemplate */ @Override public void afterPropertiesSet() throws Exception { this.restTemplate = postProcess(this.restTemplate); postConstructionConfiguration(); }
/** * Creates an OAuth 1.0 protected resource request interceptor. * @param accessToken the access token and secret */ public OAuth1RequestInterceptor(OAuth1Credentials oauth1Credentials) { this.oauth1Credentials = oauth1Credentials; this.signingUtils = new SigningSupport(); }
private String buildOAuth1Url(OAuth1Operations oauthOperations, String requestToken, OAuth1Parameters parameters) { if (useAuthenticateUrl) { return oauthOperations.buildAuthenticateUrl(requestToken, parameters); } else { return oauthOperations.buildAuthorizeUrl(requestToken, parameters); } }
/** * Creates an {@link OAuthToken} given the response from the request token or access token exchange with the provider. * May be overridden to create a custom {@link OAuthToken}. * @param tokenValue the token value received from the provider. * @param tokenSecret the token secret received from the provider. * @param response all parameters from the response received in the request/access token exchange. * @return an {@link OAuthToken} */ protected OAuthToken createOAuthToken(String tokenValue, String tokenSecret, MultiValueMap<String, String> response) { return new OAuthToken(tokenValue, tokenSecret); }
/** * The request token value. * @return the token's value */ public String getValue() { return requestToken.getValue(); }
private String buildAuthorizationHeaderValue(URI tokenUrl, Map<String, String> tokenParameters, MultiValueMap<String, String> additionalParameters, String tokenSecret) { Map<String, String> oauthParameters = signingUtils.commonOAuthParameters(consumerKey); oauthParameters.putAll(tokenParameters); if (additionalParameters == null) { additionalParameters = EmptyMultiValueMap.instance(); } return signingUtils.buildAuthorizationHeaderValue(HttpMethod.POST, tokenUrl, oauthParameters, additionalParameters, consumerSecret, tokenSecret); }
public DropboxServiceProvider(String consumerKey, String consumerSecret, boolean appFolder) { super(consumerKey, consumerSecret, new OAuth1Template(consumerKey, consumerSecret, "https://api.dropbox.com/1/oauth/request_token", "https://www.dropbox.com/1/oauth/authorize", "https://api.dropbox.com/1/oauth/access_token", OAuth1Version.CORE_10)); this.appFolder = appFolder; }
/** * Constructs the API template without user authorization. This is useful for accessing operations on a provider's API that do not require user authorization. */ protected AbstractOAuth1ApiBinding() { credentials = null; restTemplate = createRestTemplateWithCulledMessageConverters(); configureRestTemplate(restTemplate); }
/** * The authorization callback url. * @return The authorization callback url. */ public String getCallbackUrl() { return getFirst(OAUTH_CALLBACK); }
@Override public RestTemplate getRestTemplate() { if (clientRestTemplate != null) { return clientRestTemplate; } return super.getRestTemplate(); }
/** * Sets the authorization callback url. * This value must be included for OAuth 1.0 providers (and NOT for OAuth 1.0a). * @param callbackUrl The authorization callback url. */ public void setCallbackUrl(String callbackUrl) { set(OAUTH_CALLBACK, callbackUrl); }
@Override public RestOperations getApi(String accessToken, String secret) { return new GenericApiBinding(getConsumerKey(), getConsumerSecret(), accessToken, secret).getRestTemplate(); }
/** * Creates an {@link OAuthToken} given the response from the request token or access token exchange with the provider. * May be overridden to create a custom {@link OAuthToken}. * @param tokenValue the token value received from the provider. * @param tokenSecret the token secret received from the provider. * @param response all parameters from the response received in the request/access token exchange. * @return an {@link OAuthToken} */ protected OAuthToken createOAuthToken(String tokenValue, String tokenSecret, MultiValueMap<String, String> response) { return new OAuthToken(tokenValue, tokenSecret); }
/** * The request token value. * @return the token's value */ public String getValue() { return requestToken.getValue(); }
public TwitterServiceProvider(String consumerKey, String consumerSecret) { super(consumerKey, consumerSecret, new OAuth1Template(consumerKey, consumerSecret, "https://api.twitter.com/oauth/request_token", "https://api.twitter.com/oauth/authorize", "https://api.twitter.com/oauth/authenticate", "https://api.twitter.com/oauth/access_token")); }
/** * After construction, include option to decorate the {@link RestTemplate} followed by an optional * configuration step. Many providers initialize sub-APIs, and this provides a convenient hook. * @throws Exception if any error occurs decorating the RestTemplate */ @Override public void afterPropertiesSet() throws Exception { this.restTemplate = postProcess(this.restTemplate); postConstructionConfiguration(); }
/** * Creates an OAuth 1.0 protected resource request interceptor. * @param accessToken the access token and secret */ public OAuth1RequestInterceptor(OAuth1Credentials oauth1Credentials) { this.oauth1Credentials = oauth1Credentials; this.signingUtils = new SigningSupport(); }
/** * The authorization callback url. * @return The authorization callback url. */ public String getCallbackUrl() { return getFirst(OAUTH_CALLBACK); }
@Override public RestTemplate getRestTemplate() { if (clientRestTemplate != null) { return clientRestTemplate; } return super.getRestTemplate(); }