It looks like there is breaking change in RC2.
I was trying to set up the OpenId connect using this section of old code:
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,
    };
});
But the lambda options setup is not available.
If I try to use a new 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,
});
No Notifications is there. Anyone knows what is the new setup?
Based on the answer by Pinpoint, here is my updated code:
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
    ClientId = clientId,
    Authority = authority,
    PostLogoutRedirectUri = postLogoutRedirectUrl,
    Events = new OpenIdConnectEvents
    {
        OnAuthenticationFailed = OnAuthenticationFailed
    }
});
and the OnAuthenticationFailed method is:
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?
The Notifications property was renamed to Events and OpenIdConnectAuthenticationNotifications is now named OpenIdConnectEvents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With