Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

i'm developing a website with Spring MVC and Spring Security and JAVA backend. Actually it has an authentication process on local database with username and password. Now, i have to add facebook authentication. The final solution should be like the authentication process of stackoverflow. The user must be able to choose between local authentication and Facebook authentication (with the option to share content of the website on his facebook profile). I've seen standard js solution of Facebook, but it seems to be incompatible with spring security and local authentication.

Can someone help me, possibly with some guide or tutorial?

enter image description here

share|improve this question

The web auth and the db auth are two separate issues. I don't use spring but there are OAuth frameworks available that should handle most the work for you. http://projects.spring.io/spring-security-oauth/

For the database security that should be either set based on the backend connection string (for an app based login) or by using pass through authentication from the webserver handling the request. I would NEVER base DB security on facebook login info.

share|improve this answer
    
This may be a helpful example spring.io/guides/tutorials/spring-boot-oauth2 – Paul Swetz Jun 1 at 14:51
    
Spring social docs.spring.io/spring-social/docs/1.1.4.RELEASE/reference/… is a better solution – JEY Jun 1 at 14:53
    
I don't work with spring so JEY is probably right. – Paul Swetz Jun 1 at 14:59
    
I saw spring-social, but i can't get how to integrate with spring security and the possibility to choose between local authentication and facebook authentication. Do you have some tutorial or guide? @JEY – Marco Grechi Jun 1 at 15:25
    
I don't know how to switch between local authentication and facebook authentication in the service that implements UserDetailsService – Marco Grechi Jun 1 at 15:33

You should use Spring Social. First read the doc. Then search on google. Or look at this github project https://github.com/pkainulainen/spring-social-examples/tree/master/sign-in/spring-mvc-normal

share|improve this answer

Solved!!! This guide has been like gold.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.