Giter Site home page Giter Site logo

spring-attic / spring-social Goto Github PK

View Code? Open in Web Editor NEW
617.0 75.0 355.0 9.18 MB

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.

Home Page: http://projects.spring.io/spring-social

License: Apache License 2.0

Java 99.72% HTML 0.04% CSS 0.24%

spring-social's Introduction

spring-social is no longer actively maintained by VMware, Inc.

Spring Social

Spring Social is an extension of the Spring Framework that helps you connect your applications with Software-as-a-Service (SaaS) providers such as Facebook and Twitter.

Features

  • An extensible service provider framework that greatly simplifies the process of connecting local user accounts to hosted provider accounts.

  • A connect controller that handles the authorization flow between your Java/Spring web application, a service provider, and your users.

  • Java bindings to popular service provider APIs such as Facebook, Twitter, LinkedIn, TripIt, and GitHub.

  • A sign-in controller that enables users to authenticate with your application by signing in through a service provider.

  • Much more...

Download Artifacts

See downloading Spring artifacts for Maven repository information. Unable to use Maven or other transitive dependency management tools? See building a distribution with dependencies.

Dependencies

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-core</artifactId>
    <version>${org.springframework.social-version}</version>
</dependency>

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-web</artifactId>
    <version>${org.springframework.social-version}</version>
</dependency>

Repositories

<repository>
    <id>spring-repo</id>
    <name>Spring Repository</name>
    <url>https://repo.spring.io/release</url>
</repository>   
    
<repository>
    <id>spring-milestone</id>
    <name>Spring Milestone Repository</name>
    <url>https://repo.spring.io/milestone</url>
</repository>

<repository>
    <id>spring-snapshot</id>
    <name>Spring Snapshot Repository</name>
    <url>https://repo.spring.io/snapshot</url>
</repository>

Spring Social Modules

The core Spring Social project does not contain provider modules. Each of the provider modules is in its own project. This enables those modules to progress and release on a separate schedule than Spring Social and be able to react more quickly to changes in the provider's API without the need to wait for a Spring Social release. The SaaS provider-specific projects can be cloned from the following GitHub URLs:

Documentation

See the current Javadoc and reference docs. To get up and running quickly using the project, see the Quick Start guide.

Sample Applications

Several example projects are available in the samples repository.

Issue Tracking

Report issues via the Spring Social JIRA. While JIRA is preferred, GitHub issues are also welcome. Understand our issue management process by reading about the lifecycle of an issue.

Build from Source

  1. Clone the repository from GitHub:

    $ git clone https://github.com/spring-projects/spring-social.git
  2. Navigate into the cloned repository directory:

    $ cd spring-social
  3. The project uses Gradle to build:

    $ ./gradlew build
  4. Install jars into your local Maven cache (optional)

    $ ./gradlew install

Import Source into your IDE

Eclipse

  1. To generate Eclipse metadata (.classpath and .project files):

    $ ./gradlew eclipse
  2. Once complete, you may then import the projects into Eclipse as usual:

    File -> Import -> Existing projects into workspace
    

Note: Spring Tool Suite has built in support for Gradle, and you can simply import as Gradle projects.

IDEA

Generate IDEA metadata (.iml and .ipr files):

$ ./gradlew idea

Contributing

Pull requests are welcome. See the contributor guidelines for details.

License

Spring Social is released under version 2.0 of the Apache License.

spring-social's People

Contributors

arthurc avatar bbaia avatar cbeams avatar codeconsole avatar codelirium avatar dwicke01 avatar f-lopes avatar gregturn avatar habuma avatar henokt avatar jaffadog avatar jebeaudet avatar jiwhiz avatar linkedlist avatar liuce avatar michaellavelle avatar micheljung avatar mihajul avatar okohub avatar oscarryz avatar ptahchiev avatar ricardozanini avatar royclarkson avatar sfussenegger avatar spring-builds avatar spring-operator avatar straxus avatar tavin avatar trevormarshall avatar wilkinsona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-social's Issues

SocialUserDetails getUserId() method should be renamed something else

SocialUserDetails interface has a method named getUserId. When implementing this interface, this method clashes if class has this method with different return type. In our case, we are stucked at this point. There is nothing to do but changing whole filters and providers...

getUserId is a very common method name, it should be renamed as getSocialUserId or more unique name to minimize any clash probability.

thanks in advance.

UserConnection table encryption support for sensitive columns

Hello,

I was thinking that maybe it is a good idea if we encrypt sensitive information in the UserConnection table as any leak could enable a malicious attacker to highjack social sessions.

That seems a straightforward change in the spring-social-core social/connect/jdbc area however that might be more tricky to migrate existing rows in a one-off manner.

What is your view on this? If this feature puts value to the project, what technical guidelines would you provide? I will then try to provide a pull request.

Kind regards,
Stavros

SocialAuthenticationFilter.setPostFailureUrl(..) should be aware of SocialAuthenticationFailureHandler

setPostFailureUrl(..) currently only checks for SimpleUrlAuthenticationFailureHandler but SocialAuthenticationFailureHandler is set in the constructor. Therefore, there should be following code added:

