FIXED - task 614: Use same instance of OAuthProvider in OAuth dance. Patch supplied by sdeo@google.com
http://code.google.com/p/google-refine/issues/detail?id=614 git-svn-id: http://google-refine.googlecode.com/svn/trunk@2566 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
0cab117351
commit
27e3c0c8dc
@ -77,7 +77,7 @@ public class AuthorizeCommand extends Command {
|
||||
Credentials request_credentials = Credentials.getCredentials(request, provider, Credentials.Type.REQUEST);
|
||||
|
||||
OAuthConsumer consumer = OAuthUtilities.getConsumer(request_credentials, provider);
|
||||
OAuthProvider pp = OAuthUtilities.getOAuthProvider(provider);
|
||||
OAuthProvider pp = provider.getProvider();
|
||||
|
||||
if (request_credentials == null) {
|
||||
// no credentials were found, so let's start the dance
|
||||
|
@ -39,8 +39,6 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import oauth.signpost.OAuthConsumer;
|
||||
import oauth.signpost.OAuthProvider;
|
||||
import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
|
||||
|
||||
public class OAuthUtilities {
|
||||
|
||||
@ -87,9 +85,5 @@ public class OAuthUtilities {
|
||||
}
|
||||
return consumer;
|
||||
}
|
||||
|
||||
public static OAuthProvider getOAuthProvider(Provider p) {
|
||||
return new CommonsHttpOAuthProvider(p.getRequestTokenServiceURL(), p.getAccessTokenServiceURL(), p.getUserAuthorizationURL());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,11 +34,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
package com.google.refine.oauth;
|
||||
|
||||
import oauth.signpost.OAuthConsumer;
|
||||
import oauth.signpost.OAuthProvider;
|
||||
import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
|
||||
import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
|
||||
|
||||
public abstract class Provider {
|
||||
|
||||
protected String host;
|
||||
protected OAuthProvider oauthProvider;
|
||||
|
||||
public Provider() {
|
||||
}
|
||||
@ -62,4 +65,12 @@ public abstract class Provider {
|
||||
public OAuthConsumer createConsumer(String consumerKey, String consumerSecret) {
|
||||
return new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
|
||||
}
|
||||
|
||||
public synchronized OAuthProvider getProvider() {
|
||||
if (oauthProvider == null) {
|
||||
oauthProvider = new CommonsHttpOAuthProvider(
|
||||
getRequestTokenServiceURL(), getAccessTokenServiceURL(), getUserAuthorizationURL());
|
||||
}
|
||||
return oauthProvider;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user