I have the following code for my Startup.cs
public void ConfigureAuth(IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
{
ValidAudience = ConfigurationManager.AppSettings["value1"]
},
Tenant = ConfigurationManager.AppSettings["value2"]
});
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
CookieManager = new SystemWebCookieManager()
});
app.UseKentorOwinCookieSaver(); //Workaround for infinite loop between webapp & login page
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = Authority,
PostLogoutRedirectUri = redirectUri,
RedirectUri = redirectUri,
Notifications = new OpenIdConnectAuthenticationNotifications()
{
//
// If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
//
AuthorizationCodeReceived = OnAuthorizationCodeReceived,
AuthenticationFailed = OnAuthenticationFailed
}
});
}
private Task OnAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context)
{
context.HandleResponse();
context.Response.Redirect("/Home/Error?message=" + context.Exception.Message);
return Task.FromResult(0);
}
However, when I do this
AuthenticationFailed = OnAuthenticationFailed
I am getting the following error: Error CS0123 No overload for 'OnAuthenticationFailed' matches delegate 'Func< AuthenticationFailedNotification< OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>, Task>'
I don't see why this is happening since the types match here. It all started happening since I updated to Owin 4.0.1 as well as all the Microsoft.IdentityModel and System.IdentityModel to 5.4.0.
I know there were some breaking changes in the version 5.X but I think there are all resolved on version 5.4.0 and this is the only issue I have left.