+import javax.inject.Inject;
import org.apache.http.HttpRequestFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.ConnectionRepository;
+import org.springframework.social.connect.ConnectionSignUp;
import org.springframework.social.connect.UsersConnectionRepository;
import org.springframework.social.connect.mem.InMemoryUsersConnectionRepository;
import org.springframework.social.connect.web.ConnectController;
@EnableSocial
public class SocialConfig extends SocialConfigurerAdapter
{
+ @Inject
+ ConnectionSignUp connectionSignUp;
+ @Inject
+ SignInAdapter signInAdapter;
+
+
/**
* Add a {@link FacebookConnectionFactory} to the configuration.
* The factory is configured through the keys <code>facebook.app.id</code>
{
InMemoryUsersConnectionRepository repository =
new InMemoryUsersConnectionRepository(connectionFactoryLocator);
- repository.setConnectionSignUp(new ProviderUserIdConnectionSignUp());
+ repository.setConnectionSignUp(connectionSignUp);
return repository;
}
UsersConnectionRepository repository
)
{
- ProviderSignInController controller = new ProviderSignInController(
- factoryLocator,
- repository,
- new UserCookieSignInAdapter()
- );
+ ProviderSignInController controller =
+ new ProviderSignInController(factoryLocator, repository, signInAdapter);
return controller;
}
new CanvasSignInController(
factoryLocator,
repository,
- new UserCookieSignInAdapter(),
+ signInAdapter,
env.getProperty("facebook.app.id"),
env.getProperty("facebook.app.secret"),
env.getProperty("facebook.app.canvas")
import org.slf4j.LoggerFactory;
import org.springframework.social.connect.Connection;
import org.springframework.social.connect.web.SignInAdapter;
+import org.springframework.stereotype.Service;
import org.springframework.web.context.request.NativeWebRequest;
*
* @author Kai Moritz
*/
+@Service
public class UserCookieSignInAdapter implements SignInAdapter
{
private final static Logger LOG =