Open Closed

Session management for Blazor Server application #8455


User avatar
0
Sergei.Gorlovetsky created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v7.3.3
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): Blazor/HttpApi.Host/AuthServer /. Auth Server separated

I am trying to implement session management settings for my Blazor application. The goal is to introduce a field to control the automatic logout time(saying LogoutTimeOutInMinutes). So far I have been able to add the setting to the Settings UI and store it in the AbpSettings table. Right now I am having two obstacles and I think I need some guidance or suggestion to determine whether it is achievable.

1. The application should redirect to login page once the cookie is expired without a page fresh(F5) I was following https://abp.io/support/questions/5740/In-our-Blazor-server-application-about-the-termination-of-the-user%27s-session-if-he-does-not-perform-any-operations-for-a-certain-period-of-time. to introduce the AddCookie and ConfigureApplicationCookie to my Blazor module and AuthServer module. This step helps me to log out of the current session with a page refresh. However I am still able to access to the current session If I am not doing the page fresh. I believe this has something to do with the SignalR connection? Any suggestion on accomplish this goal? 2. Dyamacially load the settings So I believe the ExpireTimeSpan configure under CookieAuthenticationOptions controls the cookie expiration time. Is there a way I can load this configuration dynamically, such that once the setting is saved in the Settings UI, it would automatically apply to the application without a server restart?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We have introduced the session management feature in >=8.2.0

    https://abp.io/docs/latest/modules/identity/session-management https://abp.io/docs/latest/modules/account/session-management

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09