spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

Add getCreationTime() to SessionInformation for enhanced session lifecycle support

Open sweidner-rio opened this issue 6 months ago • 2 comments

Summary

I'd like to propose adding a getCreationTime() method to the org.springframework.security.core.session.SessionInformation interface to enhance session lifecycle visibility and control. See also the discussion with @jgrandja in auth_time claim doesn't show the time of the original authentication. #2035

Motivation Currently, SessionInformation provides metadata such as the session ID, principal, last request time, and expiration status, but it lacks the creation timestamp of the session.

Adding getCreationTime() would provide key benefits for a variety of real-world use cases:

Use Cases

  1. Auditing & Compliance
  • Enable "Who logged in when?" tracking.
  • Useful for audit trails in regulated environments.
  1. Custom Session Expiration Rules based on creation time

  2. Session Monitoring & Admin Tools

  • Example session display: "User X has been logged in since 08:12, last activity at 08:55."
  1. OpenID Connect Support

sweidner-rio avatar Jun 25 '25 15:06 sweidner-rio

I read the discussion and that's a really good feature. If no one objects, I could implement it

therepanic avatar Jun 25 '25 16:06 therepanic

@sweidner-rio Thanks for logging the details. Instead of getCreationTime() let's introduce getCreatedTime().

@therepanic Thanks for the offer. I assigned the issue to you.

jgrandja avatar Jun 27 '25 10:06 jgrandja