我正在运行.NET Core v3.1和Blazor,并已使用仅限于我们在Google G Suite中的域的Google实现了授权,如下所述:https://www.jerriepelser.com/blog/forcing-users-sign-in-gsuite-domain-account/
登录/注销工作正常,但是当登录的用户在Google G Suite中被阻止或删除时,该用户将保持登录状态,直到他从该应用程序注销为止。当他不注销时,他可以继续使用该应用程序。
我正在寻找每小时的更新。
这是我的login.cshtml.cs:
public async Task<IactionResult> OngetcallbackAsync(string returnUrl = null,string remoteError = null)
{
// Get the information about the user from the external login provider
var GoogleUser = User.Identities.FirstOrDefault();
if (GoogleUser.IsAuthenticated)
{
var authProperties = new AuthenticationProperties
{
IsPersistent = true,Redirecturi = Request.Host.Value,IssuedUtc = System.DateTime.UtcNow,ExpiresUtc = System.DateTime.UtcNow.AddHours(1)
};
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,new ClaimsPrincipal(GoogleUser),authProperties);
}
return LocalRedirect("/");
}
我已经添加了IssuedUtc
和ExpiresUtc
,但没有任何改变。