Package org.springframework.social.connect.support

Examples of org.springframework.social.connect.support.ConnectionFactoryRegistry


    @Autowired
    TextEncryptor textEncryptor;

    @Bean
    public ConnectionFactoryLocator connectionFactoryLocator() {
        ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
        registry.addConnectionFactory(new FacebookConnectionFactory(
            config.getFacebookClientId(),
            config.getFacebookClientSecret()));
        return registry;
    }
View Full Code Here


  private String facebookClientId = "209321265842875";
  private String facebookClientSecret = "e14d105e82eb8e8bf1fc9f4918ddb15a";

  @Bean
  public ConnectionFactoryLocator connectionFactoryLocator() {
      ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
      registry.addConnectionFactory(new FacebookConnectionFactory(facebookClientId, facebookClientSecret));
      return registry;
  }
View Full Code Here

   * This bean is defined as a scoped-proxy so it can be serialized in support of {@link ProviderSignInAttempt provier sign-in attempts}.
   */
  @Bean
  @Scope(value="singleton", proxyMode=ScopedProxyMode.INTERFACES
  public ConnectionFactoryLocator connectionFactoryLocator() {
    ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
    registry.addConnectionFactory(new TwitterConnectionFactory(environment.getProperty("twitter.consumerKey"), environment.getProperty("twitter.consumerSecret")));
    registry.addConnectionFactory(new FacebookConnectionFactory(environment.getProperty("facebook.appId"), environment.getProperty("facebook.appSecret")));
    registry.addConnectionFactory(new LinkedInConnectionFactory(environment.getProperty("linkedin.consumerKey"), environment.getProperty("linkedin.consumerSecret")));   
    registry.addConnectionFactory(new TripItConnectionFactory(environment.getProperty("tripit.consumerKey"), environment.getProperty("tripit.consumerSecret")));
    return registry;
  }
View Full Code Here

            return controller;
        }

        @Bean
        public ConnectionFactoryRegistry connectionFactoryRegistry() {
            return new ConnectionFactoryRegistry();
        }
View Full Code Here

  @Inject private DataSource dataSource;
  @Inject private Environment environment;

  @Bean
  public ConnectionFactoryLocator connectionFactoryLocator() {
      ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
      registry.addConnectionFactory(new FacebookConnectionFactory(environment.getProperty("facebook.clientId"), environment.getProperty("facebook.clientSecret")));
      registry.addConnectionFactory(new TwitterConnectionFactory(environment.getProperty("twitter.consumerKey"), environment.getProperty("twitter.consumerSecret")));
      return registry;
  }
View Full Code Here

public class ProviderSignInControllerTest {

  @Test
  public void constructor() {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    usersConnectionRepository.createConnectionRepository("habuma").addConnection(connectionFactory1.createConnection(
      new ConnectionData("oauth1Provider", "provider1User1", null, null, null, null, null, null, null)));
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.setApplicationUrl("my.url");
View Full Code Here

  }
  // OAuth 1

  @Test
  public void signIn_OAuth1Provider() throws Exception {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    usersConnectionRepository.createConnectionRepository("habuma").addConnection(connectionFactory1.createConnection(
      new ConnectionData("oauth1Provider", "provider1User1", null, null, null, null, null, null, null)));
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.afterPropertiesSet();
View Full Code Here

      .andExpect(request().sessionAttribute("oauthToken", samePropertyValuesAs(new OAuthToken("requestToken", "requestTokenSecret"))));
  }

  @Test
  public void signIn_OAuth1Provider_exceptionWhileFetchingRequestToken() throws Exception {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret", StubOAuthTemplateBehavior.THROW_EXCEPTION);
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    usersConnectionRepository.createConnectionRepository("habuma").addConnection(connectionFactory1.createConnection(
      new ConnectionData("oauth1Provider", "provider1User1", null, null, null, null, null, null, null)));
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.afterPropertiesSet();
View Full Code Here

      .andExpect(redirectedUrl("/signin?error=provider"));
  }

  @Test
  public void oauth1Callback_noMatchingUser() throws Exception {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.afterPropertiesSet();
    MockMvc mockMvc = standaloneSetup(providerSignInController).build();
    mockMvc.perform(get("/signin/oauth1Provider").param("verifier", "verifier").param("oauth_token", "requestToken"))
View Full Code Here

    // TODO: Assert attempt contents
  }

  @Test
  public void oauth1Callback_noMatchingUser_customSignUpUrl() throws Exception {
    ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
    ConnectionFactory<TestApi1> connectionFactory1 = new StubOAuth1ConnectionFactory("clientId", "clientSecret");
    connectionFactoryLocator.addConnectionFactory(connectionFactory1);
    StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository();
    ProviderSignInController providerSignInController = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null);
    providerSignInController.setSignUpUrl("/register");
    providerSignInController.afterPropertiesSet();
    MockMvc mockMvc = standaloneSetup(providerSignInController).build();
View Full Code Here

TOP

Related Classes of org.springframework.social.connect.support.ConnectionFactoryRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.