if (failureHandler instanceof SocialAuthenticationFailureHandler) {
  failureHandler = ((SocialAuthenticationFailureHandler) failureHandler).getDelegate();
}
if (failureHandler instanceof SimpleUrlAuthenticationFailureHandler) {
  ...

(Obviously, getDelegate() must be added as well)

ClientHttpRequestFactorySelector should only use proxy if system property is non-blank

Hi,

https://github.com/spring-projects/spring-social/blob/1.0.3.RELEASE/spring-social-core/src/main/java/org/springframework/social/support/ClientHttpRequestFactorySelector.java

ClientHttpRequestFactorySelector will try to create a proxy if the system property "http.proxyHost" is set to "" (empty String) as it only checks if it's not null. While it probably shouldn't be set as blank in the first place, this module would be more robust if it only created proxy for a non-empty value.

As an example, http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/classes/sun/net/spi/DefaultProxySelector.java will only use proxy if non-empty.

Change HTTP components back to 4.3.x

1.1.3.RELEASE has moved form HTTP components 4.3.x to 4.5.x. This breaks applications using 4.3.x, for example:

java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at org.springframework.social.support.ClientHttpRequestFactorySelector.getRequestFactory(ClientHttpRequestFactorySelector.java:69)
at org.springframework.social.oauth1.OAuth1Template.createRestTemplate(OAuth1Template.java:171)
at org.springframework.social.oauth1.OAuth1Template.<init>(OAuth1Template.java:92)
at org.springframework.social.oauth1.OAuth1Template.<init>(OAuth1Template.java:72)
at org.springframework.social.oauth1.OAuth1Template.<init>(OAuth1Template.java:68)
at org.springframework.social.connect.oauth1.FakeServiceProvider.<init>(FakeServiceProvider.java:28)
at org.springframework.social.connect.oauth1.OAuth1ConnectionTest.oauth1ConnectionSerializable(OAuth1ConnectionTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.http.ssl.TrustStrategy
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 49 more

This makes Spring Social 1.1.3 incompatible with Spring Boot 1.2.x. Requiring a new minor version of a dependency in a maintenance release isn't acceptable in Spring Boot or Spring IO Platform. Please change back to supporting HTTP components 4.3.x.

OAuth2AuthenticationService has no applicationUrl support

Issue: Currently OAuth2AuthenticationService does not support changing the applicationUrl like the ProviderSignInController/ConnectController does.

The request_uri is built purely based on the request, which is mostly fine except for when a server is behind a reverse proxy (nginx, etc).
StringBuffer sb = request.getRequestURL();

Suggestion/Fix: Add an applicationUrl variable in the OAuth2AuthenticationService which the request_uri can be built from.

HttpClient configuration / connection resets

I'm seeing occasional connection reset errors when posting to Twitter, hypothetically from stale connections. How robust is the connection handling of the HttpClient constructed by this component? There seems to be no way to inject a customized HttpClient instance...

SpringSocialConfigurer with jdk 8

Using spring-social-config to configure sign-in with provider lead to compilation error if the project is configured with bytecode level 1.8. Code snippet below

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .formLogin()
                .loginPage("/signin")
                .loginProcessingUrl("/signin/authenticate")
                .failureUrl("/signin?param.error=bad_credentials")
                .and()
                .logout()
                .logoutUrl("/signout")
                .deleteCookies("JSESSIONID")
                .and()
                .authorizeRequests()
                .antMatchers("/admin/**", "/favicon.ico","/signin/**").permitAll()
                .antMatchers("/**").authenticated()
                .and()
                .rememberMe()
                .and()
                .apply(new SpringSocialConfigurer());
    }

When compiling the previous code with bytecode level 1.8. The compiler gives an 'ambiguous method call ' error on the AbstractConfiguredSecurityBuilder.apply method.

I am using spring-boot 1.0.2.RELEASE with spring-secuirty 3.2.3.RELEASE and spring-social 1.1.0.RELEASE.

Make UserProfile extendable

Constructor of UserProfile class is not public and an instance can only be build via UserProfileBuilder. It should be public in order to add extra information to UserProfile

Spring Social in Spring Android

I use 1.1.0.M3 version of Spring Social and 1.0.1 Spring Android.

It looks like I found the following bug connected with the following one:
https://jira.springsource.org/browse/ANDROID-54

The issue is connected to Default http client for RestTemplate.

org.springframework.social.oauth1.OAuth1Template create RestTemplate using the method
private RestTemplate createRestTemplate()

It uses ClientHttpRequestFactorySelector.getRequestFactory() which create http client taking into account HTTP_COMPONENTS_AVAILABLE var and does not taking into account current Android version.

Initially requestFactory field in RestTemplate has correct value according Android version (setup in HttpAccessor constructor). However it will be overridden by the method setRequestFactory in the constructor:

public RestTemplate(boolean includeDefaultConverters, ClientHttpRequestFactory requestFactory)

As result we use wrong version of HttpClient.

Please solve this issue. Thanks in advance.

[suggestion] Halting Connection process by returning boolean from preConnect?

In our application we do not want to allow a user to connect with a different facebook connection if they've already connected previously with a different facebook providerUserId.

I've already had to extend ConnectController for some other purposes so I could accomplish what I need by overriding connect as so:

@Override
public RedirectView connect(@PathVariable String providerId, NativeWebRequest request) {
    /*
    User from session
    if userId found in UserConnections table for the providerId, then abort the connect process
    put message in scope "This account has already been connected with Facebook User: "John Doe"
    return user to some page
    */
    else {
        return super.connect(providerId, request);
    } 
}

However, many users might not have a need to really extend ConnectController but they'll probably have created an Interceptor and might be relying on preConnect.

I was thinking why not have preConnect in ConnectController return a boolean and in the preConnect method if any of the interceptor preConnects return a 'false' then you leave preConnect and return false. Within "connect" you'd then halt the oauth stuff if preConnect returned false. So something like:

@RequestMapping(value="/{providerId}", method=RequestMethod.POST)
public RedirectView connect(@PathVariable String providerId, NativeWebRequest request) {
    ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId);
    MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); 
    if (preConnect(connectionFactory, parameters, request)) {
            return new RedirectView(webSupport.buildOAuthUrl(connectionFactory, request, parameters));
    } else {
        return new RedirectView("connectionExistsForUser");
    }
}

