gpt4 book ai didi

org.scribe.up.provider.impl.YahooProvider类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 20:09:31 24 4
gpt4 key购买 nike

本文整理了Java中org.scribe.up.provider.impl.YahooProvider类的一些代码示例,展示了YahooProvider类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YahooProvider类的具体详情如下:
包路径:org.scribe.up.provider.impl.YahooProvider
类名称:YahooProvider

YahooProvider介绍

[英]This class is the OAuth provider to authenticate user in Yahoo.

It returns a org.scribe.up.profile.yahoo.YahooProfile.

More information at http://developer.yahoo.com/social/rest_api_guide/extended-profile-resource.html
[中]这个类是用于在Yahoo中验证用户身份的OAuth提供程序。
它返回一个组织。抄写员向上的轮廓雅虎。YahooProfile。
更多信息请访问http://developer.yahoo.com/social/rest_api_guide/extended-profile-resource.html

代码示例

代码示例来源:origin: org.scribe/scribe-up

private BaseOAuth10Provider getProvider() {
  YahooProvider provider = new YahooProvider();
  provider.setKey("key");
  provider.setSecret("secret");
  provider.setCallbackUrl("callbackUrl");
  return provider;
}

代码示例来源:origin: org.scribe/scribe-up

@Override
protected UserProfile retrieveUserProfile(final Token accessToken) throws HttpException {
  // get the guid : http://developer.yahoo.com/social/rest_api_guide/introspective-guid-resource.html
  String body = sendRequestForData(accessToken, getProfileUrl());
  if (body == null) {
    return null;
  }
  final String guid = StringUtils.substringBetween(body, "<value>", "</value>");
  logger.debug("guid : {}", guid);
  // then the profile with the guid
  if (StringUtils.isNotBlank(guid)) {
    body = sendRequestForData(accessToken, "http://social.yahooapis.com/v1/user/" + guid
                        + "/profile?format=json");
    if (body == null) {
      return null;
    }
  }
  final UserProfile profile = extractUserProfile(body);
  addAccessTokenToProfile(profile, accessToken);
  return profile;
}

代码示例来源:origin: org.scribe/scribe-up

private YahooProvider newYahooProvider() {
  final YahooProvider yahooProvider = new YahooProvider();
  yahooProvider.setKey(KEY);
  yahooProvider.setSecret(SECRET);
  return yahooProvider;
}

代码示例来源:origin: org.scribe/scribe-up

@Override
protected YahooProvider newProvider() {
  return new YahooProvider();
}

代码示例来源:origin: org.scribe/scribe-up

public void testTwoProviders() {
  final FacebookProvider facebookProvider = newFacebookProvider();
  final YahooProvider yahooProvider = newYahooProvider();
  final List<OAuthProvider> providers = new ArrayList<OAuthProvider>();
  providers.add(facebookProvider);
  providers.add(yahooProvider);
  final ProvidersDefinition providersDefinition = new ProvidersDefinition();
  providersDefinition.setProviderTypeParameter(NEW_PARAMETER_NAME);
  providersDefinition.setProviders(providers);
  providersDefinition.setBaseUrl(URL);
  assertNull(facebookProvider.getCallbackUrl());
  assertNull(yahooProvider.getCallbackUrl());
  providersDefinition.init();
  assertEquals(URL + "?" + NEW_PARAMETER_NAME + "=" + facebookProvider.getType(),
         facebookProvider.getCallbackUrl());
  assertEquals(URL + "?" + NEW_PARAMETER_NAME + "=" + yahooProvider.getType(), yahooProvider.getCallbackUrl());
  final String[] values = new String[] {
    yahooProvider.getType()
  };
  final Map<String, String[]> parameters = new HashMap<String, String[]>();
  parameters.put(NEW_PARAMETER_NAME, values);
  assertEquals(yahooProvider, providersDefinition.findProvider(parameters));
  assertEquals(yahooProvider, providersDefinition.findProvider(yahooProvider.getType()));
}

代码示例来源:origin: org.scribe/scribe-up

public void testCloneYahooProvider() {
    internalTestCloneBaseOAuthProvider(new YahooProvider());
  }
}

代码示例来源:origin: org.scribe/scribe-up

@Override
protected OAuthProvider getProvider() {
  final YahooProvider yahooProvider = new YahooProvider();
  yahooProvider
    .setKey("dj0yJmk9QUlLcTVINlBpdm5VJmQ9WVdrOVUxaE5Za3R0TmpJbWNHbzlOVEUyTmpFME1EWXkmcz1jb25zdW1lcnNlY3JldCZ4PTJm");
  yahooProvider.setSecret("95220809156c027c0a10c959a04b099da5510b66");
  yahooProvider.setCallbackUrl("http://www.google.com/");
  return yahooProvider;
}

代码示例来源:origin: org.scribe/scribe-up

public void testDefaultType10() {
  final BaseOAuth10Provider provider = new YahooProvider();
  assertEquals("YahooProvider", provider.getType());
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com