Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Adding a user session timeout control to asp.net zero app. #4003


User avatar
0
codenewa created

I've a project based on Asp.NET Core + Angular 2 project.

I want to add the user session timeout control mentioned here: <a class="postlink" href="http://keenthemes.com/preview/metronic/theme/admin_4_material_design/ui_session_timeout.html">http://keenthemes.com/preview/metronic/ ... meout.html</a>

If I set the tokenAuthConfig i nthe Web.Core project's WebCoreModule.cs to set the expiration to a value which also drives the above plugin, how do i configure the stay alive url so that a new token can be generated?


1 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Something like this:

    [AbpMvcAuthorize]
            [HttpPost]
            public async Task<AuthenticateResultModel> StayAlive()
            {
                // Validation, if any.
                await Task.CompletedTask;
    
                var accessToken = CreateAccessToken(CreateJwtClaims(User.Identity));
                return new AuthenticateResultModel
                {
                    AccessToken = accessToken,
                    EncryptedAccessToken = GetEncrpyedAccessToken(accessToken),
                    ExpireInSeconds = (int)_configuration.Expiration.TotalSeconds
                };
            }