Skip to content

Session overwriting #131

Closed
Closed

Description

@patchandthat

When the same user with an active session signs in again, a new session id is created.

There needs to be some investigation here around the implications and relevant bits of code. Clients from the first sign-in don't get the backchannel logout, although they are still signed in and the OP should track them. See https://openid.net/specs/openid-connect-backchannel-1_0.html#Tracking
With server side sessions, the refresh tokens are also lost.

Activity

  1. added theissue type on Oct 27, 2026
  2. oleks9o6 commented on Oct 27, 2026

    @oleks9o6
    Contributor

    In case it helps the investigation: we've worked around this on our side by doing what Duende does.

    When CreateSessionIdAsync gets properties without a session id, and there is a current session for the same subject, keep the current session id and copy the current client list into the new properties. A different subject, or no current session, gets a new session id. A session id the caller set explicitly is left as it is.

    What that gives:

    We did it as a subclass of DefaultUserSession overriding CreateSessionIdAsync. The cases we test: same subject keeps the sid and the client list; different subject gets a new sid and an empty list; an explicitly set sid is honored; no current session gets a new sid; and end to end, the first client's refresh token survives the second sign-in and the logout reaches both clients.

    The same-user-new-session scenario in the repro repo I shared shows the current behavior, with and without server-side sessions.

    Happy to help with tests or a review if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

Fields

Priority

High

Effort

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions