+ /**
+ * 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, signInAdapter);
+ return controller;
+ }
+
+ /**
+ * Configure the {@link CanvasSignInController} to enable sign-in through
+ * the <code>signed_request</code>, that Facebook sends to the canvas-page.
+ *
+ * @param factoryLocator The {@link ConnectionFactoryLocator} will be injected by Spring.
+ * @param repository The {@link UserConnectionRepository} will be injected by Spring.
+ * @param env The {@link Environment}, to read additional parameters from.
+ * @return The configured {@link CanvasSignInController}
+ */
+ @Bean
+ public CanvasSignInController canvasSignInController(
+ ConnectionFactoryLocator factoryLocator,
+ UsersConnectionRepository repository,
+ Environment env
+ )
+ {
+ return
+ new CanvasSignInController(
+ factoryLocator,
+ repository,
+ signInAdapter,
+ env.getProperty("facebook.app.id"),
+ env.getProperty("facebook.app.secret"),
+ env.getProperty("facebook.app.canvas")
+ );
+ }
+