Java Code Examples for org.springframework.social.connect.ConnectionFactoryLocator

The following examples show how to use org.springframework.social.connect.ConnectionFactoryLocator. These examples are extracted from open source projects. 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
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(
			factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8090");
	return controller;
}
 
Example 2
Source Project: cola   Source File: AcAuthenticationProvider.java    License: MIT License 5 votes vote down vote up
public AcAuthenticationProvider(SocialUserDetailsService userDetailsService,
								ConnectionFactoryLocator connectionFactoryLocator,
								UsersConnectionRepository usersConnectionRepository) {
	this.userDetailsService = userDetailsService;
	this.connectionFactoryLocator = connectionFactoryLocator;
	this.usersConnectionRepository = usersConnectionRepository;
}
 
Example 3
Source Project: cola   Source File: SocialAutoConfiguration.java    License: MIT License 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	JpaUsersConnectRepository repository = new JpaUsersConnectRepository(userConnectionRepository,
			connectionFactoryLocator, Encryptors.noOpText());
	if (connectionSignUp != null) {
		repository.setConnectionSignUp(connectionSignUp);
	}
	return repository;
}
 
Example 4
Source Project: pre   Source File: SocialConfig.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    PreJdbcUsersConnectionRepository repository = new PreJdbcUsersConnectionRepository(dataSource,
            connectionFactoryLocator, Encryptors.noOpText());
    repository.setTablePrefix("social_");
    return repository;
}
 
Example 5
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(
			factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8090");
	return controller;
}
 
Example 6
Source Project: oauth2lab   Source File: GitHubConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {

	ConnectController controller = new ConnectController(
		factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8080");
	return controller;
}
 
Example 7
Source Project: paascloud-master   Source File: SocialConfig.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets users connection repository.
 *
 * @param connectionFactoryLocator the connection factory locator
 *
 * @return the users connection repository
 */
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText());
	repository.setTablePrefix("pc_uac_");
	if (connectionSignUp != null) {
		repository.setConnectionSignUp(connectionSignUp);
	}
	return repository;
}
 
Example 8
@Bean
@ConditionalOnMissingBean(ConnectController.class)
public ConnectController connectController(
        ConnectionFactoryLocator factoryLocator,
        ConnectionRepository repository) {
    ConnectController controller = new ConnectController(factoryLocator,
            repository);
    if (!CollectionUtils.isEmpty(this.connectInterceptors)) {
        controller.setConnectInterceptors(this.connectInterceptors);
    }
    if (!CollectionUtils.isEmpty(this.disconnectInterceptors)) {
        controller.setDisconnectInterceptors(this.disconnectInterceptors);
    }
    return controller;
}
 
Example 9
@Bean
@ConditionalOnBean(SignInAdapter.class)
@ConditionalOnMissingBean
public ProviderSignInController signInController(
        ConnectionFactoryLocator factoryLocator,
        UsersConnectionRepository usersRepository, SignInAdapter signInAdapter) {
    ProviderSignInController controller = new ProviderSignInController(
            factoryLocator, usersRepository, signInAdapter);
    if (!CollectionUtils.isEmpty(this.signInInterceptors)) {
        controller.setSignInInterceptors(this.signInInterceptors);
    }
    return controller;
}
 
Example 10
Source Project: spring-social-wechat-sample   Source File: Application.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public ProviderSignInController providerSignInController(ConnectionFactoryLocator connectionFactoryLocator,
		UsersConnectionRepository usersConnectionRepository, WechatSignInAdapter wechatSignInAdapter) {
	((InMemoryUsersConnectionRepository) usersConnectionRepository)
			.setConnectionSignUp((Connection<?> connection) -> connection.getKey().getProviderUserId());
	return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, wechatSignInAdapter);
}
 
Example 11
@Bean
@ConditionalOnMissingBean({ ConnectionFactoryLocator.class, ResourceServerTokenServices.class })
public UserInfoTokenServices userInfoTokenServices() {
	UserInfoTokenServices services = new UserInfoTokenServices(this.sso.getUserInfoUri(),
			this.sso.getClientId());
	services.setTokenType(this.sso.getTokenType());
	services.setRestTemplate(this.restTemplate);
	if (this.authoritiesExtractor != null) {
		services.setAuthoritiesExtractor(this.authoritiesExtractor);
	}
	if (this.principalExtractor != null) {
		services.setPrincipalExtractor(this.principalExtractor);
	}
	return services;
}
 
Example 12
@Bean
@ConditionalOnMissingBean(ConnectController.class)
public ConnectController connectController(ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(factoryLocator, repository);
	if (!CollectionUtils.isEmpty(this.connectInterceptors)) {
		controller.setConnectInterceptors(this.connectInterceptors);
	}
	if (!CollectionUtils.isEmpty(this.disconnectInterceptors)) {
		controller.setDisconnectInterceptors(this.disconnectInterceptors);
	}
	return controller;
}
 
