当前位置: 首页>>代码示例>>Java>>正文


Java Api类代码示例

本文整理汇总了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);
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:26,代码来源:HandlersTest.java

示例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;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:21,代码来源:OAuthButton.java

示例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();
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:37,代码来源:EvernoteOAuthHelper.java

示例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;
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:10,代码来源:ApiInfo.java

示例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);
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:13,代码来源:AuthData.java

示例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);
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:13,代码来源:OauthLoginTest.java

示例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();
}
 
开发者ID:ahn,项目名称:vaadin-oauthpopup,代码行数:9,代码来源:OAuthData.java

示例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;
}
 
开发者ID:ahn,项目名称:vaadin-oauthpopup,代码行数:10,代码来源:ApiInfo.java

示例9: getApiClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
public Class<? extends Api> getApiClass() {
    return apiClass;
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:4,代码来源:AuthData.java

示例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();
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:4,代码来源:OAuthServiceBuilder.java

示例11: getProviderClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
    return TwitterApi.class;
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:6,代码来源:TwitterSigningClient.java

示例12: getProviderClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
    return FacebookApi.class;
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:6,代码来源:FacebookSigningClient.java

示例13: getProviderClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
    return Google2Api.class;
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:6,代码来源:GPlusSigningClient.java

示例14: getProviderClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
@Override
protected Class<? extends Api> getProviderClass()
{
    return InstagramApi.class;
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:6,代码来源:InstagramSigningClient.java

示例15: getApiClass

import org.scribe.builder.api.Api; //导入依赖的package包/类
public Class<? extends Api> getApiClass() {
	return apiClass;
}
 
开发者ID:ahn,项目名称:vaadin-oauthpopup,代码行数:4,代码来源:OAuthData.java


注:本文中的org.scribe.builder.api.Api类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。