Turning the app into a pure Facebook-App
[examples/facebook-app] / src / main / java / de / juplo / yourshouter / SocialConfig.java
index 466ed23..40a0aa5 100644 (file)
@@ -2,11 +2,9 @@ package de.juplo.yourshouter;
 
 
 
-import java.math.BigInteger;
 import javax.inject.Inject;
 import javax.sql.DataSource;
 import org.apache.http.HttpRequestFactory;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
@@ -26,7 +24,6 @@ import org.springframework.social.connect.ConnectionSignUp;
 import org.springframework.social.connect.UsersConnectionRepository;
 import org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository;
 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;
@@ -49,11 +46,6 @@ public class SocialConfig extends SocialConfigurerAdapter
   @Inject
   SignInAdapter signInAdapter;
 
-  @Value("${facebook.app.secret}")
-  String secret;
-  @Value("${facebook.app.salt}")
-  String salt;
-
 
   /**
    * Add a {@link FacebookConnectionFactory} to the configuration.
@@ -100,10 +92,7 @@ public class SocialConfig extends SocialConfigurerAdapter
         new JdbcUsersConnectionRepository(
             dataSource,
             connectionFactoryLocator,
-            Encryptors.text(
-                secret,
-                String.format("%08x", new BigInteger(1, salt.getBytes()))
-                )
+            Encryptors.noOpText()
             );
     repository.setConnectionSignUp(connectionSignUp);
     return repository;
@@ -151,26 +140,6 @@ 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, signInAdapter);
-    return controller;
-  }
-
   /**
    * Configure the {@link CanvasSignInController} to enable sign-in through
    * the <code>signed_request</code>, that Facebook sends to the canvas-page.