本文整理汇总了Java中org.springframework.social.oauth1.OAuth1Parameters.setCallbackUrl方法的典型用法代码示例。如果您正苦于以下问题:Java OAuth1Parameters.setCallbackUrl方法的具体用法?Java OAuth1Parameters.setCallbackUrl怎么用?Java OAuth1Parameters.setCallbackUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.social.oauth1.OAuth1Parameters
的用法示例。
在下文中一共展示了OAuth1Parameters.setCallbackUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOAuth1Url
import org.springframework.social.oauth1.OAuth1Parameters; //导入方法依赖的package包/类
private String buildOAuth1Url(OAuth1ConnectionFactory<?> connectionFactory, NativeWebRequest request,
MultiValueMap<String, String> additionalParameters) {
OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations();
MultiValueMap<String, String> requestParameters = getRequestParameters(request);
OAuth1Parameters parameters = getOAuth1Parameters(request, additionalParameters);
parameters.putAll(requestParameters);
if (oauthOperations.getVersion() == OAuth1Version.CORE_10) {
parameters.setCallbackUrl(callbackUrl(request));
}
OAuthToken requestToken = fetchRequestToken(request, requestParameters, oauthOperations);
sessionStrategy.setAttribute(request, OAUTH_TOKEN_ATTRIBUTE, requestToken);
return buildOAuth1Url(oauthOperations, requestToken.getValue(), parameters);
}
示例2: prepare
import org.springframework.social.oauth1.OAuth1Parameters; //导入方法依赖的package包/类
@Override
public CredentialFlowState prepare(final String connectorId, final URI baseUrl, final URI returnUrl) {
final OAuth1CredentialFlowState.Builder flowState = new OAuth1CredentialFlowState.Builder().returnUrl(returnUrl)
.providerId(id);
final OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations();
final OAuth1Parameters parameters = new OAuth1Parameters();
final String stateKey = UUID.randomUUID().toString();
flowState.key(stateKey);
final OAuthToken oAuthToken;
final OAuth1Version oAuthVersion = oauthOperations.getVersion();
if (oAuthVersion == OAuth1Version.CORE_10) {
parameters.setCallbackUrl(callbackUrlFor(baseUrl, EMPTY));
oAuthToken = oauthOperations.fetchRequestToken(null, null);
} else if (oAuthVersion == OAuth1Version.CORE_10_REVISION_A) {
oAuthToken = oauthOperations.fetchRequestToken(callbackUrlFor(baseUrl, EMPTY), null);
} else {
throw new IllegalStateException("Unsupported OAuth 1 version: " + oAuthVersion);
}
flowState.token(oAuthToken);
final String redirectUrl = oauthOperations.buildAuthorizeUrl(oAuthToken.getValue(), parameters);
flowState.redirectUrl(redirectUrl);
flowState.connectorId(connectorId);
return flowState.build();
}
示例3: prepare
import org.springframework.social.oauth1.OAuth1Parameters; //导入方法依赖的package包/类
@Override
public CredentialFlowState prepare(final URI baseUrl, final URI returnUrl) {
final OAuth1CredentialFlowState.Builder flowState = new OAuth1CredentialFlowState.Builder().returnUrl(returnUrl)
.providerId(id);
final OAuth1Operations oauthOperations = connectionFactory.getOAuthOperations();
final OAuth1Parameters parameters = new OAuth1Parameters();
final String stateKey = UUID.randomUUID().toString();
flowState.key(stateKey);
final OAuthToken oAuthToken;
final OAuth1Version oAuthVersion = oauthOperations.getVersion();
if (oAuthVersion == OAuth1Version.CORE_10) {
parameters.setCallbackUrl(callbackUrlFor(baseUrl, EMPTY));
oAuthToken = oauthOperations.fetchRequestToken(null, null);
} else if (oAuthVersion == OAuth1Version.CORE_10_REVISION_A) {
oAuthToken = oauthOperations.fetchRequestToken(callbackUrlFor(baseUrl, EMPTY), null);
} else {
throw new IllegalStateException("Unsupported OAuth 1 version: " + oAuthVersion);
}
flowState.token(oAuthToken);
final String redirectUrl = oauthOperations.buildAuthorizeUrl(oAuthToken.getValue(), parameters);
flowState.redirectUrl(redirectUrl);
return flowState.build();
}
示例4: getOAuth1Parameters
import org.springframework.social.oauth1.OAuth1Parameters; //导入方法依赖的package包/类
@Override
protected OAuth1Parameters getOAuth1Parameters(String callbackUrl)
{
OAuth1Parameters oAuth1Parameters = new OAuth1Parameters();
oAuth1Parameters.setCallbackUrl(callbackUrl);
oAuth1Parameters.set("perms", "delete");
return oAuth1Parameters;
}