@SuppressWarnings({ "rawtypes", "unchecked" })
protected boolean preConnect(ConnectionFactory<?> connectionFactory, MultiValueMap<String, String> parameters, WebRequest request) {
    for (ConnectInterceptor interceptor : interceptingConnectionsTo(connectionFactory)) {
        boolean ok = interceptor.preConnect(connectionFactory, parameters, request);
        if (!ok) return false;
    }
    return true;
}

JdbcUsersConnectionRepository.sql isn't compatible with MySQL

Running JdbcUsersConnectionRepository.sql on MySQL 5.1 gives the following error:
[ERROR in query 1] Specified key was too long; max key length is 1000 bytes

The culprit being: primary key (userId, providerId, providerUserId)

Reducing the size of the userId, providerId and/or providerUserId columns resolves the issue...

Change Spring Security dependency back to 3.2.x

1.1.3.RELEASE moved from Spring Security 3.2.x to 4.0.x. While it's only an optional dependency and, therefore, doesn't affect an application's transitive dependencies, it introduces the risk of making a new maintenance release of Spring Social force users to move to a new major version of Spring Security. To avoid this risk, Spring Social should continue to compile against Spring Security 3.2.x.

shouldn't ConnectionFactoryLocator be auto-configured in spring boot application?

in the current spring-social-showcase-boot, I didn't see ConnectionFactoryLocator is configured anywhere, but in the latest code, the ProviderSignInUtils constructor has changed to

public ProviderSignInUtils( ConnectionFactoryLocator connectionFactoryLocator,UsersConnectionRepository connectionRepository) {
...
}

which means I need a ConnectionFactoryLocator and UsersConnectionRepository bean to create ProviderSignInUtils.

The recommended way of configure ConnectionFactoryLocator shown from the current reference:

@Bean
@Scope(value="singleton", proxyMode=ScopedProxyMode.INTERFACES)
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;
}

duplicates the codes with spring-boot's autoconfigure class, like TwitterAutoConfiguration FacebookAutoConfiguration in the reading properties part, should a ConnectionFactoryLocator be configured when it detects the spring-social configuration in the application.properties?

It should also be useful to expose the $provider$ConnectionFactory bean created in the SocialAutoConfigurerAdapter subclasses:

@Override
protected ConnectionFactory<?> createConnectionFactory() {
            return new TwitterConnectionFactory(this.properties.getAppId(),
                    this.properties.getAppSecret());
}

then we can create ConnectionFactoryRegistry by just wiring existing factories.

Sets make this unusable, Set<String> findUserIdsConnectedTo(String pId, Set<String> pUserIds)

Basically, we call this method because we have a collection, LIst, of social user ids that we need to convert into application user ids. But because you use sets, it is impossible to do this, since the order in is not going to be the order out. So you can never line them up. This makes this method useless, and causes N number of queries instead of just one query to the userconnection table.

SessionAuthenticationStrategy from HttpSecurity in SpringSocialConfigurer

It would be nice, if SpringSocialConfigurer could set a SessionAuthenticationStrategy, previously configured in HttpSecurity to SocialAuthenticationFilter.

Example HttpSecurity configuration that should create ConcurrentSessionControlAuthenticationStrategy (and others in composite) and apply it to SocialAuthenticationFilter when using SpringSocialConfigurer.

http.
                .sessionManagement()
                   .maximumSessions(5)
                   .maxSessionsPreventsLogin(true)
                   .sessionRegistry(sessionRegistry).and().and()
                .apply(new SpringSocialConfigurer())

Set scope not being used in built OAuth2 URL

I followed the guide for implementing my own provider and have used others as a reference. We require a scope to be provided when hitting our OAuth2 endpoints, and I'd prefer if the scope can be configured when we create our connection factory:

MyConnectionFactory mycf = new MyConnectionFactory("clientId", "clientSecret");
mycf.setScope("myApi");
cfConfig.addConnectionFactory(mycf);

However, this scope never makes it to the OAuth2AuthenticationService. When OAuth2AuthenticationService#setScope executes, defaultScope is still an empty string. The defaultScope is supposed to be set within SecurityEnabledConnectionFactoryConfigurer#wrapAsAuthenticationService, but nothing seems to get executed after the final OAuth2AuthenticationService<A> authService = ... line (I set breakpoints, logs and system out).

