Question

I have a simple web-application where users can login and perform some simple task. I created the project as a hobby. I want to add Login with Facebook and Twitter using Spring Social to the existing login feature.

I am using hibernate and my Users table have the following fields : username, password (encrypted), uuid, email, enabled and authority.

I looked up the process online and because of the continually changing Spring Social, the examples vary a lot and I am getting confused.

Can anybody explain in simpler terms what are the basic components necessary and how they all tie up if you use spring social?

  1. In most examples there is a UserDetails class to represent my users. There is also a separate "Users" bean. Why are there two different classes? Can we not do away with one.

  2. I already have a Dao class for persistence. Can I re-use it? I guess another way of asking these questions would be to ask what interfaces from spring social should I implement?

  3. I am a spring n00b (to the extent that this was the first time I came across annotation based configs. I have only used xml based config). Which one is chosen where and why?

  4. ProviderSignInController - I believe this makes a request and gets the data.

  5. Connections? What are they where do these connections exist?

I am using spring 3.2.4 and Spring-Social 1.1.0. I have seen examples from both 1.0.3 and 1.1.0.

I will research more, but I need some good pointers to begin with.

Was it helpful?

Solution

You will need adapt your existent database and classes to be like the Users classes of Spring Social, and then you can reuse your users data information.

You can use Spring Social with/or Spring Security without full knowedge in another's Spring frameworks like MVC or Spring Data, however some important concepts like IoC and DI are needed to understand what you are doing.

I'll recommend you one of the bests materials I found in the web about this subject. These tutorials was written by Petri Kainulainen, he also wrote a book about Spring Data. I full agreed with all his words about this application architecture.

http://www.petrikainulainen.net/programming/spring-framework/adding-social-sign-in-to-a-spring-mvc-web-application-configuration/

He also made his project available in github, so you can clone his project and learn more about this subject.

I hope this can help you, Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top