本文整理汇总了Java中org.scribe.builder.api.Api类的典型用法代码示例。如果您正苦于以下问题:Java Api类的具体用法?Java Api怎么用?Java Api使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Api类属于org.scribe.builder.api包,在下文中一共展示了Api类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepare
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Before
public void prepare() {
when(sBuilder.build(any(Api.class), any(String.class), any(String.class), any(String.class))).thenReturn(oauthService);
when(sBuilder.build(any(Api.class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn(oauthService);
session = new MockHttpSession();
when(req2.getParameter("code")).thenReturn("code");
when(req2.getParameter("oauth_verifier")).thenReturn("code");
when(req.getSession()).thenReturn(session);
when(req2.getSession()).thenReturn(session);
when(reqBuilder.req(any(Verb.class), any(String.class))).thenReturn(oauthReq);
when(oauthReq.send()).thenReturn(oauthRes);
when(users.findUserByName(any(String.class), any(String.class))).thenReturn(user);
bitbucketHandler = BitbucketHandler.FACTORY.build(sBuilder, reqBuilder, new OAuthProvider("bitbucket", key, secret), callback, users, sessionHandler, errPage);
githubHandler = GithubHandler.FACTORY.build(sBuilder, reqBuilder, new OAuthProvider("github", key, secret), callback, users, sessionHandler, errPage);
googleHandler = GoogleHandler.FACTORY.build(sBuilder, reqBuilder, new OAuthProvider("google", key, secret), callback, users, sessionHandler, errPage);
gitlabHandler = GitlabHandler.FACTORY.build(sBuilder, reqBuilder, new OAuthProvider("gitlab", key, secret), callback, users, sessionHandler, errPage);
twitterHandler = TwitterHandler.FACTORY.build(sBuilder, reqBuilder, new OAuthProvider("twiiter", key, secret), callback, users, sessionHandler, errPage);
}
示例2: getService
import org.scribe.builder.api.Api; //导入依赖的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;
}
示例3: createOAuthService
import org.scribe.builder.api.Api; //导入依赖的package包/类
protected static OAuthService createOAuthService(BootstrapProfile bootstrapProfile, String consumerKey, String consumerSecret) {
String host = bootstrapProfile.getSettings().getServiceHost();
if (host == null) {
return null;
}
Uri uri = new Uri.Builder()
.authority(host)
.scheme("https")
.build();
Class<? extends Api> apiClass;
switch (uri.toString()) {
case EvernoteSession.HOST_SANDBOX:
apiClass = EvernoteApi.Sandbox.class;
break;
case EvernoteSession.HOST_PRODUCTION:
apiClass = EvernoteApi.class;
break;
case EvernoteSession.HOST_CHINA:
apiClass = EvernoteApi.Yinxiang.class;
break;
default:
throw new IllegalArgumentException("Unsupported Evernote host: " + host);
}
return new ServiceBuilder()
.provider(apiClass)
.apiKey(consumerKey)
.apiSecret(consumerSecret)
.callback(CALLBACK_SCHEME + "://callback")
.build();
}
示例4: ApiInfo
import org.scribe.builder.api.Api; //导入依赖的package包/类
public ApiInfo(String name, Class<? extends Api> scribeApi,
String apiKey, String apiSecret, String exampleGetRequest) {
super();
this.name = name;
this.scribeApi = scribeApi;
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.exampleGetRequest = exampleGetRequest;
}
示例5: AuthData
import org.scribe.builder.api.Api; //导入依赖的package包/类
public AuthData(Class<? extends Api> apiClass, String apiKey, String apiSecret, String getRequestLink, String redirectUrl) {
this.id = nextId();
this.apiClass = apiClass;
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.getRequestLink = getRequestLink;
this.redirectUrl = redirectUrl;
setVerifierParameterNameToDefault();
setDefaultErrorParameterNames();
setCallback(redirectUrl);
}
示例6: prepare
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Before
public void prepare() {
configuration = new OAuthConfiguration("http://baseUrl", Arrays.asList(
new OAuthProvider("google", "", ""),
new OAuthProvider("bitbucket", "", "")));
oAuthLogin = new OAuthLogin(users, sessionHandler, configurationFetcher, serviceBuilder, errorPage);
when(configurationFetcher.fetch()).thenReturn(configuration);
when(serviceBuilder.build(any(Api.class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn(mock(OAuthService.class));
when(req.getSession()).thenReturn(session);
}
示例7: OAuthData
import org.scribe.builder.api.Api; //导入依赖的package包/类
public OAuthData(Class<? extends Api> apiClass, String apiKey, String apiSecret) {
this.id = nextId();
this.apiClass = apiClass;
this.apiKey = apiKey;
this.apiSecret = apiSecret;
setVerifierParameterNameToDefault();
setDefaultErrorParameterNames();
}
示例8: ApiInfo
import org.scribe.builder.api.Api; //导入依赖的package包/类
public ApiInfo(String name, Class<? extends Api> scribeApi,
String apiKey, String apiSecret, String exampleGetRequest) {
super();
this.name = name;
this.scribeApi = scribeApi;
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.exampleGetRequest = exampleGetRequest;
}
示例9: getApiClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
public Class<? extends Api> getApiClass() {
return apiClass;
}
示例10: build
import org.scribe.builder.api.Api; //导入依赖的package包/类
public OAuthService build(Api api, String apiKey, String apiSecret, String callback) {
return new ServiceBuilder().provider(api).apiKey(apiKey).apiSecret(apiSecret).callback(callback).build();
}
示例11: getProviderClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
return TwitterApi.class;
}
示例12: getProviderClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
return FacebookApi.class;
}
示例13: getProviderClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
return Google2Api.class;
}
示例14: getProviderClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
return InstagramApi.class;
}
示例15: getApiClass
import org.scribe.builder.api.Api; //导入依赖的package包/类
public Class<? extends Api> getApiClass() {
return apiClass;
}