Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Social Rember me login

How can I get Spring Social to have a remember me function using facebook and twitter login that's similar to remember-me login using form based login in Spring Security?

I'm using Spring Social 1.0.0.RC2 and Spring Security 3.0.5.RELEASE.

Thanks

like image 425
2Real Avatar asked Aug 05 '11 23:08

2Real


People also ask

How do you implement remember me in login?

A more secure way to implement the remember me feature is to store a random token instead of a user id in both cookies and database server. When users access the web application, you match the cookies' tokens with those stored in the database. Also, you can check the token's expiration time.

What is Remember Me option in login?

Clicking the “Remember Me” box tells the browser to save a cookie so that if you close out the window for the site without signing out, the next time you go back, you will be signed back in automatically.

How Remember Me works in spring boot?

Remember me is a feature that allows a user to access into application without re-login. User's login session terminates after closing the browser and if user again access the application by opening browser, it prompts for login.

Are Remember Me feature safe?

Use the “remember me” option to reduce how often you have to sign in with two-factor authentication (2FA) on the same web browser. It's safe to use on trusted computers, and lasts for 30 days.


1 Answers

I have an example app that has the code for this here:

https://github.com/sdouglass/spring-security-social

The way I did it was to call Spring Security's TokenBasedRememberMeServices.onLoginSuccess(HttpServletRequest, HttpServletResponse, Authentication) in my Spring Social SignInAdapter implementation.

https://github.com/sdouglass/spring-security-social/blob/master/src/main/java/org/springframework/social/security/social/web/SignInAdapterImpl.java

TokenBasedRememberMeServices JavaDoc

SignInAdapter JavaDoc

like image 158
sdouglass Avatar answered Oct 27 '22 22:10

sdouglass