I hate to throw you back into the world of tutorials, but I found the Quick Start to be useful. Part of your confusion sounds like it's related to how you're visualizing the flow:
what i want is my controller should connect to linkedin login page and
then user will enter the details.
That's not quite how they describe the responsibility of your Controller. You are expected to simply take the API binding and do whatever work you need to do. At that point you have already had them log in on LinkedIn.
From: Spring Social Quick Start - Step 4 Invoke APIs
@Controller
public class HomeController {
private final Facebook facebook;
@Inject
public HomeController(Facebook facebook) {
this.facebook = facebook;
}
@RequestMapping(value="/", method=RequestMethod.GET)
public String home(Model model) {
List<Reference> friends = facebook.friendOperations().getFriends();
model.addAttribute("friends", friends);
return "home";
}
}
It's Spring Social's job to handle the connection to LinkedIn, which they do with the ProviderSignInController (see Steps 2 - Configure Spring Social and 3 - Create Views of the Quick Start).
Add a ProviderSignInController that allows users to sign-in using their provider accounts:
@Bean
public ProviderSignInController providerSignInController() {
return new ProviderSignInController(connectionFactoryLocator(), usersConnectionRepository(), new SimpleSignInAdapter());
}
Create a "signin" view that allows users to sign-in with their provider account:
<%@ page session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<form action="<c:url value="/signin/facebook" />" method="POST">
<button type="submit">Sign in with Facebook</button>
</form>
The ProviderSignInController
they create maps itself to /signin/{providerId}
requests which the view then allows users to access.
I'll stress again: check out the Quick Start. It models almost exactly what you describe you want: a Social login which, when complete, redirects to a welcome page displaying the user's Facebook friends.