Save credentials of the users and automatic Login


I am making this web app that needs automatic login. Its like if i login my web app then it should store ,y credentials and if i close the tab and again open it, i dont have to login again and jump to the requested page with rights that my userId have.
Can anybody help me with this. I will really appreciate it.

Thanks in advance

Hi Dilpreet,

You can probably try to use cookies (if your users make use of private computers)
Please consider informing what you use the cookies for. Depending on the legal situation in your country, this can be mandatory.

Also, if you use cookies, make sure to at least obfuscate credentials if possible. You can use a two-way password encoder like the TextEncryptor present in Spring.

Another possibility would be to use Spring-Security with a remember-me option configured. It all depends a bit on the criticality of the security aspects you’re facing in the context of your application. Is not the same if users are accessing health data than just playing around in an intranet impact-less application.

In any of those cases, I would recommend reading a bit about Spring-Security, Apache-Shiro or any other Security-oriented framework. This will provide you with general aspects about security.

Hope it helps