本文整理汇总了Java中com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl类的典型用法代码示例。如果您正苦于以下问题:Java OAuthAuthorizeTemporaryTokenUrl类的具体用法?Java OAuthAuthorizeTemporaryTokenUrl怎么用?Java OAuthAuthorizeTemporaryTokenUrl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OAuthAuthorizeTemporaryTokenUrl类属于com.google.api.client.auth.oauth包,在下文中一共展示了OAuthAuthorizeTemporaryTokenUrl类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAuthURL
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
public String getAuthURL(String tempToken) throws Exception {
if (tempToken != null) {
OAuthAuthorizeTemporaryTokenUrl authorizeUrl = new OAuthAuthorizeTemporaryTokenUrl(AUTHORIZE_URL);
authorizeUrl.temporaryToken = tempToken;
// After the user has granted access to you, the consumer, the provider will
// redirect you to whatever URL you have told them to redirect to. You can
// usually define this in the oauth_callback argument as well.
//
// String currentLine = "n";
// System.out.println("Go to the following link in your browser:\n" + authorizeUrl.build());
// InputStreamReader converter = new InputStreamReader(System.in);
// BufferedReader in = new BufferedReader(converter);
// while (currentLine.equalsIgnoreCase("n")) {
// System.out.println("Have you authorized me? (y/n)");
// currentLine = in.readLine();
// }
return authorizeUrl.build();
}
else {
throw new Exception(cont.getString(R.string.error_no_temp_token));
}
}
开发者ID:phwoelfel,项目名称:FireHydrantLocator,代码行数:26,代码来源:OAuthTokenmanager.java
示例2: OAuthAuthorizeToken
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
public OAuthAuthorizeToken(Config c, String tempToken)
{
OAuthAuthorizeTemporaryTokenUrl accessTempToken = new OAuthAuthorizeTemporaryTokenUrl(c.getAuthorizeUrl());
accessTempToken.temporaryToken = tempToken;
accessTempToken.set("oauth_callback",c.getRedirectUri());
authUrl = accessTempToken.build();
}
开发者ID:XeroAPI,项目名称:Xero-Java,代码行数:8,代码来源:OAuthAuthorizeToken.java
示例3: doInBackground
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
@Override
protected Void doInBackground(Uri... params) {
try {
signer.clientSharedSecret = Constants.CONSUMER_SECRET;
OAuthGetTemporaryToken temporaryToken = new OAuthGetTemporaryToken(Constants.REQUEST_URL);
temporaryToken.transport = new ApacheHttpTransport();
temporaryToken.signer = signer;
temporaryToken.consumerKey = Constants.CONSUMER_KEY;
temporaryToken.callback = Constants.OAUTH_CALLBACK_URL;
OAuthCredentialsResponse tempCredentials = temporaryToken.execute();
signer.tokenSharedSecret = tempCredentials.tokenSecret;
OAuthAuthorizeTemporaryTokenUrl authorizeUrl = new OAuthAuthorizeTemporaryTokenUrl(Constants.AUTHORIZE_URL);
authorizeUrl.temporaryToken = tempCredentials.token;
authorizationUrl = authorizeUrl.build();
handled = false;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:28,代码来源:WebActivity.java
示例4: authorize10a
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
/**
* Authorizes the Android application to access user's protected data using
* the authorization flow in OAuth 1.0a.
*
* @param userId user ID or {@code null} if not using a persisted credential
* store
* @param callback Callback to invoke when the request completes,
* {@code null} for no callback
* @param handler {@link Handler} identifying the callback thread,
* {@code null} for the main thread
* @return An {@link OAuthFuture} which resolves to a {@link Credential}
*/
public OAuthFuture<Credential> authorize10a(final String userId,
final OAuthCallback<Credential> callback, Handler handler) {
Preconditions.checkNotNull(userId);
final Future2Task<Credential> task = new Future2Task<Credential>(handler, callback) {
@Override
public void doWork() throws Exception {
try {
LOGGER.info("authorize10a");
OAuthHmacCredential credential = mFlow.load10aCredential(userId);
if (credential != null && credential.getAccessToken() != null
&& (credential.getRefreshToken() != null
|| credential.getExpiresInSeconds() == null
|| credential.getExpiresInSeconds() > 60)) {
set(credential);
return;
}
String redirectUri = mUIController.getRedirectUri();
OAuthCredentialsResponse tempCredentials =
mFlow.new10aTemporaryTokenRequest(redirectUri);
OAuthAuthorizeTemporaryTokenUrl authorizationUrl =
mFlow.new10aAuthorizationUrl(tempCredentials.token);
mUIController.requestAuthorization(authorizationUrl);
String code = mUIController.waitForVerifierCode();
OAuthCredentialsResponse response =
mFlow.new10aTokenRequest(tempCredentials, code).execute();
credential = mFlow.createAndStoreCredential(response, userId);
set(credential);
} finally {
mUIController.stop();
}
}
};
// run the task in a background thread
submitTaskToExecutor(task);
return task;
}
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:57,代码来源:OAuthManager.java
示例5: requestAuthorization
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
@Override
public void requestAuthorization(OAuthAuthorizeTemporaryTokenUrl authorizationRequestUrl) {
internalRequestAuthorization(authorizationRequestUrl);
}
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:5,代码来源:DialogFragmentController.java
示例6: newInstance
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
@TargetApi(HONEYCOMB)
public static final OAuthDialogFragment newInstance(
GenericUrl authorizationRequestUrl,
DialogFragmentController controller) {
Bundle args = new Bundle();
args.putString(ARG_AUTHORIZATION_REQUEST_URL, authorizationRequestUrl.build());
if (authorizationRequestUrl instanceof OAuthAuthorizeTemporaryTokenUrl) {
args.putString(ARG_AUTHORIZATION_TYPE, AUTHORIZATION_10A);
} else if (authorizationRequestUrl instanceof AuthorizationCodeRequestUrl) {
args.putString(ARG_AUTHORIZATION_TYPE, AUTHORIZATION_EXPLICIT);
} else {
args.putString(ARG_AUTHORIZATION_TYPE, AUTHORIZATION_IMPLICIT);
}
BaseDialogFragmentImpl fragImpl;
OAuthDialogFragment frag;
if (controller.getFragmentManager() instanceof android.support.v4.app.FragmentManager) {
fragImpl = new SupportDialogFragmentImpl();
frag = new OAuthDialogFragment((android.support.v4.app.DialogFragment) fragImpl,
controller.fullScreen, controller.horizontalProgress, controller.hideFullScreenTitle);
if (controller.hideFullScreenTitle) {
if (SDK_INT >= ICE_CREAM_SANDWICH) {
((android.support.v4.app.DialogFragment) fragImpl).setStyle(android.support
.v4.app.DialogFragment.STYLE_NORMAL,
android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen
);
} else {
((android.support.v4.app.DialogFragment) fragImpl).setStyle(android.support
.v4.app.DialogFragment.STYLE_NORMAL,
android.R.style.Theme_Black_NoTitleBar_Fullscreen
);
}
}
} else {
fragImpl = new NativeDialogFragmentImpl();
frag = new OAuthDialogFragment((android.app.DialogFragment) fragImpl,
controller.fullScreen, controller.horizontalProgress, controller.hideFullScreenTitle);
if (controller.hideFullScreenTitle) {
if (SDK_INT >= ICE_CREAM_SANDWICH) {
((android.app.DialogFragment) fragImpl).setStyle(DialogFragment.STYLE_NORMAL,
android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen);
} else {
((android.app.DialogFragment) fragImpl).setStyle(DialogFragment.STYLE_NORMAL,
android.R.style.Theme_Black_NoTitleBar_Fullscreen);
}
}
}
fragImpl.setDialogFragmentCompat(frag);
frag.setArguments(args);
frag.setController(controller);
return frag;
}
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:52,代码来源:OAuthDialogFragment.java
示例7: new10aAuthorizationUrl
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
/**
* Returns a new instance of a temporary token authorization request URL as
* defined in <a
* href="http://oauth.net/core/1.0a/#rfc.section.6.2.1">Consumer Directs the
* User to the Service Provider</a>.
*
* @param temporaryToken
* @return
*/
public OAuthAuthorizeTemporaryTokenUrl new10aAuthorizationUrl(String temporaryToken) {
OAuthAuthorizeTemporaryTokenUrl authorizationUrl =
new OAuthAuthorizeTemporaryTokenUrl(getAuthorizationServerEncodedUrl());
authorizationUrl.temporaryToken = temporaryToken;
return authorizationUrl;
}
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:16,代码来源:AuthorizationFlow.java
示例8: requestAuthorization
import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl; //导入依赖的package包/类
/**
* Handles user authorization by redirecting to the OAuth 1.0a authorization
* server as defined in <a
* href="http://oauth.net/core/1.0a/#auth_step2">Obtaining User
* Authorization</a>.
*
* @param authorizationRequestUrl
*/
void requestAuthorization(OAuthAuthorizeTemporaryTokenUrl authorizationRequestUrl);
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:10,代码来源:AuthorizationUIController.java
注:本文中的com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论