24 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Ajay Prem Shankar
9 years ago

Where the loginProcessingUrl, i.e., login_check is defined in the code. How framework in handling ‘login_check’ URL?

rafeeq
10 years ago

Is there a working example of non persistent, token based approach ?

Krish
8 years ago

I have a user that just makes a API calls to spring secure application.
I just want to make a one time authentication to that user to access my secure application
and I don’t want to sign in again to make the subsequent calls.
How can I achieve this?

Alexandr Danchenko
9 years ago

I’m trying to add Rememeber Me to my web application. Application based on Spring and Spring Security.

After a couple of hours remember-me cookie start created. But if I close browser or stop server remember-me cookie disappear.

Maybe someone can suggest some solution or reason why this happening.

Please, help 🙂

Best regards, Alex.

Ranjan Kumar
10 years ago

I tried all the application from your blog but all are showing 404 error …what should I do….

Moussi Aymen
10 years ago

Hello Mkyong,

it’s just an amazing tuto thank you very much.

I have a question how can i make remember me feature enabled always without putting the checkbox input on login form ?

I posted a question on stackoverflow.com if you can or you have any ideas.

http://stackoverflow.com/questions/31982356/spring-security-activate-remember-me-feature-always

thanks

Hinotori
10 years ago

Hello Mkyong,

Did just what you exp?ained, but using spring-security 4.0.1.RELEASE

Implemented PersistentTokenRepository on a class, passed it as the repo, could log in, but never got a login by remember-me

When restart tomcat and the browser (to test remember-me), i can see the data being updated, but i always get a 403. Any ideas?!

Vaibhav Srivastav
10 years ago

Hi,

It’s good tutorial for me and very helpful for Spring beginners.

Thanks

JK
10 years ago

Hi Mkyong, Am using mybatis and all the queries are written in service class. Also I have to use custom tables with custom JSP. Please advice how to do it ?

Fabrice
11 years ago

Thank you MKYong, This helped me a lot. But the “targetUrl” in always null when I try to log in for update. After login for update I am not redirected to the targetUrl .

anonymous
11 years ago

If you are downloading the project zip please update your pom.xml scope to provided
it is provider in xml file which causes classpath error

Andri Handoko
11 years ago

Hi Mkyong, I have problem when implementing this to my project. That I currently have no datasource on my securityConfig.java (I use userDetailService as my dataSource on authentication system) and JdbcTokenRepositoryImpl didn’t have SetDataSource properties. Can you help me?
as I use annotation type and Neo4j as my database

Thanks 🙂

manas pratim chamuah
10 years ago
Reply to  Andri Handoko

Hi Andri, I m facing the same problem here.Did you resolve it yet ?

balu
11 years ago

Hi., MKyong, could you please post this example by using Simple Hash-Based Token approach.
Thanks,
balu…

Sid
11 years ago

Hi Mkyong, Can you please post this example in succession to your hibernate tutorial here

https://mkyong.com/spring-security/spring-security-hibernate-xml-example/

Jaafar
11 years ago

Hello Mr Mkyong

Gret job you are doing here, you help a lot of us. Thank you so much !

I encounter a litte problem, the part “8.4” doesn’t seem to work with me, when I restard the application and remove the browser’s session and I try to access the login page again, it gives me the login not like you said It will remember me and direct me to the admin page.

What’s wrong ? please help me.

Savvy
11 years ago

What if the token is not expired & password is changed from Users table? How to validate this scenario?

Wangdingqiao
11 years ago

Hi MKyong . I test your code,It works fine with IE 11,while not well with firefox 31.0.
With firefox ,the cookies and password is stored ,but every time I request admin url,it shows login by username / password,it seemed isRememberMe() not working with firefox . Does we have to make some adapt for different browsers ? can you please check it and help .

Rafael
11 years ago

Is there a way I can delete only a specific series? When the user logs in from different devices then decides to log out from one of them, Spring automatically removes all of his tokens from the DB.

Alvaro
12 years ago

Hi Mkyong, great job. In which part of the code do you store a row in the persistent_logins table? and is there any code for “forgot password?” function with spring security?? thanks!

mkyong
11 years ago
Reply to  Alvaro

Normally, you don’t need to handle the “persistent_login” manually, review step #9, spring’s classes. In remember-me tag, if data-source-ref is specified, “Persistent Token Approach” will be used.

See Spring’s PersistentTokenBasedRememberMeServices.

In Spring Security, there’s no ready solution for “Forgot password”. But it’s easy to implement, the standard practice should be send a validation link to user email, and redirect user to a page to key in new password again.

zengr
12 years ago

This doesn’t work on spring 3.1.3, any pointers for that?

mkyong
11 years ago
Reply to  zengr

What is not working?

This example is tested with Spring 3.2.8.RELEASE and Spring Security 3.2.3.RELEASE

ramesh
9 years ago
Reply to  mkyong

HI,
using this code i am able to create cookies but when log out it remove cookies automatically…..