private static Task AuthenticationFailed( AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context) { context.OwinContext.Response.Redirect("/Home/Error?message=" + context.Exception.Message); context.HandleResponse(); // Suppress the exception return Task.FromResult(0); }
private Task OnAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { notification.HandleResponse(); notification.Response.Redirect("/Home/Error?message=" + notification.Exception.Message); return Task.FromResult(0); }
/// <summary> /// Handle failed authentication requests by redirecting the user to the home page with an error in the query string /// </summary> /// <param name="context"></param> /// <returns></returns> private Task OnAuthenticationFailed(AuthenticationFailedNotification <OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context) { context.HandleResponse(); context.Response.Redirect("/?errormessage=" + context.Exception.Message); return(Task.FromResult(0)); }
private Task OnAuthenticationFailed(AuthenticationFailedNotification <OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { notification.HandleResponse(); notification.Response.Redirect("/Home/Error"); return(Task.FromResult(0)); }
// If the javascript issues an OIDC authorize request, and it fails (meaning the user needs to login) // this notification will be triggered with the error message 'login_required' public static Task AuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { string cookieStateValue = null; ICookieManager cookieManager = new ChunkingCookieManager(); string cookie = cookieManager.GetRequestCookie(notification.OwinContext, CookieName); AuthenticationTicket ticket = ticketDataFormat.Unprotect(cookie); if (ticket.Properties.Dictionary != null) ticket.Properties.Dictionary.TryGetValue(OpenIdConnectAuthenticationDefaults.AuthenticationType + "SingleSignOut", out cookieStateValue); // If the failed authentication was a result of a request by the SingleSignOut javascript if (cookieStateValue != null && cookieStateValue.Contains(notification.ProtocolMessage.State) && notification.Exception.Message == "login_required"); { // Clear the SingleSignOut cookie, and clear the OIDC session state so //that we don't see any further "Session Changed" messages from the iframe. ticket.Properties.Dictionary[OpenIdConnectSessionProperties.SessionState] = ""; ticket.Properties.Dictionary[OpenIdConnectAuthenticationDefaults.AuthenticationType + "SingleSignOut"] = ""; cookieManager.AppendResponseCookie(notification.OwinContext, CookieName, ticketDataFormat.Protect(ticket), new CookieOptions()); notification.Response.Redirect("Account/SingleSignOut"); notification.HandleResponse(); } return Task.FromResult<object>(null); }
private Task OnAuthenticationFailedAsync(AuthenticationFailedNotification <OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { notification.HandleResponse(); notification.Response.Redirect("/Error/ShowError?signIn=true&errorMessage=" + notification.Exception.Message); return(Task.FromResult(0)); }
private Task OnAuthenticationFailed(AuthenticationFailedNotification <OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> arg) { arg.HandleResponse(); arg.Response.Redirect("/?errormessage" + arg.Exception.Message); return(Task.FromResult(0)); }
private static async Task <int> OnAuthenticationFailed(AuthenticationFailedNotification <OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context) { context.HandleResponse(); context.Response.Redirect("/Home/Error?message=" + context.Exception.Message); return(await Task.FromResult(0)); }
private Task OnAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { notification.HandleResponse(); notification.Response.Redirect("/Error?message=" + notification.Exception.Message); return Task.FromResult(0); }