使用spring security时如何获得登录时间 [英] How Can I get log in time while using spring security

查看:70
本文介绍了使用spring security时如何获得登录时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 spring security 3,想显示用户登录当前会话的时间.

I am using spring security 3 and would like to display the time when user logged in to current session.

Spring 安全性是否提供任何此类令牌?

Does Spring security provide any such token?

谢谢,- 阿克谢

推荐答案

最可靠的选择是自定义您的 Spring Security 过滤器链 用于在成功登录时在用户会话中保存时间戳.然后您可以像访问任何会话属性一样访问它.

The most reliable option would be customizing your Spring Security filter chain to save a timestamp in the user's session when a successful login occurs. Then you would access it in the same way you access any session attribute.

这篇关于使用spring security时如何获得登录时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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