org.springframework.social.connect.ConnectionFactoryLocator Java Examples

The following examples show how to use org.springframework.social.connect.ConnectionFactoryLocator. 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: SocialConfig.java    From JiwhizBlogWeb with 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 #2
Source File: FacebookConfiguration.java    From OAuth-2.0-Cookbook with 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 #3
Source File: GitHubConfiguration.java    From OAuth-2.0-Cookbook with 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 #4
Source File: LinkedInConfiguration.java    From OAuth-2.0-Cookbook with 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 #5
Source File: ResourceServerTokenServicesConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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 #6
Source File: SocialWebAutoConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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 #7
Source File: SocialWebAutoConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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 #8
Source File: ResourceServerTokenServicesConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@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 #9
Source File: GitHubConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(
			factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8090");
	return controller;
}
 
Example #10
Source File: Application.java    From spring-social-wechat-sample with 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
Source File: FebsSocialWebAutoConfiguration.java    From FEBS-Security with Apache License 2.0 5 votes vote down vote up
@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 #12
Source File: FebsSocialWebAutoConfiguration.java    From FEBS-Security with Apache License 2.0 5 votes vote down vote up
@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
Source File: SocialConfig.java    From paascloud-master with 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 #14
Source File: GitHubConfiguration.java    From oauth2lab with 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 #15
Source File: GitHubConfiguration.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public ConnectController connectController(
		ConnectionFactoryLocator factoryLocator,
		ConnectionRepository repository) {
	ConnectController controller = new ConnectController(
			factoryLocator, repository);
	controller.setApplicationUrl("http://localhost:8090");
	return controller;
}
 
Example #16
Source File: AcAuthenticationProvider.java    From cola with 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 #17
Source File: SocialAutoConfiguration.java    From cola with 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 #18
Source File: SocialConfig.java    From pre with 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 #19
Source File: SecurityConfig.java    From tutorials with 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 #20
Source File: ResourceServerTokenServicesConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnBean(ConnectionFactoryLocator.class)
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public SpringSocialTokenServices socialTokenServices() {
	return new SpringSocialTokenServices(this.connectionFactory, this.sso.getClientId());
}
 
Example #21
Source File: TemporaryConnectionRepository.java    From boot-stateless-social with MIT License 4 votes vote down vote up
public TemporaryConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    super(connectionFactoryLocator);
}
 
Example #22
Source File: MyConnectController.java    From JiwhizBlogWeb with Apache License 2.0 4 votes vote down vote up
@Inject
public MyConnectController(ConnectionFactoryLocator connectionFactoryLocator,
        ConnectionRepository connectionRepository) {
    super(connectionFactoryLocator, connectionRepository);
}
 
Example #23
Source File: DatabaseSocialConfigurer.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example #24
Source File: ConfigAwareConnectionFactoryLocator.java    From engine with GNU General Public License v3.0 4 votes vote down vote up
@Required
public void setDefaultLocator(ConnectionFactoryLocator defaultLocator) {
    this.defaultLocator = defaultLocator;
}
 
Example #25
Source File: SecurityConfig.java    From tutorials with MIT License 4 votes vote down vote up
private UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return new InMemoryUsersConnectionRepository(connectionFactoryLocator);
}
 
Example #26
Source File: SecurityConfig.java    From tutorials with MIT License 4 votes vote down vote up
private ConnectionFactoryLocator connectionFactoryLocator() {
    ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
    registry.addConnectionFactory(new FacebookConnectionFactory(appId, appSecret));
    return registry;
}
 
Example #27
Source File: SocialConfig.java    From lolibox with Apache License 2.0 4 votes vote down vote up
@Bean
public ProviderSignInController providerSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository) {
    return new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, new SimpleSignInAdapter(new HttpSessionRequestCache()));
}
 
Example #28
Source File: SocialConfig.java    From lolibox with Apache License 2.0 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    return new JpaUsersConnectionRepository(jpaTemplate, connectionFactoryLocator, Encryptors.noOpText());
}
 
Example #29
Source File: DatabaseSocialConfigurer.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}
 
Example #30
Source File: DatabaseSocialConfigurer.java    From lemonaid with MIT License 4 votes vote down vote up
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    TextEncryptor textEncryptor = Encryptors.noOpText();
    return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, textEncryptor);
}