I don't know what could be preventing the next line to be run, but because it's not running the default scope is never being set.

The workaround is to set the scope as a url parameter, but I'd prefer this to be coded in config.

Possible overflow during access token processing

We have the problem that Facebook long-lived access token's lifetime is two weeks instead of 60 days. The expiration date doesn't correspond to original received from Facebook after Spring Social saves token to DB repository table.
The possible problem is overflow in the Spring Social code

public AccessGrant(String accessToken, String scope, String refreshToken, Integer expiresIn) {
this.accessToken = accessToken;
this.scope = scope;
this.refreshToken = refreshToken;
this.expireTime = expiresIn != null ? System.currentTimeMillis() + expiresIn * 1000 : null;
}

expiresIn * 1000 will overflow the Integer type.

Please check

ProviderSignInUtils API desync with docs

It seems that ProviderSignInUtils API has changed from static methods to interface, but docs still use old version which made me confused for some time.

If that will help, I solved it in straight forward way (probably not the best) in my SocialConfigurer added

@Autowired
ConnectionFactoryLocator connectionFactoryLocator;

@Bean
public ProviderSignInUtils providerSignInUtils() {
   return new ProviderSignInUtils(connectionFactoryLocator, getUsersConnectionRepository(connectionFactoryLocator));
}

And just AutoWired it in controller where I needed it:

@Autowired
private ProviderSignInUtils signInUtils;

ClientHttpRequestFactorySelector fails when using Spring 4.x and httpclient-4.2.5

ClientHttpRequestFactorySelector checks for the existence of "org.apache.http.client.HttpClient" but Spring 4.x also requires "org.apache.http.config.Lookup" class which doesn't exist in httpclient 4.2.5 so the app fails with a NoClassDefFoundException. Maybe you could add a check for that class as well, and if not found use the SimpleClientHttpRequestFactory instead.

We don't have much control of the classpath, so we can't easily upgrade to httpclient-4.3.x, this is running inside Hadoop YARN where httpclient-4.2.5 is already on the classpath.

Stacktrace:

10:50:23,309 1.1.0.SNAP  WARN DeploymentsPathChildrenCache-0 annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.x.twitter.TwitterStreamChannelAdapter#0' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Cannot resolve reference to bean 'twitterTemplate' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:648)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:211)
    at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
    at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
    at org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363)
    at org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332)
    at org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179)
    at org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 39 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)
    ... 48 more
Caused by: java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.apache.http.impl.client.HttpClients.createSystem(HttpClients.java:66)
    at org.springframework.http.client.HttpComponentsClientHttpRequestFactory.<init>(HttpComponentsClientHttpRequestFactory.java:72)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.<init>(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator.createRequestFactory(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector.getRequestFactory(ClientHttpRequestFactorySelector.java:52)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplateWithCulledMessageConverters(AbstractOAuth1ApiBinding.java:188)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplate(AbstractOAuth1ApiBinding.java:169)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.<init>(AbstractOAuth1ApiBinding.java:70)
    at org.springframework.social.twitter.api.impl.TwitterTemplate.<init>(TwitterTemplate.java:79)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 50 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.config.Lookup
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 64 more
10:50:23,314 1.1.0.SNAP ERROR DeploymentsPathChildrenCache-0 boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.x.twitter.TwitterStreamChannelAdapter#0' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Cannot resolve reference to bean 'twitterTemplate' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:648)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:211)
    at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
    at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
    at org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363)
    at org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332)
    at org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179)
    at org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 39 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)
    ... 48 more
Caused by: java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.apache.http.impl.client.HttpClients.createSystem(HttpClients.java:66)
    at org.springframework.http.client.HttpComponentsClientHttpRequestFactory.<init>(HttpComponentsClientHttpRequestFactory.java:72)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.<init>(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator.createRequestFactory(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector.getRequestFactory(ClientHttpRequestFactorySelector.java:52)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplateWithCulledMessageConverters(AbstractOAuth1ApiBinding.java:188)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplate(AbstractOAuth1ApiBinding.java:169)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.<init>(AbstractOAuth1ApiBinding.java:70)
    at org.springframework.social.twitter.api.impl.TwitterTemplate.<init>(TwitterTemplate.java:79)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 50 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.config.Lookup
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 64 more
10:50:23,317 1.1.0.SNAP ERROR DeploymentsPathChildrenCache-0 server.DeploymentListener - Exception deploying module
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.x.twitter.TwitterStreamChannelAdapter#0' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Cannot resolve reference to bean 'twitterTemplate' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:648)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:139)
    at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:211)
    at org.springframework.xd.dirt.module.ModuleDeployer.doDeploy(ModuleDeployer.java:217)
    at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:200)
    at org.springframework.xd.dirt.server.DeploymentListener.deployModule(DeploymentListener.java:363)
    at org.springframework.xd.dirt.server.DeploymentListener.deployStreamModule(DeploymentListener.java:332)
    at org.springframework.xd.dirt.server.DeploymentListener.onChildAdded(DeploymentListener.java:179)
    at org.springframework.xd.dirt.server.DeploymentListener.childEvent(DeploymentListener.java:147)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
    at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
    at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
    at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
    at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
    at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'twitterTemplate' defined in file [/home/trisberg/Hadoop/hadoop-2.6.0-store/nm-local-dir/usercache/trisberg/appcache/application_1422027550150_0001/filecache/17/spring-xd-yarn-1.1.0.BUILD-SNAPSHOT.zip/modules/source/twitterstream/config/twitterstream.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1131)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1034)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
    ... 39 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.social.twitter.api.impl.TwitterTemplate]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:267)
    ... 48 more
