本文整理汇总了Java中org.springframework.social.google.api.Google类的典型用法代码示例。如果您正苦于以下问题:Java Google类的具体用法?Java Google怎么用?Java Google使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Google类属于org.springframework.social.google.api包,在下文中一共展示了Google类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadConnections
import org.springframework.social.google.api.Google; //导入依赖的package包/类
public void loadConnections() {
// MultiValueMap<String, Connection<?>> connections = getConnectionRepository().findAllConnections();
Connection<Facebook> facebookConnection = getConnectionRepository().findPrimaryConnection(Facebook.class);
if (facebookConnection != null) {
getView().setConnectionInfo("Facebook", true, facebookConnection.getApi().userOperations().getUserProfile().getEmail(), facebookConnection.getProfileUrl(), facebookConnection.getImageUrl());
} else {
getView().setConnectionInfo("Facebook", false, "", "", null);
}
Connection<Google> googleConnection = getConnectionRepository().findPrimaryConnection(Google.class);
if (googleConnection != null) {
getView().setConnectionInfo("Google", true, googleConnection.getDisplayName(), googleConnection.getProfileUrl(), googleConnection.getImageUrl());
} else {
getView().setConnectionInfo("Google", false, "", "", null);
}
}
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecuritySocial,代码行数:19,代码来源:SocialPresenter.java
示例2: addProfile
import org.springframework.social.google.api.Google; //导入依赖的package包/类
/**
* Add profile information to the model map.
*
* @param map
* the model map
* @param principal
* the princial or <code>null</code>
*/
private void addProfile(ModelMap map, Principal principal) {
if (principal != null) {
Connection<?> connection = null;
connection = connectionRepository.findPrimaryConnection(Twitter.class);
if (connection == null)
connection = connectionRepository.findPrimaryConnection(Google.class);
if (connection == null)
connection = connectionRepository.findPrimaryConnection(GitHub.class);
if (connection != null) {
map.addAttribute("profileImage", connection.getImageUrl());
map.addAttribute("profile", connection.getProfileUrl());
}
Account findAccountByUsername = accountRepository.findOne(principal.getName());
map.addAttribute(findAccountByUsername);
}
}
示例3: profile
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@GetMapping
public String profile(Model model) {
if (connectionRepository.findPrimaryConnection(Google.class) == null) {
return "redirect:/connect/google";
}
String name = google.plusOperations().getGoogleProfile()
.getDisplayName();
model.addAttribute("name", name);
return "profile";
}
示例4: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google(final ConnectionRepository repository) {
final Connection<Google> connection = repository
.findPrimaryConnection(Google.class);
return connection != null ? connection.getApi() : null;
}
示例5: extractProviderUserId
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
protected String extractProviderUserId(AccessGrant accessGrant) {
Google api = ((GoogleConfigurableServiceProvider)getServiceProvider())
.getApi(accessGrant.getAccessToken());
UserProfile userProfile = getApiAdapter().fetchUserProfile(api);
return userProfile.getUsername();
}
示例6: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google(ConnectionRepository repository) {
log.debug("Connection from " + Google.class);
Connection<Google> connection = repository.findPrimaryConnection(Google.class);
return connection != null ? connection.getApi() : null;
}
示例7: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(Google.class)
@Scope(value = "request", proxyMode = INTERFACES)
public Google google(ConnectionRepository repository) {
return ofNullable(repository.findPrimaryConnection(Google.class))
.map(c -> c.getApi())
.orElse(new GoogleTemplate());
}
示例8: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(Google.class)
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google(ConnectionRepository repository) {
Connection<Google> connection = repository.findPrimaryConnection(Google.class);
return connection != null ? connection.getApi() : new GoogleTemplate();
}
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecuritySocial,代码行数:8,代码来源:GoogleAutoConfiguration.java
示例9: preHandle
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
public boolean preHandle (HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String userId = userCookieGenerator.readCookieValue (request);
if (userId != null) {
if (connectionRepository.createConnectionRepository (userId).findPrimaryConnection (Google.class) != null)
SecurityContext.setCurrentUser (new User (userId));
else
userCookieGenerator.removeCookie (response);
}
return true;
}
示例10: getConnectInterceptor
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
protected ConnectInterceptor<Google> getConnectInterceptor() {
if( googleConnectInterceptor == null ) {
googleConnectInterceptor = new GoogleConnectInterceptor();
}
return googleConnectInterceptor;
}
示例11: getApi
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
public Google getApi(String accessToken) {
return new ConfigurableGoogleTemplate(accessToken, baseApiUrl);
}
示例12: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google() {
return connectionRepository().getPrimaryConnection(Google.class).getApi();
}
示例13: createConnectionFactory
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
protected ConnectionFactory<Google> createConnectionFactory() {
GoogleConnectionFactory googleConnectionFactory = new GoogleConnectionFactory(googleConsumerKey, googleConsumerSecret);
googleConnectionFactory.setScope("email");
return googleConnectionFactory;
}
示例14: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google(ConnectionRepository repository) {
Connection<Google> connection = repository.findPrimaryConnection(Google.class);
return connection != null ? connection.getApi() : new GoogleTemplate();
}
示例15: google
import org.springframework.social.google.api.Google; //导入依赖的package包/类
/**
* A proxy to a request-scoped object representing the current user's primary
* Google account.
*
* @throws NotConnectedException if the user is not connected to Google.
*/
@Bean
@Scope (value = "request")
public Google google (ConnectionRepository connectionRepository) {
return connectionRepository.getPrimaryConnection (Google.class).getApi ();
}