X-Git-Url: http://juplo.de/gitweb/?p=examples%2Ffacebook-app;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fyourshouter%2FSocialConfig.java;fp=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fyourshouter%2FSocialConfig.java;h=ff6915147d8cab0cd187e7b34d651298c740e4ba;hp=2abcd4283f3db0844c2bd5755357c53ba318066c;hb=a1ad44fc308e479f9a005aa2d87cb604d6eb0e7d;hpb=02f599692669d48f9865764fda994ad61d203ffb diff --git a/src/main/java/de/juplo/yourshouter/SocialConfig.java b/src/main/java/de/juplo/yourshouter/SocialConfig.java index 2abcd42..ff69151 100644 --- a/src/main/java/de/juplo/yourshouter/SocialConfig.java +++ b/src/main/java/de/juplo/yourshouter/SocialConfig.java @@ -17,6 +17,8 @@ import org.springframework.social.connect.ConnectionRepository; import org.springframework.social.connect.UsersConnectionRepository; import org.springframework.social.connect.mem.InMemoryUsersConnectionRepository; import org.springframework.social.connect.web.ConnectController; +import org.springframework.social.connect.web.ProviderSignInController; +import org.springframework.social.connect.web.SignInAdapter; import org.springframework.social.facebook.api.Facebook; import org.springframework.social.facebook.connect.FacebookConnectionFactory; @@ -116,6 +118,29 @@ public class SocialConfig extends SocialConfigurerAdapter return controller; } + /** + * Configure the {@link ProviderSignInController} to use our implementation + * of {@link SignInAdapter} to sign in the user by storing the ID in the + * {@link SecurityContext} and the user-cookie. + * + * @param factoryLocator The {@link ConnectionFactoryLocator} will be injected by Spring. + * @param repository The {@link UserConnectionRepository} will be injected by Spring. + * @return The configured {@link ProviderSignInController} + */ + @Bean + public ProviderSignInController signInController( + ConnectionFactoryLocator factoryLocator, + UsersConnectionRepository repository + ) + { + ProviderSignInController controller = new ProviderSignInController( + factoryLocator, + repository, + new UserCookieSignInAdapter() + ); + return controller; + } + /** * Configure a scoped bean named facebook, that enables * access to the Graph-API in the name of the current user.