gpt4 book ai didi

asp.net-core - .NET Core 1.0.0 RC2 中 OpenIdConnectOptions 中的通知在哪里?

转载 作者:行者123 更新时间:2023-12-01 01:57:38 25 4
gpt4 key购买 nike

看起来 RC2 中有重大变化。
我试图使用这部分旧代码来设置 OpenId 连接:

app.UseOpenIdConnectAuthentication(options =>
{
options.ClientId = Configuration.Get("AzureAd:ClientId");
options.Authority = String.Format(Configuration.Get("AzureAd:AadInstance"), Configuration.Get("AzureAd:Tenant"));
options.PostLogoutRedirectUri = Configuration.Get("AzureAd:PostLogoutRedirectUri");
options.Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
};
});
但是 lambda 选项设置不可用。
如果我尝试使用新的 OpenIdConnectOptions .
var clientId = Configuration.GetSection("AzureAD:ClientId").Value;
var azureADInstance = Configuration.GetSection("AzureAD:AzureADInstance").Value;
var tenant = Configuration.GetSection("AzureAD:Tenant").Value;
var postLogoutRedirectUrl = Configuration.GetSection("AzureAD:PostLogoutRedirectUrl").Value;

var authority = $"{azureADInstance}{tenant}";
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUrl,

});
Notifications在那儿。有谁知道新设置是什么?

更新
根据 Pinpoint 的回答,这是我更新的代码:
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUrl,
Events = new OpenIdConnectEvents
{
OnAuthenticationFailed = OnAuthenticationFailed
}
});
OnAuthenticationFailed方法是:
private static Task OnAuthenticationFailed(AuthenticationFailedContext context)
{
context.HandleResponse();
context.Response.Redirect($"/Home/Error?message={context.Exception.Message}");
return Task.FromResult(0);

}

最佳答案

No Notifications is there. Anyone knows what is the new setup?


Notifications属性更名为 EventsOpenIdConnectAuthenticationNotifications现已命名 OpenIdConnectEvents .

关于asp.net-core - .NET Core 1.0.0 RC2 中 OpenIdConnectOptions 中的通知在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37555256/

25 4 0
文章推荐: Python Selenium Web 从图表中抓取数据
文章推荐: jQuery : Iterate through all