使用PasswordSignInAsync登录时如何更改Cookie的过期时间?

问题描述 投票:0回答:1

使用下面的代码登录时,如何更新Cookie过期时间

var result = await _signInManager.PasswordSignInAsync(userName, password, isPersistent, lockoutOnFailure);

就像可以与SingInAsyn一起使用

 var authProps = new AuthenticationProperties
 {
      IsPersistent = isPersistent,
      ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(5)
 };
 await _signInManager.SignInAsync(user, authProps, authenticationMethod);
c# asp.net-core identityserver4 asp.net-core-identity asp.net-core-3.1
1个回答
0
投票

找不到通过authenticationProperties的方法,但是下面的代码有效。需要重写SingInManager类的SignInWithClaimsAsync方法

© www.soinside.com 2019 - 2024. All rights reserved.