【发布时间】:2020-05-14 16:38:10
【问题描述】:
我有一个要求,我想为 Web API 中的每个请求获取 Azure 登录的授权代码。到目前为止,一旦用户登录 Azure,之后我就没有获得授权码,因为用户已经登录。
如何强制用户重新登录?这是我目前在web API的owin_startup文件中使用的代码?
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
CookieSecure = (CookieSecureOption)Convert.ToInt32(cookieSecure), // CookieSecureOption.NeverAlways
CookieManager = new SystemWebCookieManager(),
CookieHttpOnly = false,
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = Authority,
RedirectUri = RedirectUri,
});
【问题讨论】:
-
嗨@DCZ。您能解释一下为什么需要这样做吗?为什么您不能使用作为身份验证结果颁发的访问令牌,只要它没有过期?
标签: c# azure asp.net-web-api azure-ad-b2c