Caused by: java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
    at org.apache.http.impl.client.HttpClients.createSystem(HttpClients.java:66)
    at org.springframework.http.client.HttpComponentsClientHttpRequestFactory.<init>(HttpComponentsClientHttpRequestFactory.java:72)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator$1.<init>(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector$HttpComponentsClientRequestFactoryCreator.createRequestFactory(ClientHttpRequestFactorySelector.java:77)
    at org.springframework.social.support.ClientHttpRequestFactorySelector.getRequestFactory(ClientHttpRequestFactorySelector.java:52)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplateWithCulledMessageConverters(AbstractOAuth1ApiBinding.java:188)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.createRestTemplate(AbstractOAuth1ApiBinding.java:169)
    at org.springframework.social.oauth1.AbstractOAuth1ApiBinding.<init>(AbstractOAuth1ApiBinding.java:70)
    at org.springframework.social.twitter.api.impl.TwitterTemplate.<init>(TwitterTemplate.java:79)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 50 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.config.Lookup
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 64 more

I used spring social twitter upload picture to twitter, why the display is not correct on twitter?

I used the spring social twitter api to upload picture to twitter, like this:

  TimelineOperations timelineOperations = twitter.timelineOperations();
  TweetData tweetData = new TweetData(message.getMessage());
  tweetData.withMedia(new UrlResource(new URL(timeline.getPhotoUrl())));
  timelineOperations.updateStatus(tweetData);

This operation returns 200, and I can see the uploaded pictures and message on twitter timeline, but the picture has become below this:

a49kvneb 6a r xvcl u v1

I do not know why, my english is not very good, I do not know whether it can be understood, but please help me, thank you!

about customize application url

Hello:
Let's talk about this issue.
Both ConnectController and ProviderSignInController implement the InitializingBean, which make the configuration likes this would occur NullPointerException:
@bean
public ConnectController connectController(
ConnectionFactoryLocator connectionFactoryLocator,
ConnectionRepository connectionRepository) throws Exception {
ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository);
conn.setApplicationUrl("github.com");
return conn;
}

Even invoked afterPropertiesSet() before setting application url, spring framework would autoinvoke afterPropertiesSet() one more time and clean up the properties of ConnectSupport instance:
@bean
public ConnectController connectController(
ConnectionFactoryLocator connectionFactoryLocator,
ConnectionRepository connectionRepository) throws Exception {
ConnectController conn = new ConnectController(connectionFactoryLocator, connectionRepository);
conn.afterPropertiesSet();
conn.setApplicationUrl("github.com");
return conn;
}

Maybe there are other ways to customize my appilcaiton url, but I could not find out. I checked this issue on stackoverflow, only found more similiar questions without the answer, such as:
http://stackoverflow.com/questions/25626064/nullpointer-bug-in-spring-social-connectcontroller-configuration

Issues when using httpclient 4.4

After upgrading my stack to httpclient 4.4, I started seeing a NoHttpResponseException, when the RestTemplate made calls to the same host (e.g facebook) after a minute. I suspect it's because the http connection is assumed to be kept alive, but closed by the end-server.

It could be fixed by use the setValidateAfterInactivity() function in RequestConfig or even disable connection reuse entirely, however there appears to be no way to pass in a ClientHttpRequestFactory that I can configure.

405 Method not allowed: GET not supported

Ok, i have included the following plugins:

    compile "org.springframework.social:spring-social-core:1.1.2.RELEASE"
    compile "org.springframework.social:spring-social-web:1.1.2.RELEASE"
    compile "org.springframework.social:spring-social-config:1.1.2.RELEASE"
    compile "org.springframework.social:spring-social-security:1.1.2.RELEASE"
    compile "org.springframework.social:spring-social-github:1.0.0.M4"

i am using spring boot 1.3.0.M5
my config looks like this:

@Configuration
@EnableSocial
class SocialConfig extends SocialConfigurerAdapter {

    @Override
    void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer,
                                Environment environment) {
//        connectionFactoryConfigurer.addConnectionFactory(
//                new GitHubConnectionFactory(
//                        environment.getProperty("config.oauth2.github.appId"),
//                        environment.getProperty("config.oauth2.github.appSecret")
//                )
//        )
    }


    @Override
    UserIdSource getUserIdSource() {
        return {
            return "anonymous"
        }
    }
}

if I want to see my connections, i get a 405
screen shot 2015-09-09 at 11 05 54

The log tells me this:

