Skip to content

Add createdTime field to SessionInformation #17513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

therepanic
Copy link
Contributor

Closes: gh-17359

Comment on lines +136 to +138
Date currentDate = new Date();
this.sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date(currentDate.getTime()),
new Date(currentDate.getTime())));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's okay, since we wouldn't want to have a link to the same Date?

Comment on lines +55 to 64
public SessionInformation(Object principal, String sessionId, Date lastRequest, Date createdTime) {
Assert.notNull(principal, "Principal required");
Assert.hasText(sessionId, "SessionId required");
Assert.notNull(lastRequest, "LastRequest required");
Assert.notNull(lastRequest, "CreatedTime required");
this.principal = principal;
this.sessionId = sessionId;
this.lastRequest = lastRequest;
this.createdTime = createdTime;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that SessionInformation is created in SessionRegistry, so we don't need to maintain backward compatibility, right?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 13, 2025
@therepanic therepanic force-pushed the gh-17359 branch 3 times, most recently from 528743d to 7141e7a Compare July 13, 2025 17:56
Closes: spring-projectsgh-17359
Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
Comment on lines 48 to 55
public OidcSessionInformation(String sessionId, Map<String, String> authorities, OidcUser user) {
super(user, sessionId, new Date());
this(sessionId, authorities, user, new Date());
}

private OidcSessionInformation(String sessionId, Map<String, String> authorities, OidcUser user, Date now) {
super(user, sessionId, new Date(now.getTime()), new Date(now.getTime()));
this.authorities = (authorities != null) ? new LinkedHashMap<>(authorities) : Collections.emptyMap();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only way to solve the problem I wrote about here #17513 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add getCreationTime() to SessionInformation for enhanced session lifecycle support
2 participants