From b6c194ecdd24a15402d70465bd2f1cd0610862fb Mon Sep 17 00:00:00 2001 From: huseyinalan <74354599+huseyinalan@users.noreply.github.com> Date: Wed, 5 Jul 2023 21:03:05 +0300 Subject: [PATCH] Refactored the access_denied in AddAbpOpenIdConnect. --- .../DependencyInjection/AbpOpenIdConnectExtensions.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs index 984b3cf3a4..7d2c1fe6d6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OpenIdConnect/Microsoft/Extensions/DependencyInjection/AbpOpenIdConnectExtensions.cs @@ -37,16 +37,7 @@ public static class AbpOpenIdConnectExtensions return authorizationCodeReceived.Invoke(receivedContext); }; - options.Events.OnRemoteFailure = remoteFailureContext => - { - if (remoteFailureContext.Failure is OpenIdConnectProtocolException && - remoteFailureContext.Failure.Message.Contains("access_denied")) - { - remoteFailureContext.HandleResponse(); - remoteFailureContext.Response.Redirect($"{remoteFailureContext.Request.PathBase}/"); - } - return Task.CompletedTask; - }; + options.AccessDeniedPath = "/"; options.Events.OnTokenValidated = async (context) => {