2015-09-09 10:58:42.055 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Bound request context to thread: FirewalledRequest[ org.apache.catalina.connector.RequestFacade@440198c]
2015-09-09 10:58:42.055 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/connect/]
2015-09-09 10:58:42.057 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@5c7c237e] in DispatcherServlet with name 'dispatcherServlet'
2015-09-09 10:58:42.058 TRACE 5384 --- [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : No handler mapping found for [/connect/]
2015-09-09 10:58:42.058 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@1bf8c1cc] in DispatcherServlet with name 'dispatcherServlet'
2015-09-09 10:58:42.058 DEBUG 5384 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /connect/
2015-09-09 10:58:42.062 TRACE 5384 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Found 1 matching mapping(s) for [/connect/] : [{[/connect/],methods=[GET]}]
2015-09-09 10:58:42.062 DEBUG 5384 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public java.lang.String org.springframework.social.connect.web.ConnectController.connectionStatus(org.springframework.web.context.request.NativeWebRequest,org.springframework.ui.Model)]
2015-09-09 10:58:42.063 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler adapter [org.springframework.data.rest.webmvc.RepositoryRestHandlerAdapter@634e6a70]
2015-09-09 10:58:42.063 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler adapter [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter@6bb86bf4]
2015-09-09 10:58:42.063 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/connect/] is: -1
2015-09-09 10:58:42.068 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestParamMethodArgumentResolver@53fca559] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver@530e4f78] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver@4769c291] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.PathVariableMapMethodArgumentResolver@69d1004c] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver@74e006f7] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver@3df26755] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor@495119a2] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.069 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor@3b833206] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver@e5dda2d] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver@2c6cdae2] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver@52a57852] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver@18d4132e] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver@5a5c4704] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.070 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver@62a97202] supports [interface org.springframework.web.context.request.NativeWebRequest]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestParamMethodArgumentResolver@53fca559] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver@530e4f78] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver@4769c291] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.PathVariableMapMethodArgumentResolver@69d1004c] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver@74e006f7] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver@3df26755] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor@495119a2] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor@3b833206] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver@e5dda2d] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver@2c6cdae2] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver@52a57852] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver@18d4132e] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver@5a5c4704] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver@62a97202] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.ServletResponseMethodArgumentResolver@26cd111] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.071 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor@37fd8966] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.072 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.servlet.mvc.method.annotation.RedirectAttributesMethodArgumentResolver@42316ff0] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.072 TRACE 5384 --- [nio-8080-exec-1] s.HandlerMethodArgumentResolverComposite : Testing if argument resolver [org.springframework.web.method.annotation.ModelMethodProcessor@195c6869] supports [interface org.springframework.ui.Model]
2015-09-09 10:58:42.073 TRACE 5384 --- [nio-8080-exec-1] .w.s.m.m.a.ServletInvocableHandlerMethod : Invoking [ConnectController.connectionStatus] method with arguments [ServletWebRequest: uri=/connect/;client=0:0:0:0:0:0:0:1, {}]
2015-09-09 10:58:42.084 TRACE 5384 --- [nio-8080-exec-1] .w.s.m.m.a.ServletInvocableHandlerMethod : Method [connectionStatus] returned [connect/status]
2015-09-09 10:58:42.087 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Requested media types are [text/html, application/xhtml+xml, image/webp, application/xml;q=0.9, */*;q=0.8] based on Accept header types and producible media types [*/*])
2015-09-09 10:58:42.087 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.BeanNameViewResolver  : No matching bean found for view name 'connect/status'
2015-09-09 10:58:42.091 TRACE 5384 --- [nio-8080-exec-1] o.s.w.s.v.InternalResourceViewResolver   : Cached view [connect/status]
2015-09-09 10:58:42.091 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Returning [org.springframework.web.servlet.view.InternalResourceView: name 'connect/status'; URL [connect/status]] based on requested media type 'text/html'
2015-09-09 10:58:42.091 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Rendering view [org.springframework.web.servlet.view.InternalResourceView: name 'connect/status'; URL [connect/status]] in DispatcherServlet with name 'dispatcherServlet'
2015-09-09 10:58:42.091 TRACE 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Rendering view with name 'connect/status' with model {social_authorization_error=null, providerIds=[], connectionMap={}} and static attributes {}
2015-09-09 10:58:42.091 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Removed model object 'social_authorization_error' from request in view with name 'connect/status'
2015-09-09 10:58:42.091 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Added model object 'providerIds' of type [java.util.HashMap$KeySet] to request in view with name 'connect/status'
2015-09-09 10:58:42.091 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Added model object 'connectionMap' of type [org.springframework.util.LinkedMultiValueMap] to request in view with name 'connect/status'
2015-09-09 10:58:42.092 DEBUG 5384 --- [nio-8080-exec-1] o.s.w.servlet.view.InternalResourceView  : Forwarding to resource [connect/status] in InternalResourceView 'connect/status'
2015-09-09 10:58:42.095 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Bound request context to thread: FirewalledRequest[ FirewalledRequest[ org.apache.catalina.core.ApplicationHttpRequest@484f42a1]]
2015-09-09 10:58:42.095 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/connect/connect/status]
2015-09-09 10:58:42.095 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler map [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping@5c7c237e] in DispatcherServlet with name 'dispatcherServlet'
2015-09-09 10:58:42.095 TRACE 5384 --- [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping  : No handler mapping found for [/connect/connect/status]
2015-09-09 10:58:42.095 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Testing handler map [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping@1bf8c1cc] in DispatcherServlet with name 'dispatcherServlet'
2015-09-09 10:58:42.095 DEBUG 5384 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /connect/connect/status
2015-09-09 10:58:42.097 DEBUG 5384 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
2015-09-09 10:58:42.097 DEBUG 5384 --- [nio-8080-exec-1] .w.s.m.a.ResponseStatusExceptionResolver : Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
2015-09-09 10:58:42.097 DEBUG 5384 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
2015-09-09 10:58:42.097  WARN 5384 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound             : Request method 'GET' not supported
2015-09-09 10:58:42.098  WARN 5384 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Handler execution resulted in exception: Request method 'GET' not supported
2015-09-09 10:58:42.098 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2015-09-09 10:58:42.098 TRACE 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Cleared thread-bound request context: FirewalledRequest[ FirewalledRequest[ org.apache.catalina.core.ApplicationHttpRequest@484f42a1]]
2015-09-09 10:58:42.098 DEBUG 5384 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Successfully completed request

So there is a request to connect/connect/status which has no handler obvious.

Did i configure something wrong?
When I post to connect/github, so enabled github and have a valid id and key it will redirect me, so there is a template problem i guess.

Any solutions?

Edit: This also happens with spring boot 1.2.5.RELEASE

Spring Social Quickstart

Hi,

I am new to spring. I tried to run the Spring Social Quickstart example from office. Its nt working as it goes thorught a network proxy and connected to internet. So i would like to know how this can be achieved. Also the application id specified in the sample is not valid. So i created a new facebook app and used the id and key from it.

Add ProviderUserId information to UserProfile object

Please include providerUserId information to UserProfile object.

This is a very common field to use. When working independently from providers, it is more important then other fields; for example i should reach providerUserId in order to do some checks in connection table.

or make UserProfile extendable #167

Better error handling with ProviderSignInController

The ProviderSignInController contains some handlers which can throw exceptions not handled properly.
For example: connectionFactoryLocator.getConnectionFactory(providerId) appears to be throwing an IllegalArgumentException which is not caught within the handler's scope to return provide the redirection url but rather gives back a shouty 500.
I will fork the repo soon and provide a pull request with a candidate solution.

SocialAuthenticationFilter should catch UsernameNotFoundException to enable connection retrieval on authentication failure

spring-social / spring-social-security / src / main / java / org / springframework / social / security / SocialAuthenticationFilter.java Line 305

This should catch org.springframework.security.core.userdetails.UsernameNotFoundException not BadCredentialsException (or maybe the super class AuthenticationException) as it means the catch doesn't happen and you cannot get the connection details from the session for signup registration forms.

Getting spring-expression 3.2.8.RELEASE in my project's classpath as a transitive dependency of spring-social-security 1.1.0.RELEASE

I'm trying to get my project Spring Social Tumlbr up to date with the latest Spring Social 1.1.0 code. I've updated my dependencies to use the 1.1.0.RELEASE version of the Social modules:

<properties>
    ...
    <spring-social.version>1.1.0.RELEASE</spring-social.version>
    ...
</properties>
...
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-security</artifactId>
        <version>${spring-social.version}</version>
    </dependency>
...

spring-social-security 1.1.0.RELEASE has a dependency on spring-security-web 3.2.3.RELEASE, which in turn has a dependency on spring-expression 3.2.8.RELEASE. This is causing me an issue because I am generally trying to use Spring core 4.x. So in my testing project where I try to use Spring Social Tumblr I wind up having both the 3.x and 4.x versions of spring-expression in the classpath, which is causing a ClassNotFoundException.

I can hack around this in my Spring Social Tumblr pom.xml by excluding the spring-expression dependency from the spring-social-security dependency, but it seems like it would be better if that exclusion were to happen in spring-social-security pom.xml instead, ultimately. spring-social-security should probably have an explicit top-level dependency on spring-expression 4.x in a fashion similar to how spring-social-core has an explicit top-level dependency on spring-web 4.x. That way there would be some clarity and consistency around Spring Social 1.1.0 using Spring 4.x.

Sping framework version issue

Spring Framework version in gradle.properties should be 4.1.6, not 4.1.6.BUILD-SNAPSHOT. At least in release version of Spring Social.

No Default Namespace set for spring-social-1.1.xsd

Easier way to extend PageOperations

Currently all facebook PageOperations depend on the "access_token" to be present. This abstraction is handled in the PageOperations template which introduces a private cache and getter for page access tokens. The problem arises that:

  • there is no easy way to add new PageOperations extending the existing ones
  • implementing the logic in someone's own code requires reimplementing the token cache since its private which makes it a bit redundant.

Places I am having trouble with:
For example PageOperations exposes the postPhoto(pageId, albumId, Resource) method, in order to use that one will have to first create an album in the given pageId. There doesn't seem to be a way to do that currently. MediaOperations.createAlbum creates it in the user's account and not under the page. There also doesn't seem to be an api to post directly to a page wall, which would seem like a much more common use case, then posting to an album (which can't be created programmatically currently). For example to post a photo to a page wall i have to write something like

