private async Task <AuthenticationFailedContext> RunAuthenticationFailedEventAsync(OpenIdConnectMessage message, Exception exception)
        {
            var authenticationFailedContext = new AuthenticationFailedContext(Context, Options)
            {
                ProtocolMessage = message,
                Exception       = exception
            };

            await Options.Events.AuthenticationFailed(authenticationFailedContext);

            if (authenticationFailedContext.HandledResponse)
            {
                Logger.AuthenticationFailedContextHandledResponse();
            }
            else if (authenticationFailedContext.Skipped)
            {
                Logger.AuthenticationFailedContextSkipped();
            }

            return(authenticationFailedContext);
        }
Beispiel #2
0
 /// <summary>
 /// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
 /// </summary>
 public virtual Task AuthenticationFailed(AuthenticationFailedContext context) => OnAuthenticationFailed(context);
Beispiel #3
0
 private static Task LogAuthenticationFailed(ILogger logger, Microsoft.AspNetCore.Authentication.OpenIdConnect.AuthenticationFailedContext ctx)
 {
     logger.LogError(ctx.Exception, ctx.Exception.Message, null);
     return(Task.CompletedTask);
 }
 private Task OpenIdAuthenticationFailed(Microsoft.AspNetCore.Authentication.OpenIdConnect.AuthenticationFailedContext context)
 {
     _logger.LogDebug("AuthenticationFailed!");
     return(Task.FromResult(0));
 }
 /// <summary>
 /// Called by the OIDC middleware when authentication fails.
 /// </summary>
 /// <param name="context">An OIDC-middleware supplied <see cref="Microsoft.AspNetCore.Authentication.OpenIdConnect.AuthenticationFailedContext"/> containing information about the failed authentication.</param>
 /// <returns>A completed <see cref="System.Threading.Tasks.Task"/></returns>
 public override Task AuthenticationFailed(AuthenticationFailedContext context)
 {
     _logger.AuthenticationFailed(context.Exception);
     return Task.FromResult(0);
 }
 private Task OnAuthenticationFailed(AuthenticationFailedContext context)
 {
     context.HandleResponse();
     context.Response.Redirect("/Home/Error?message=" + context.Exception.Message);
     return Task.FromResult(0);
 }
Beispiel #7
0
 public virtual Task AuthenticationFailed(AuthenticationFailedContext context) => OnAuthenticationFailed(context);