.NET Core 1.0.0 RC2 中 OpenIdConnectOptions 中的通知在哪里?

Bla*_*ise 3 asp.net-core-mvc asp.net-core

看起来 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,
    };
});
Run Code Online (Sandbox Code Playgroud)

但是 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,

});
Run Code Online (Sandbox Code Playgroud)

没有Notifications。有谁知道新设置是什么?


更新

根据 Pinpoint 的回答,这是我更新的代码:

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
    ClientId = clientId,
    Authority = authority,
    PostLogoutRedirectUri = postLogoutRedirectUrl,
    Events = new OpenIdConnectEvents
    {
        OnAuthenticationFailed = OnAuthenticationFailed
    }
});
Run Code Online (Sandbox Code Playgroud)

OnAuthenticationFailed方法是:

private static Task OnAuthenticationFailed(AuthenticationFailedContext context)
{
    context.HandleResponse();
    context.Response.Redirect($"/Home/Error?message={context.Exception.Message}");
    return Task.FromResult(0);

}
Run Code Online (Sandbox Code Playgroud)

Kév*_*let 8

没有通知。有谁知道新设置是什么?

Notifications属性已重命名为EventsOpenIdConnectAuthenticationNotifications现在更名为OpenIdConnectEvents