本文整理汇总了Java中org.scribe.builder.ServiceBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceBuilder.build方法的具体用法?Java ServiceBuilder.build怎么用?Java ServiceBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.scribe.builder.ServiceBuilder
的用法示例。
在下文中一共展示了ServiceBuilder.build方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBitbucketOAuthScribeService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
private OAuthService createBitbucketOAuthScribeService(String callbackUrl)
{
Organization organizationInstance = organizationService.get(Integer.parseInt(organization), false);
ServiceBuilder sb = new ServiceBuilder().apiKey(organizationInstance.getCredential().getOauthKey())
.signatureType(SignatureType.Header).apiSecret(organizationInstance.getCredential().getOauthSecret())
.provider(new Bitbucket10aScribeApi(organizationInstance.getHostUrl(), httpClientProvider))
.debugStream(new DebugOutputStream(log));
if (!StringUtils.isBlank(callbackUrl))
{
sb.callback(callbackUrl);
}
return sb.build();
}
示例2: provideOAuthService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
@Singleton
@Provides
public OAuthService provideOAuthService() {
ServiceBuilder serviceBuilder = new ServiceBuilder()
.apiKey(BuildConfig.GEOCACHING_API_KEY)
.apiSecret(BuildConfig.GEOCACHING_API_SECRET)
.callback(AppConstants.OAUTH_CALLBACK_URL)
.debug();
if (BuildConfig.GEOCACHING_API_STAGING) {
serviceBuilder.provider(GeocachingOAuthProvider.Staging.class);
} else {
serviceBuilder.provider(GeocachingOAuthProvider.class);
}
return serviceBuilder.build();
}
示例3: getService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
/**
* Gets the OAuth service singleton.
*
* @return OAuth service singleton
*/
protected OAuthService getService() {
if (service == null) {
callbackPage = Page.getCurrent();
String location = callbackPage.getLocation().toString();
Class<? extends Api> api = getApi();
ServiceBuilder builder = new ServiceBuilder();
builder.provider(api);
builder.apiKey(apiKey);
builder.apiSecret(apiSecret);
builder.callback(location);
service=builder.build();
}
return service;
}
示例4: createService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
private OAuthService createService() {
ServiceBuilder sb = new ServiceBuilder();
sb.provider(Google2Api.class);
sb.apiKey(GOOGLE_API_KEY);
sb.apiSecret(GOOGLE_API_SECRET);
sb.scope("email");
// redirectUrl = Page.getCurrent().getLocation().toString()+"dashboard/";
redirectUrl = Page.getCurrent().getLocation().toString();
if(redirectUrl.contains("#")) {
redirectUrl = redirectUrl.substring(0, redirectUrl.indexOf("#"));
}
sb.callback(redirectUrl);
return sb.build();
}
示例5: createBitbucketOAuthScribeService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
private OAuthService createBitbucketOAuthScribeService(String callbackUrl)
{
ServiceBuilder sb = new ServiceBuilder().apiKey(oAuthStore.getClientId(Host.BITBUCKET.id))
.signatureType(SignatureType.Header)
.apiSecret(oAuthStore.getSecret(Host.BITBUCKET.id))
.provider(new Bitbucket10aScribeApi(url, httpClientProvider))
.debugStream(new DebugOutputStream(log));
if (!StringUtils.isBlank(callbackUrl))
{
sb.callback(callbackUrl);
}
return sb.build();
}
示例6: SitesSigningClient
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
public SitesSigningClient( OkHttpClient client )
{
super( client );
ServiceBuilder sb = new ServiceBuilder()
.provider( getProviderClass() )
.apiKey( getApiKey() )
.apiSecret( getApiSecret() );
if ( !TextUtils.isEmpty( getScope() ) )
{
sb.scope( getScope() );
}
signingService = sb.build();
}
示例7: createOAuthService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
private OAuthService createOAuthService() {
ServiceBuilder sb = new ServiceBuilder();
sb.provider(service.scribeApi);
sb.apiKey(service.apiKey);
sb.apiSecret(service.apiSecret);
sb.callback("http://www.google.fi");
return sb.build();
}
示例8: getOAuthService
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
protected OAuthService getOAuthService(GrantType _grantType, String scope, String state)
{
ServiceBuilder serviceBuilder = new ServiceBuilder()
.provider(new TestsuiteAPI(_grantType.getTechnicalCode(), state, responseType.getTechnicalCode()))
.apiKey(clientId)
.apiSecret(clientSecret==null?"DUMMYDUMMYDUMMY":clientSecret)
.callback("http://localhost:9998/testsuite");
if (scope!=null)
serviceBuilder = serviceBuilder.scope(scope);
OAuthService service = serviceBuilder.build();
return service;
}
示例9: loginImpl
import org.scribe.builder.ServiceBuilder; //导入方法依赖的package包/类
/**
* Log in.
*
* @param api Scribe API class
* @param key OAuth key
* @param secret OAuth secret
* @param scope OAuth scope (or null)
* @param callback OAuth URL callback (or null)
* @param useRequestToken OAuth use of request token ?
* @param tokenPath Path to save the token
* @param vCode How to get the verification code
* @throws IOException
* @throws java.lang.InterruptedException
*/
protected void loginImpl( final Class<? extends Api> api ,
final String key ,
final String secret ,
final String scope ,
final String callback ,
final boolean useRequestToken ,
final Path tokenPath ,
final A_ValidatorCode vCode )
throws IOException , InterruptedException
{
if ( api == null || key == null || secret == null || tokenPath == null || vCode == null )
{
throw new IllegalArgumentException();
}
if ( LOGGER.isTraceEnabled() )
{
LOGGER.trace(
"[" + getClass().getSimpleName() + "] loginImpl() : api=" + api + " / key=" + key + " / scope=" + scope + " / callback=" + callback + " / useRequestToken=" + useRequestToken + " / tokenPath=" + tokenPath );
}
this.key = key;
final ServiceBuilder builder = new ServiceBuilder()
.provider( api )
.apiKey( this.key )
.apiSecret( secret );
if ( scope != null )
{
builder.scope( scope );
}
if ( callback != null )
{
builder.callback( callback );
}
service = builder.build();
accessToken = loadToken( tokenPath );
if ( accessToken == null )
{
// Get the request token
final Token requestToken = useRequestToken ? service.getRequestToken() : null;
// Making the user validate your request token
final String authUrl = service.getAuthorizationUrl( requestToken );
final String code = vCode.getValidationCode( authUrl );
// Get the access Token
final Verifier v = new Verifier( code );
accessToken = service.getAccessToken( requestToken ,
v );
saveToken( accessToken ,
tokenPath );
}
}