Re-challenge authenticated users in ASP.NET Core

前端 未结 2 1727
不思量自难忘°
不思量自难忘° 2021-02-15 21:55

I\'m running into some issues with the authentication pipeline in ASP.NET Core. My scenario is that I want to issue a challenge to a user who is already authenticated using Open

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-15 22:47

    Try to sign out:
    
    public void RefreshSession()
    {
          HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
          HttpContext.Authentication.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
          HttpContext.Authentication.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties { RedirectUri = "/" });
    }
    

提交回复
热议问题