Base solution for your next web application

Activities of "MBTLGPLC19"

Sorry, working, Thanks!

Hi,

How can I find the sample IdentityServerClient indicated in the documentation:
https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Infrastructure-Core-Mvc-Identity-Server4-Integration#testing-with-mvc-client

Thanks

That's exactly what I wanted! I didn't knew that we could use the PostConfigure like that. Thank you very much

Hi,

While looking around some more (in the forum and ABP source code), I see that I should add my custom authorization filter (https://support.aspnetzero.com/QA/Questions/3126). I made some tests and it seems to work. I will continue to look at it. My question now is how do I remove or replace AbpAuthorizationFilter so that we have only MyAbpAuthorizationFilter registered?

My project is ASP.NET CORE 2.2 MVC & jQuery with Asp.NET Zero 7.0 and ABP 4.7

My Middleware:

using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Abp.AspNetCore.Mvc.Authorization; using Abp.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Filters;

public class MyMvcAuthorizeMiddleware { private readonly RequestDelegate _next; private readonly IAuthorizationHelper _authorizationHelper;

 public MyMvcAuthorizeMiddleware(RequestDelegate next, IAuthorizationHelper authorizationHelper)
 {
     _next = next;
     _authorizationHelper = authorizationHelper;
 }

 public async Task Invoke(HttpContext context)
 {
     try
     {
         bool isAuthenticated = context.User?.Identity?.IsAuthenticated ?? false;

         await _next.Invoke(context);
        //  I never see status code 401 or 402 so that I can take any action
        // So, what I can do here?
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }

}

public static class MyMvcAuthorizeMiddlewareExtensions { public static IApplicationBuilder UseMyMvcAuthorize(this IApplicationBuilder builder) { return builder.UseMiddleware<MyMvcAuthorizeMiddleware>(); } }


And my MyMvcAuthorizeFilter (that I tried to create following https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1256#issuecomment-237463318):

using Abp.Web.Mvc.Authorization; using System; using System.Collections.Generic; using System.Reflection; using System.Text; using Abp.Authorization; using Abp.Events.Bus; using Abp.Web.Models;

public class MyMvcAuthorizeFilter : AbpMvcAuthorizeFilter { public MyMvcAuthorizeFilter(IAuthorizationHelper authorizationHelper, IErrorInfoBuilder errorInfoBuilder, IEventBus eventBus) : base(authorizationHelper, errorInfoBuilder, eventBus) { }

protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext, MethodInfo methodInfo,
    AbpAuthorizationException ex)
{
    //base.HandleUnauthorizedRequest(filterContext, methodInfo, ex);

    //filterContext.HttpContext.Response.StatusCode
    // Even after adding Microsoft.AspNet.Mvc 5.2.7 to the project, I cannot access filterContext.HttpContext.Response
}

}

Following the tip in https://support.aspnetzero.com/QA/Questions/4049#answer-447ec9e8-b664-4f5a-b75f-313a2a2236f3, I'm trying to do the same thing in an asp.net core 2.2 solution (redirect to a page if the user hasn't the permission, but is already logged). I have tried to implement my AbpMvcAuthorizeFilter class, but without sucess (I cannot resolve the AuthorizationContext sucessfully, even after adding all asp.net mvc dependences). I tried to create the middleware for changing the behavior, but I cannot see the status code forbidden or unauthorized after executing the call to be able to redirect as I want. Another thing: there's someway to avoid to hit the middleware's method everytime ? Like, if we already validated that the user has permission, we can leave the middleware.

Hello, I'm creating an asp.net core application where we will be injecting different plugins. In https://support.aspnetzero.com/QA/Questions/2513 I saw that ABP is able to load the plugin dependencies if they are in the same folder.

In our case, each plugin can (and will) have its own dependencies at some time. They are going to be developped, kept and released in different timelines (so we cannot update and release all of them at once). So we will have the following scenarios:

a) 2 Plugins being used at the same time that depends of different versions of the same dll APPLICATION PLUGIN_A |-- DLL_A V_1.0.0 PLUGIN_B |-- DLL_A V_3.0.0

a.2) The plugin_a was updated, so now the 2 of them run with the same dll version APPLICATION PLUGIN_A |-- DLL_A V_3.0.0 PLUGIN_B |-- DLL_A V_3.0.0

b) Plugin with a different dll version than the one we are using in the application APPLICATION |-- DLL_B V.2.0.0 PLUGIN_A |-- DLL_B V.1.0.0

b.1) Plugin was updated so it now uses the same dll version in the application APPLICATION |-- DLL_B V.2.0.0 PLUGIN_A |-- DLL_B V.2.0.0

So, how I can accomplish this? By creating plugin subfolders and adding the plugin and its dependencies there (even if it's lower than the one we have in the bin ?) and ABP will do the job for us? Or by embedding the plugin's dependencies in its dll and loading it? (If so, can you provide a sample or some code where we do this using ABP ?)

Showing 1 to 7 of 7 entries