本文整理汇总了Java中oauth.signpost.OAuthProvider类的典型用法代码示例。如果您正苦于以下问题:Java OAuthProvider类的具体用法?Java OAuthProvider怎么用?Java OAuthProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OAuthProvider类属于oauth.signpost包,在下文中一共展示了OAuthProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHttpClient
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
/**
* Use a specific {@link HttpClient} for HTTP traffic.
*
* @param httpClient
* {@link HttpClient}, that is used for HTTP communication
*/
public synchronized void setHttpClient( HttpClient httpClient )
{
this.httpClient = httpClient;
// register HTTP client in the OAuth provider
try
{
OAuthProvider p = getAuthProvider();
if (p instanceof CommonsHttpOAuthProvider)
{
((CommonsHttpOAuthProvider) p).setHttpClient( httpClient );
}
}
catch (OAuthNotAuthorizedException ex)
{
}
}
示例2: getProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
private OAuthProvider getProvider() {
// use our http client that accepts self-signed certificates
DefaultHttpClient httpclient = MySSLSocketFactory.getNewHttpClient();
// Use the provider bundled with signpost, the android libs are buggy
// See: http://code.google.com/p/oauth-signpost/issues/detail?id=20
OAuthProvider provider = new CommonsHttpOAuthProvider(
requestTokenUrl,
accessTokenUrl,
authorizeUrl,
httpclient);
provider.setOAuth10a(oauth10a);
return provider;
}
示例3: loadInBackground
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
@Override
public URL loadInBackground() {
NoteblurApplication app = (NoteblurApplication) getContext().getApplicationContext();
OAuthConsumer consumer = app.consumer;
OAuthProvider provider = app.provider;
try {
String authUrl = provider
.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);
SharedPreferences prefs = getContext().getSharedPreferences("bob", 0);
prefs.edit().putString("TOKEN", consumer.getToken())
.putString("SECRET", consumer.getTokenSecret())
.commit();
return new URL(authUrl);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
throw new RuntimeException(e);
}
}
示例4: create
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public static OAuthWebViewDialogFragment create(@NonNull OAuthConsumer consumer,
@NonNull OAuthProvider provider) {
OAuthWebViewDialogFragment f = new OAuthWebViewDialogFragment();
Bundle args = new Bundle();
args.putSerializable(CONSUMER, consumer);
args.putSerializable(PROVIDER, provider);
f.setArguments(args);
return f;
}
示例5: oAuthProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
@Provides public static OAuthProvider oAuthProvider()
{
return new DefaultOAuthProvider(
BASE_OAUTH_URL + "request_token",
BASE_OAUTH_URL + "access_token",
BASE_OAUTH_URL + "authorize");
}
示例6: buildOAuthProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
@Override
protected OAuthProvider buildOAuthProvider( String apiBaseUrl )
{
if (httpClient==null) setDefaultHttpClient();
return new CommonsHttpOAuthProvider(
apiBaseUrl + "/security/oauth/request_token",
apiBaseUrl + "/security/oauth/access_token",
apiBaseUrl + "/security/oauth/confirm_access",
httpClient );
}
示例7: RetrieveAccessTokenTask
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public RetrieveAccessTokenTask(Context context, OAuthConsumer consumer,OAuthProvider provider, SharedPreferences prefs) {
this.context = context;
this.consumer = consumer;
this.provider = provider;
this.prefs=prefs;
}
示例8: buildProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
/**
* Builds an {@see OAuthProvider} based on these parameters and a OAuth consumer <code>consumer</code>.
*
* @return the provider
* @throws IllegalArgumentException thrown if consumer is null
*/
public OAuthProvider buildProvider() throws IllegalArgumentException {
return new CommonsHttpOAuthProvider(
requestTokenUrl,
accessTokenUrl,
authoriseUrl
);
}
示例9: loadInBackground
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
@Override
public String loadInBackground() {
NoteblurApplication app = (NoteblurApplication) getContext().getApplicationContext();
OAuthConsumer consumer = app.consumer;
OAuthProvider provider = app.provider;
try {
provider.retrieveAccessToken(consumer, pin);
URL url = new URL("http://api.tumblr.com/v2/user/info");
HttpURLConnection request = (HttpURLConnection) url
.openConnection();
consumer.sign(request);
InputStream stream = request.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(stream));
StringBuilder total = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
total.append(line);
}
return total.toString();
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
throw new RuntimeException(e);
}
}
示例10: createProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public static OAuthProvider createProvider() {
return new DefaultOAuthProvider(
BASE_OAUTH_URL + "request_token",
BASE_OAUTH_URL + "access_token",
BASE_OAUTH_URL + "authorize");
}
示例11: getProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public OAuthProvider getProvider() {
return provider;
}
示例12: GetOSMAuthProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public static OAuthProvider GetOSMAuthProvider(Context ctx) {
return new CommonsHttpOAuthProvider(ctx.getString(R.string.osm_requesttoken_url),
ctx.getString(R.string.osm_accesstoken_url), ctx.getString(R.string.osm_authorize_url));
}
示例13: OAuthRequestTokenTask
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public OAuthRequestTokenTask(Context context, OAuthConsumer consumer,OAuthProvider provider, WebView webView) {
this.consumer = consumer;
this.provider = provider;
this.dialog = new ProgressDialog(context);
this.webView = webView;
}
示例14: RetrieveAccessTokenTask
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public RetrieveAccessTokenTask(Context context, OAuthConsumer consumer, OAuthProvider provider) {
this.context = context;
this.consumer = consumer;
this.provider = provider;
}
示例15: getOAuthProvider
import oauth.signpost.OAuthProvider; //导入依赖的package包/类
public static OAuthProvider getOAuthProvider() {
return provider;
}