Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session management with Spring Boot?

I want to set up session management and authentication with Spring Boot. Specifically, when the user logs into my web application, they should be able to call my REST API to get data. Furthermore, after a certain period of time, they should be automatically logged out of the system at which point any REST calls should also fail. How can I accomplish this with Spring Boot ?

like image 1000
Jenna Maiz Avatar asked Feb 04 '17 17:02

Jenna Maiz


People also ask

What is session management in spring boot?

Spring Session has the simple goal of free up session management from the limitations of the HTTP session stored in the server. The solution makes it easy to share session data between services in the cloud without being tied to a single container (i.e. Tomcat).


1 Answers

Spring Session takes care of distributed session management.

Spring Session provides an API and implementations for managing a user’s session information. It also provides transparent integration with:

HttpSession - allows replacing the HttpSession in an application container (i.e. Tomcat) neutral way. Additional features include:

Clustered Sessions - Spring Session makes it trivial to support clustered sessions without being tied to an application container specific solution.

Multiple Browser Sessions - Spring Session supports managing multiple users' sessions in a single browser instance (i.e. multiple authenticated accounts similar to Google).

RESTful APIs - Spring Session allows providing session ids in headers to work with RESTful APIs

like image 174
Barath Avatar answered Oct 12 '22 18:10

Barath