本文整理了Java中org.springframework.social.connect.Connection.getImageUrl()
方法的一些代码示例,展示了Connection.getImageUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getImageUrl()
方法的具体详情如下:
包路径:org.springframework.social.connect.Connection
类名称:Connection
方法名:getImageUrl
[英]A link to a image that visualizes this connection. Should visually distinguish this connection from others with the same provider. Generally the small/thumbnail version of the connected provider user's profile picture. May be null if this information is not public or not provided. The value of this property may change if the user updates his or her profile.
[中]指向显示此连接的图像的链接。应直观地将此连接与具有相同提供程序的其他连接区分开来。通常是连接的提供商用户配置文件图片的小/缩略图版本。如果此信息未公开或未提供,则可能为空。如果用户更新其配置文件,此属性的值可能会更改。
代码示例来源:origin: io.loli.social/custom-social-core-extension
@Test
public void updateConnectionProfileFields() {
connectionFactoryRegistry
.addConnectionFactory(new TestTwitterConnectionFactory());
insertTwitterConnection();
Connection<TestTwitterApi> twitter = connectionRepository
.getPrimaryConnection(TestTwitterApi.class);
assertEquals("http://twitter.com/kdonald/picture",
twitter.getImageUrl());
twitter.sync();
assertEquals("http://twitter.com/kdonald/a_new_picture",
twitter.getImageUrl());
connectionRepository.updateConnection(twitter);
Connection<TestTwitterApi> twitter2 = connectionRepository
.getPrimaryConnection(TestTwitterApi.class);
assertEquals("http://twitter.com/kdonald/a_new_picture",
twitter2.getImageUrl());
}
代码示例来源:origin: org.craftercms/crafter-security-provider
profile.setAttribute(DISPLAY_NAME_ATTRIBUTE_NAME, displayName);
if (StringUtils.isNotEmpty(connection.getImageUrl())) {
profile.setAttribute(AVATAR_LINK_ATTRIBUTE_NAME, connection.getImageUrl());
代码示例来源:origin: io.loli.social/custom-social-core-extension
private void assertTwitterConnection(Connection<TestTwitterApi> twitter) {
assertEquals(new ConnectionKey("twitter", "1"), twitter.getKey());
assertEquals("@kdonald", twitter.getDisplayName());
assertEquals("http://twitter.com/kdonald", twitter.getProfileUrl());
assertEquals("http://twitter.com/kdonald/picture",
twitter.getImageUrl());
TestTwitterApi twitterApi = twitter.getApi();
assertEquals("123456789", twitterApi.getAccessToken());
assertEquals("987654321", twitterApi.getSecret());
twitter.sync();
assertEquals("http://twitter.com/kdonald/a_new_picture",
twitter.getImageUrl());
}
代码示例来源:origin: io.loli.social/custom-social-core-extension
private void assertFacebookConnection(Connection<TestFacebookApi> facebook) {
assertEquals(new ConnectionKey("facebook", "9"), facebook.getKey());
assertEquals(null, facebook.getDisplayName());
assertEquals(null, facebook.getProfileUrl());
assertEquals(null, facebook.getImageUrl());
TestFacebookApi facebookApi = facebook.getApi();
assertEquals("234567890", facebookApi.getAccessToken());
facebook.sync();
assertEquals("Keith Donald", facebook.getDisplayName());
assertEquals("http://facebook.com/keith.donald",
facebook.getProfileUrl());
assertEquals("http://facebook.com/keith.donald/picture",
facebook.getImageUrl());
}
代码示例来源:origin: tihomcode/TiHom-Security
/**
* 用户第一次社交登录时,会引导用户进行用户注册或绑定,此服务用于在注册或绑定页面获取社交网站用户信息
* @param request
* @return
*/
@GetMapping("/social/user")
public SocialUserInfo getSocialUserInfo(HttpServletRequest request){
SocialUserInfo userInfo = new SocialUserInfo();
Connection<?> connection = providerSignInUtils.getConnectionFromSession(new ServletWebRequest(request));
userInfo.setProviderId(connection.getKey().getProviderId());
userInfo.setProviderUserId(connection.getKey().getProviderUserId());
userInfo.setNickname(connection.getDisplayName());
userInfo.setHeadimg(connection.getImageUrl());
return userInfo;
}
代码示例来源:origin: tihomcode/TiHom-Security
/**
* 要注册时跳到这里,返回401和用户信息给前端
* @param request
* @return
*/
@GetMapping("/social/signUp")
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public SocialUserInfo getSocialUserInfo(HttpServletRequest request){
SocialUserInfo userInfo = new SocialUserInfo();
Connection<?> connection = providerSignInUtils.getConnectionFromSession(new ServletWebRequest(request));
userInfo.setProviderId(connection.getKey().getProviderId());
userInfo.setProviderUserId(connection.getKey().getProviderUserId());
userInfo.setNickname(connection.getDisplayName());
userInfo.setHeadimg(connection.getImageUrl());
//从connection中拿出数据存入redis中,做转存
appSignUpUtils.saveConnectionData(new ServletWebRequest(request),connection.createData());
return userInfo;
}
}
代码示例来源:origin: tigerphz/tgcloud-master
/**
* 根据Connection信息构建SocialUserInfo
*
* @param connection the connection
* @return social user info
*/
protected SocialUserInfo buildSocialUserInfo(Connection<?> connection) {
SocialUserInfo userInfo = new SocialUserInfo();
userInfo.setProviderId(connection.getKey().getProviderId());
userInfo.setProviderUserId(connection.getKey().getProviderUserId());
userInfo.setNickname(connection.getDisplayName());
userInfo.setHeadimg(connection.getImageUrl());
return userInfo;
}
代码示例来源:origin: com.jtbdevelopment.core-games/games-web
@Override
public String execute(final Connection<?> connection) {
try {
Player player = playerRepository.findBySourceAndSourceId(connection.getKey().getProviderId(),
connection.getKey().getProviderUserId());
if (player != null) {
return player.getIdAsString();
} else {
P p = playerFactory.newPlayer();
p.setDisabled(false);
p.setDisplayName(connection.fetchUserProfile().getName());
p.setSource(connection.getKey().getProviderId());
p.setSourceId(connection.getKey().getProviderUserId());
p.setProfileUrl(connection.getProfileUrl());
p.setImageUrl(connection.getImageUrl());
p = playerRepository.save(p);
return (p == null ? null : p.getIdAsString());
}
} catch (Exception e) {
logger.warn("Experienced exception in AutoConnectionSignUp", e);
return null;
}
}
}
代码示例来源:origin: io.loli.social/custom-social-core-extension
private void assertNewConnection(Connection<TestFacebookApi> connection) {
assertEquals("facebook", connection.getKey().getProviderId());
assertEquals("9", connection.getKey().getProviderUserId());
assertEquals("Keith Donald", connection.getDisplayName());
assertEquals("http://facebook.com/keith.donald",
connection.getProfileUrl());
assertEquals("http://facebook.com/keith.donald/picture",
connection.getImageUrl());
assertTrue(connection.test());
TestFacebookApi api = connection.getApi();
assertNotNull(api);
assertEquals("123456789", api.getAccessToken());
assertEquals("123456789", connection.createData().getAccessToken());
assertEquals("987654321", connection.createData().getRefreshToken());
}
内容来源于网络,如有侵权,请联系作者删除!