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


Java Google类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:25,代码来源:AbstractController.java

示例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";
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:13,代码来源:GooglePlusController.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:8,代码来源:GoogleConfigurerAdapter.java

示例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();
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:8,代码来源:GoogleConfigurableConnectionFactory.java

示例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;
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:8,代码来源:SocialConfig.java

示例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());
}
 
开发者ID:domix,项目名称:social-google-spring-boot-starter,代码行数:9,代码来源:GoogleAutoConfiguration.java

示例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;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:12,代码来源:UserInterceptor.java

示例10: getConnectInterceptor

import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
protected ConnectInterceptor<Google> getConnectInterceptor() {	
      if( googleConnectInterceptor == null ) {
               googleConnectInterceptor = new GoogleConnectInterceptor();
       }
       return googleConnectInterceptor;
}
 
开发者ID:qcri-social,项目名称:AIDR,代码行数:8,代码来源:GoogleProviderConfig.java

示例11: getApi

import org.springframework.social.google.api.Google; //导入依赖的package包/类
@Override
public Google getApi(String accessToken) {
  return new ConfigurableGoogleTemplate(accessToken, baseApiUrl);
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:5,代码来源:GoogleConfigurableServiceProvider.java

示例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();
}
 
开发者ID:MikhailErofeev,项目名称:mars-calendar,代码行数:6,代码来源:SocialConfig.java

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

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

示例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 ();
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:12,代码来源:GoogleConfiguration.java


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