org.springframework.social.github.api.GitHub Java Examples

The following examples show how to use org.springframework.social.github.api.GitHub. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoriesController.java    From oauth2lab with MIT License 6 votes vote down vote up
@GetMapping
public String repositories(Model model) {
	if (connectionRepository.findPrimaryConnection(GitHub.class) == null) {
		return "redirect:/connect/github";
	}

	String name = github.userOperations().getUserProfile().getName();
	String username = github.userOperations().getUserProfile()
			.getUsername();
	model.addAttribute("name", name);

	String uri = "https://api.github.com/users/{user}/repos";
	GitHubRepo[] repos = github.restOperations().getForObject(uri,
			GitHubRepo[].class, username);
	model.addAttribute("repositories", Arrays.asList(repos));

	return "repositories";
}
 
Example #2
Source File: RepositoriesController.java    From OAuth-2.0-Cookbook with MIT License 6 votes vote down vote up
@GetMapping
public String repositories(Model model) {
	if (connectionRepository.findPrimaryConnection(GitHub.class) == null) {
		return "redirect:/connect/github";
	}

	String name = github.userOperations().getUserProfile().getName();
	String username = github.userOperations().getUserProfile()
			.getUsername();
	model.addAttribute("name", name);

	String uri = "https://api.github.com/users/{user}/repos";
	GitHubRepo[] repos = github.restOperations().getForObject(uri,
			GitHubRepo[].class, username);
	model.addAttribute("repositories", Arrays.asList(repos));

	return "repositories";
}
 
Example #3
Source File: GitHubConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public GitHub gitHub(ConnectionRepository repository) {
	Connection<GitHub> connection = repository
			.findPrimaryConnection(GitHub.class);
	return connection != null ? connection.getApi() : null;
}
 
Example #4
Source File: GitHubConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public GitHub gitHub(ConnectionRepository repository) {
	Connection<GitHub> connection = repository
			.findPrimaryConnection(GitHub.class);
	return connection != null ? connection.getApi() : null;
}
 
Example #5
Source File: GitHubConfiguration.java    From oauth2lab with MIT License 5 votes vote down vote up
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public GitHub gitHub(ConnectionRepository repository) {
	Connection<GitHub> connection = repository
			.findPrimaryConnection(GitHub.class);
	return connection != null ? connection.getApi() : null;
}
 
Example #6
Source File: GitHubConfiguration.java    From OAuth-2.0-Cookbook with MIT License 5 votes vote down vote up
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public GitHub gitHub(ConnectionRepository repository) {
	Connection<GitHub> connection = repository
			.findPrimaryConnection(GitHub.class);
	return connection != null ? connection.getApi() : null;
}