@Override
public UserDetails loadUserByUsername(String userName)
throws UsernameNotFoundException {
ConnectionRepository connectionRepository = usersConnectionRepository
.createConnectionRepository(userName);
SpringSocialProfile springSocialProfile = signUpService.getUserProfile(userName);
List<Connection<?>> allConnections = getConnections(connectionRepository,userName);
if (allConnections.size() > 0) {
Authentication authentication = authenticationFactory
.createAuthenticationForAllConnections(userName,
springSocialProfile.getPassword(),
allConnections);
return new User(userName, authentication.getCredentials()
.toString(), true, true, true, true,
authentication.getAuthorities());