From e9173f6e7fed4934367ca8cb8a9ffc2247c758b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Wed, 26 May 2021 17:59:00 +0200 Subject: [PATCH] Update Mvc.Client to ensure authentication cookies expire before access tokens --- samples/Mvc.Client/Startup.cs | 4 +++- samples/Mvc.Client/Views/Shared/_Layout.cshtml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/Mvc.Client/Startup.cs b/samples/Mvc.Client/Startup.cs index d04a05cf..8efe9d2d 100644 --- a/samples/Mvc.Client/Startup.cs +++ b/samples/Mvc.Client/Startup.cs @@ -1,9 +1,9 @@ +using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Protocols.OpenIdConnect; @@ -21,6 +21,8 @@ namespace Mvc.Client .AddCookie(options => { options.LoginPath = "/login"; + options.ExpireTimeSpan = TimeSpan.FromMinutes(50); + options.SlidingExpiration = false; }) .AddOpenIdConnect(options => diff --git a/samples/Mvc.Client/Views/Shared/_Layout.cshtml b/samples/Mvc.Client/Views/Shared/_Layout.cshtml index 539be1a6..3c29994c 100644 --- a/samples/Mvc.Client/Views/Shared/_Layout.cshtml +++ b/samples/Mvc.Client/Views/Shared/_Layout.cshtml @@ -7,7 +7,7 @@ - Mvc.Client (OSOS sample) + Mvc.Client