Package eu.woolplatform.utils.http
Class OAuthUtils
- java.lang.Object
-
- eu.woolplatform.utils.http.OAuthUtils
-
public class OAuthUtils extends Object
Helper methods for OAuth.
-
-
Constructor Summary
Constructors Constructor Description OAuthUtils(String consumerKey, String consumerSecret)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOAuthSignature(Map<String,String> params, String baseUrl, String tokenSecret)Adds parameter oauth_signature to the specified oauth_* parameters.URLbuildUrl(String baseUrl, Map<String,String> params, String token, String tokenSecret)Builds a URL from the specified base URL and parameters.Map<String,String>getOAuthParams(String token)Gets oauth_* parameters without oauth_signature.Map<String,String>getSignedOAuthParams(String baseUrl, String token, String tokenSecret)Gets oauth_* parameters with oauth_signature.
-
-
-
Method Detail
-
buildUrl
public URL buildUrl(String baseUrl, Map<String,String> params, String token, String tokenSecret)
Builds a URL from the specified base URL and parameters. It adds all oauth_* parameters including the signature.- Parameters:
baseUrl- the base URLparams- the parameters (can be empty or null)token- the oauth tokentokenSecret- the oauth token secret- Returns:
- the URL
-
getSignedOAuthParams
public Map<String,String> getSignedOAuthParams(String baseUrl, String token, String tokenSecret)
Gets oauth_* parameters with oauth_signature.- Parameters:
baseUrl- the base URL (before parameters)token- the OAuth tokentokenSecret- the OAuth token secret- Returns:
- the oauth_* parameters with oauth_signature
-
getOAuthParams
public Map<String,String> getOAuthParams(String token)
Gets oauth_* parameters without oauth_signature. You can sign it afterwards withaddOAuthSignature(). You may add other oauth parameters in between. If you don't want to add other oauth parameters, you can usegetSignedOAuthParams().- Parameters:
token- the token or null- Returns:
- the oauth_* parameters
-
-