Example 13
@Bean
@ConditionalOnBean(SignInAdapter.class)
@ConditionalOnMissingBean
public ProviderSignInController signInController(ConnectionFactoryLocator factoryLocator,
		UsersConnectionRepository usersRepository, SignInAdapter signInAdapter) {
	ProviderSignInController controller = new ProviderSignInController(factoryLocator, usersRepository,
			signInAdapter);
	if (!CollectionUtils.isEmpty(this.signInInterceptors)) {
		controller.setSignInInterceptors(this.signInInterceptors);
	}
	return controller;
}
 
Example 14
@Test
public void springSocialUserInfo() {
	TestPropertyValues.of("security.oauth2.resource.userInfoUri:https://example.com",
			"spring.social.facebook.app-id=foo", "spring.social.facebook.app-secret=bar").applyTo(this.environment);
	this.context = new SpringApplicationBuilder(SocialResourceConfiguration.class).environment(this.environment)
			.web(WebApplicationType.SERVLET).run();
	ConnectionFactoryLocator connectionFactory = this.context.getBean(ConnectionFactoryLocator.class);
	assertThat(connectionFactory).isNotNull();
	SpringSocialTokenServices services = this.context.getBean(SpringSocialTokenServices.class);
	assertThat(services).isNotNull();
}
 
Example 15
Source Project: OAuth-2.0-Cookbook   Source File: LinkedInConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public ConnectController connectController(ConnectionFactoryLocator locator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(locator, repository);
	controller.setApplicationUrl("http://localhost:8080");
	return controller;
}
 
Example 16
Source Project: OAuth-2.0-Cookbook   Source File: GitHubConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {

	ConnectController controller = new ConnectController(
		factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8080");
	return controller;
}
 
Example 17
Source Project: OAuth-2.0-Cookbook   Source File: FacebookConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {

	ConnectController controller = new ConnectController(
		factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8080");
	return controller;
}
 
Example 18
Source Project: tutorials   Source File: SecurityConfig.java    License: MIT License 5 votes vote down vote up
@Bean
// @Primary
public ProviderSignInController providerSignInController() {
    ConnectionFactoryLocator connectionFactoryLocator = connectionFactoryLocator();
    UsersConnectionRepository usersConnectionRepository = getUsersConnectionRepository(connectionFactoryLocator);
    ((InMemoryUsersConnectionRepository) usersConnectionRepository).setConnectionSignUp(facebookConnectionSignup);
    return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new FacebookSignInAdapter());
}
 
Example 19
Source Project: JiwhizBlogWeb   Source File: SocialConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    MongoUsersConnectionRepositoryImpl repository = new MongoUsersConnectionRepositoryImpl(
            userSocialConnectionRepository, (SocialAuthenticationServiceLocator)connectionFactoryLocator, Encryptors.noOpText());
    repository.setConnectionSignUp(autoConnectionSignUp());
    return repository;
}
 
Example 20
Source Project: cola   Source File: AcAuthenticationConfiguration.java    License: MIT License 4 votes vote down vote up
@Bean
public AcAuthenticationProvider acAuthenticationProvider(SocialUserDetailsService socialUserDetailsService,
														 ConnectionFactoryLocator connectionFactoryLocator,
														 UsersConnectionRepository usersConnectionRepository) {
	return new AcAuthenticationProvider(socialUserDetailsService, connectionFactoryLocator, usersConnectionRepository);
}
 
Example 21
Source Project: cola   Source File: WechatConnectionConfiguration.java    License: MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	return null;
}
 
Example 22
Source Project: cola   Source File: QQConnectConfiguration.java    License: MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	return null;
}
 
Example 23
Source Project: cola   Source File: WechatMpConnectionConfiguration.java    License: MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
	return null;
}
 
Example 24
Source Project: pre   Source File: GithubAutoAuthConfig.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return null;
}
 
Example 25
Source Project: pre   Source File: GiteeAutoAuthConfig.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return null;
}
 
Example 26
Source Project: pre   Source File: QQAutoConfig.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return null;
}
 
Example 27
Source Project: pre   Source File: WeixinAuthConfig.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return null;
}
 
Example 28
Source Project: FEBS-Security   Source File: FebsSocialConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    JdbcUsersConnectionRepository jdbcUsersConnectionRepository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText());
    jdbcUsersConnectionRepository.setTablePrefix("t_");
    return jdbcUsersConnectionRepository;
}
 
Example 29
Source Project: FEBS-Security   Source File: FebsSocialConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public ProviderSignInUtils providerSignInUtils(ConnectionFactoryLocator connectionFactoryLocator){
    return new ProviderSignInUtils(connectionFactoryLocator,getUsersConnectionRepository(connectionFactoryLocator));
}
 
Example 30
@Bean
@ConditionalOnBean(ConnectionFactoryLocator.class)
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public SpringSocialTokenServices socialTokenServices() {
	return new SpringSocialTokenServices(this.connectionFactory, this.sso.getClientId());
}