Skip to content

feat: implement storage of session in database - #52

Open
jhbritton-RSK wants to merge 14 commits into
server-side-sessionsfrom
feat/35-session-store
Open

feat: implement storage of session in database#52
jhbritton-RSK wants to merge 14 commits into
server-side-sessionsfrom
feat/35-session-store

Conversation

@jhbritton-RSK

Copy link
Copy Markdown
Collaborator

Description

Implemented initial storage of session in database following the existing db schema created for compatibility.

  • Addition of an implementation of ITicketStore to tie into asp.net session storage
  • Implementation of an EF core storage class for IIdentityServerServerSideSessionStore interface.
  • Extension method for configuring server side sessions

Type of change

  • Bug fix
  • Feature
  • Refactoring
  • Documentation
  • Other

Does this PR introduce a breaking change?

  • Yes
  • No

Testing

Describe how the change has been tested. New code should be covered by appropriate unit and/or integration tests.

LLM Usage

Used for guidance on setting up integration tests, and understanding more about how the sessions work in the existing IdentityServer4 codebase.

Other context

n/a

@jhbritton-RSK jhbritton-RSK changed the title Feat/35 session store feat: implement storage of session in database Jul 30, 2026
@jhbritton-RSK
jhbritton-RSK force-pushed the feat/35-session-store branch from 3248415 to 2426413 Compare July 30, 2026 12:26
<ProjectReference Include="..\..\src\Open.IdentityServer.csproj"/>
</ItemGroup>

<ItemGroup>

@patchandthat patchandthat Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is the MockLogger required in this assembly? Does TestLogger.Create<T> not suffice?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added this for a mock logger I could validate logs were made. TestLogger is used in may places so wanted avoid touching it. I also shared between two test projects, might be better to spin-up a shared tests project for things like that.

Comment thread src/Open.IdentityServer/src/Extensions/ClaimsExtensions.cs
Comment thread src/Open.IdentityServer/src/Extensions/ClaimsPrincipleExtension.cs

if (existingSession == null)
{
logger.LogInformation("failed renewing '{SessionKey}' session in database, session with key doesn't exists", key);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo: exists shouldn't be plural

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also this should be log warning not information

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment thread src/Open.IdentityServer/src/Stores/Default/ServerSessionTicketStore.cs Outdated
Comment thread src/Open.IdentityServer/src/Stores/Default/ServerSessionTicketStore.cs Outdated
///
/// </summary>
/// <param name="seedData"></param>
public InMemorySessionStore(IDictionary<string, IdentityServerServerSideSessions> seedData): this()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seeding data for sessions? Is this for unit testing?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was following original pattern of other stores. But doesn't really make sense for server side sessions other than for testing.

@jhbritton-RSK
jhbritton-RSK force-pushed the feat/35-session-store branch from 35dcc6b to e3344e5 Compare August 13, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants