Search code examples
identityserver4session-managementduende-identity-server

duende identity server 6.2 session managment


I had indetity server4 and I had to add session management. I upgrated the application version to duende identityserver 6.2. And created a database based on PersistedGrantDbContext and ConfigurationDbContext. enter image description here

my database asp .NET core identity Users enter image description here

my configurations enter image description here

Now I get a token using connect/token and the token is valid. But now sessions are not saved to the ServerSideSessions and Devices table in the DeviceCodes table.

How do me added saving sissions and devices in my database? To add management using interface ISessionManagementService? Thanks in advance for the answers!


Solution

  • I advise you to implement your session management logic. Step 1 Create a UserSessions table, then when the user gets an accessToken save the session to that table. Step 2 When you need to delete a session, you give the records from the PersistedGrants table and delete the corresponding sessions. But there is one drawback to this implementation: A user's session will only die when their accessToken expires.