使用Spring Boot进行会话管理? [英] Session management with Spring Boot?

查看:308
本文介绍了使用Spring Boot进行会话管理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Spring Boot设置会话管理和身份验证.具体来说,当用户登录到我的Web应用程序时,他们应该能够调用我的REST API来获取数据.此外,在一段时间后,应该将它们自动注销到系统之外,此时任何REST调用也都将失败.如何使用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 ?

推荐答案

您可以使用 Spring Session 与spring boot搭配使用

You can make use of Spring Session works well with spring boot

文档: http://docs.spring.io/spring -session/docs/current/reference/html5/

Spring Session提供用于管理用户会话信息的API和实现.它还提供与以下内容的透明集成:

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

HttpSession -允许以应用程序容器(即Tomcat)中立的方式替换HttpSession.其他功能包括:

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

集群会话-Spring Session使支持集群会话变得很简单,而无需绑定到特定于应用程序容器的解决方案.

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

多个浏览器会话-Spring Session支持在单个浏览器实例(即与Google类似的多个经过身份验证的帐户)中管理多个用户的会话.

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允许在标头中提供会话ID以与RESTful APIs一起使用

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

这篇关于使用Spring Boot进行会话管理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