Skip to content

Make SessionRepositoryRequestWrapper::commitSession idempotent #1910

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ private final class SessionRepositoryRequestWrapper extends HttpServletRequestWr

private boolean requestedSessionInvalidated;

private boolean committed;

private SessionRepositoryRequestWrapper(HttpServletRequest request, HttpServletResponse response) {
super(request);
this.response = response;
Expand All @@ -214,6 +216,10 @@ private SessionRepositoryRequestWrapper(HttpServletRequest request, HttpServletR
* and persist the Session.
*/
private void commitSession() {
if (this.committed) {
return;
}
this.committed = true;
HttpSessionWrapper wrappedSession = getCurrentSession();
if (wrappedSession == null) {
if (isInvalidateClientSession()) {
Expand Down Expand Up @@ -246,7 +252,6 @@ private void setCurrentSession(HttpSessionWrapper currentSession) {
}

@Override
@SuppressWarnings("unused")
public String changeSessionId() {
HttpSession session = getSession(false);

Expand Down