Map<String, Account> accountCache = new HashMap<String, Account>();List<Account> accounts = facebook.pageOperations().getAccounts();
for (Account account : accounts) {
accountCache.put(account.getId(), account);
}
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
parts.set("source", imageResource);
parts.set("message", message);
parts.set("access_token", accountCache.get(facebookPageId).getAccessToken());
facebook.publish(facebookPageId, "photos", parts);

Notice that accountCache will be redundant. I read the API a few times, browsed over the code but didnt see a better way at doing it. What's your take on this?

SocialAuthenticationFilter.signupUrl should dynamically prepend context path

In the 1.1.0.M2 sample, SocialAuthenticationFilter.signupUrl needs to know the context path of the application (p:signupUrl="/spring-social-showcase/signup").

It would be better if the context path was dynamically prepended. Then I could just tomcat:run on the sample and it would run fine. Right now, it does not as the maven tomcat plugin deploys it on http://localhost:8080/spring-social-showcase-sec-xml (where http://localhost:8080/spring-social-showcase was expected).

Provide different error handling strategies for failing oauth2callback

In ProviderSignInController#oauth2Callback (Source) all errors are caught and treated the same, i.e. the user is redirected to the sign in page. It would be great if there was some integrated way to modify this behavior in certain cases.

In my specific case an automatic sign up may be rejected by throwing an exception in an implementation of ConnectionSignUp. I would prefer to show the users the reason for the sign up rejection instead of redirecting them to the sign in page.

A very simple solution (which I could provide via PR) would maintain the existing behavior while providing configuration options (thinking along the lines of putting the catch block in a separate method which could be overriden).

NPE in setApplicationUrl using POJO construction

This was working fine in 1.0.3.

ProviderSignInController controller = new ProviderSignInController(connectionFactoryLocator,
usersConnectionRepository, new SpringSecuritySignInAdapter(userBean, userService, preferencesRepository, regCode));
 controller.setApplicationUrl(this.applicationUrl);

Pretty much as per your documentation, wrapped in a method annotated @Bean and in a class annotated @Configuration.

I did not now expect the following stacktrace:

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.social.connect.web.ProviderSignInController com.mjog.portal.spring.social.config.SpringControllerFactory.providerSignInController()] threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:586)
... 48 more
Caused by: java.lang.NullPointerException
at org.springframework.social.connect.web.ProviderSignInController.setApplicationUrl(ProviderSignInController.java:142)

(Our boring code omitted).

Basically setApplicationUrl() now expects afterPropertiesSet() to have been already called. Within POJO construction this is not the case.

Unable to proceed, unless I've again got something badly misunderstood here.

OAuth2Template's useParametersForClientAuthentication field does not work properly

The HTTP Basic authorization header is always added to the request no matter you call setUseParametersForClientAuthentication with true because the interceptor PreemptiveBasicAuthClientHttpRequestInterceptor is added in the constructor.

This configuration should be done by overriding a method or by adding a parameter in the constructor.

In unit tests class 'OAuth2TemplateTest', we should update the code:

if (expectedAuthorizationHeader != null) {
  responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));
}

by something like :

if (expectedAuthorizationHeader == null) {
  // Expect 'Authorization' is not present
} else {
  responseActions.andExpect(header("Authorization", expectedAuthorizationHeader));  
}

Adding connection not working

Adding a connection for an already authenticated user fails for two reasons:

  1. Redirecting inside SocialAuthenticationFailureHandler won't work as onAuthenticationFailure(..) is called after clearing the SecurityContext, thus the user is logged out. Following the contract of attemptAuthentication(..) it should "Return null, indicating that the authentication process is still in progress"
  2. The principal used insied addConnection(..) is always null as the SocialAuthenticationToken is unauthenticated at this point (If authenticated it still wouldn't be of type ConnectionData though). Instead, token.getConnection() should be used directly.

redirect_url is http instead of https when running under nginx

I've got a spring boot app with

# Running behind nginx
server.tomcat:
  protocolHeader: X-Forwarded-Proto
  remoteIpHeader: X-Forwarded-For

But when I try to login, the redirect url for linked in starts with http instead of https.

Is there something I need to do in spring social to force https?

can ConnectController return JSON instead of view

I developed an application as REST API with spring boot. But when using spring-social I realized that ConnectController and ProviderSignInController returns only views and not support JSON.

I looked to fast override ConnectController and ProviderSignInController but there are an explicite instantiation of ConnectController in org.springframework.boot.autoconfigure.social.SocialWebAutoConfiguration.

Is there a way to return JSON whilst keeping use AutoConfiguration ?

Error on running the sample

hi - I just followed the instructions you mentioned to run the application. I was able to successfully deploy the application to tcServer. When I run the application and click on the "Connect to Facebook"; I get this error message:

{
"error": {
"type": "OAuthException",
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration."
}
}

I am new to Facebook development so if this is related to how we write applications for FB, please point me to a URL for the same

Thanks
Kapil Viren Ahuja

SocialUserDetailsService throws DataAccessException

Why does SocialUserDetailsService.loadUserByUserId() declare that it throws a DataAccessException? I don't see the code specifically handling this exception. Can this be removed? This creates a dependency on the Spring Framework transactions project which seems unnecessary. The only other such dependency is on the JDBC connection classes, but these do not need to be used if you are creating your own connection classes.

As seen here:
https://github.com/spring-projects/spring-social/blob/1.1.2.RELEASE/spring-social-security/src/main/java/org/springframework/social/security/SocialUserDetailsService.java#L34

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.