Ends in:
7 DAYS
12 HRS
42 MIN
1 SEC
Ends in:
7 D
12 H
42 M
1 S

Activities of "DanielAndreasen"

In an announcement on github you have spoken about possible solutions to replacing IdentityServer4. One of solutions was to replace it with OpenIdDict which I see that you have covered as part of ABP 6. However you also spoke about describing the process of migrating existing solutions based on IDS4 to Keycloak but I dont see any guides/documents related to this on the commercial documentation website.

Where can I find documentation of how to migrate from IDS4 to Keycloak for the tiered and/or non-tiered template solution?

  • ABP Framework version: v5.3.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): No (Angular)
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

After updating our applications from ABP v.4.4.4 to v.5.3.0 and handling breaking changes as described in the ABP docs migration guides, we are experiencing an unexpected authorization behavior in our web application (Angular). When we are running the API/IdentityServer with the Angular application we are able to successfully authenticate after entering correct credentials at the login page, receive a JWT and redirect to the Angular application. However when attempting to use any controller endpoint the response code is always 401 with a 'Volo.Abp.Authorization.AbpAuthorizationException' even though the role of the authenticated user allows everything. It seems like the API is either not doing any JWT validation at all or is not properly keeping track of the user session.

Below is our configuration of authentication which also makes use of MongoDB for DataProtection API storage to support our load balanced setup in production. When inspecting the MongoDB collections we can see that keys and sessions are created as expected.

    private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
    {
        var mongoUrlBuilder = new MongoUrlBuilder(Environment.GetEnvironmentVariable("MONGODB_CONNECTION_STRING") +    Environment.GetEnvironmentVariable("MONGODB_CONNECTION_PARAMS"));
        var mongoClient = new MongoClient(mongoUrlBuilder.ToMongoUrl());

        context.Services.AddDataProtection().SetApplicationName(Environment.GetEnvironmentVariable("DATA_PROTECTION_APPLICATION_NAME")).PersistKeysToMongoDb(() => mongoClient.GetDatabase(Environment.GetEnvironmentVariable("MONGODB_DATA_PROTECTION_DATABASE_NAME")));

        context.Services.ConfigureApplicationCookie(options =>
        {
            options.SessionStore = new MongoDbTicketStore(new MongoDbTicketStoreOptions()
            {
                Database = mongoClient.GetDatabase(Environment.GetEnvironmentVariable("MONGODB_DATA_PROTECTION_DATABASE_NAME")),
                CollectionName = Environment.GetEnvironmentVariable("MONGODB_AUTH_SESSION_STORE_COLLECTION_NAME")
            });
        });


        Configure<IdentityServerOptions>(options => { options.IssuerUri = configuration["App:SelfUrl"]; });            

        context.Services.AddAuthentication()
            // IdentityServer
            .AddJwtBearer(options =>
            {
                    options.Authority = configuration["AuthServer:Authority"];
                    options.RequireHttpsMetadata = false;
                    options.ClaimsIssuer = "Stella";
                    options.BackchannelHttpHandler = new HttpClientHandler
                {
                    ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
                };
            });
}

When inspecting the network logs in a browser after authenticating the user and being redirected to the Angular app we also noticed that the "currentUser" segment of the response from api/abp/application-configuration show null values.

After updating our project from 3.3.2 to 4.2.2 we are experincing a few issues that are not described in the guides for either angular or backend but they seem to be related to abp packages.

Manage profile page

Attempting to open "Manage profile page" produces the following error:


AbpException: Could not find the bundle file '/libs/cropperjs/css/cropper.min.css' from IWebContentFileProvider

    Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpTagHelperResourceService.ProcessAsync(ViewContext viewContext, TagHelperContext context, TagHelperOutput output, List<BundleTagHelperItem> bundleItems, string bundleName)
    Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers.AbpBundleTagHelperService<TTagHelper, TService>.ProcessAsync(TagHelperContext context, TagHelperOutput output)
    Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, int i, int count)
    AspNetCore.Pages_Account_Manage.<ExecuteAsync>b__16_0()
    Microsoft.AspNetCore.Mvc.Razor.RazorPage.RenderSectionAsyncCore(string sectionName, bool required)
    AspNetCore.Themes_Lepton_Layouts_Application_Default+<>c__DisplayClass28_0+<<ExecuteAsync>b__0>d.MoveNext()
    Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
    AspNetCore.Themes_Lepton_Layouts_Application_Default.ExecuteAsync()
    Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
    Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts)
    Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
    Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
    Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
    Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|27_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State![billede.png](/QA/files/647d54dd2083db5a95c039fb5bcdac4a.png)![billede.png](/QA/files/da174179224464b5b94539fb5bcdac9f.png)![billede.png](/QA/files/7944400d0d9a9e59d5f539fb5bcdb971.png)![billede.png](/QA/files/5b0d88057ade94741f7639fb5bcdb8de.png)![billede.png](/QA/files/854934fc7f9614226f5939fb5bcdbc14.png)![billede.png](/QA/files/8cbedd9763797c7cba4539fb5bcdbc3a.png) next, Scope scope, object state, bool isCompleted)
    Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
    Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
    Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
    Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
    Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
    Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
    Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
    Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
    Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
    IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
    IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
    Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
    Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
    Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
    Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension+<>c__DisplayClass0_0+<<UseJwtTokenMiddleware>b__0>d.MoveNext()
    Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
    Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
    Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
    Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


This issue seems to be similar to the one described in this thread however following the steps the solution that "hikalkan" suggested doesn't fix my issue unfortunately.

Other pages

Opening any pages from the side menu other than dashboard and the pages related to administration produces an error from the lepton theme package and opens a blank page

Endpoints used in any of these pages is working as intended so I don't think its related to the backend.

No redirect on user logout

Attempting to logout as any user doesn't redirect to login page and produces a js error:

The error originates from this line in LoggedOut When looking through the html I am unable to find any button with this ID and its clearly not visible on the page. The button is however present on our production environemt currently running Abp v3.3.3. What could have resulted in this button being removed?

  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): No (non-tiered)

Im attempting to override existing email templates based on the instructions described in the text templating document and the emailing document.

I was able to override the standard layout by following the instructions in this section (tried both options) but I don't feel like the documentation is very clear on how I should override specific templates such as the one used for sending two-factor codes.

Example of how I have changed the standard layout of emails

.tpl file

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
</head>
<body>
    <h1>This my header</h1>

    {{content}}

    <footer>
      This is my footer...
    </footer>
</body>
</html>

DefinitionProvider.cs

    public class TwoFactorSendCodeDefinitionProvider : TemplateDefinitionProvider, ITransientDependency
    {
        public override void Define(ITemplateDefinitionContext context)
        {
            var emailLayoutTemplate = context.GetOrNull(StandardEmailTemplates.Layout);

            emailLayoutTemplate.WithVirtualFilePath("/Emailing/Templates/TwoFactorSendCoreTemplate.tpl", true);
        }
    }

Result (Password reset)

Issues

I was not able to find the source code of the email template used for sending two-factor codes in any ABP module. I want to know how I can I find this template and how I should override its .tpl file like in the example above.

Im aware of the "Text template management" that is provided with the account module but only a few templates can be edited:

I would also like to know how I should translate the text used in templates. Since I can't find the .tpl files, im unable to view the localization keys I should use to enable translation of emails. "Text template management" shows localization keys for some .tpl files like "PasswordResetLink" but adding these keys to my json localization files in my "Shared" project doesn't affect the emails that are sent.

Project
  • ABP Framework version: v3.3.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no (not tiered)

I have successfully edited the login page by following the steps discussed in this thread.

Now I wish to translate the text used in the account module for the login page. How do I do this properly?

Example: I want to define translations for "AreYouANewUser" and "OrLoginWith" in a new language.

Also how should I translate values related to validation?

  • ABP Framework version: v3.3.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): no (non-tiered)

Im attempting to inject a repository generated with the ABP suite in a class which implements the IDistributedEventHandler interface. RabbitMQ is configured as the distributed event bus provider.

The documentation describes that "You can inject any service and perform any required logic here..." in context of subscribing to events with IDistributedEventHandler. However when I inject repositories or other classes which is registered to dependency injection with the ITransientDependency interface, the eventhandler is never instantiated. It seems like the eventhandler is only configured properly if it contains either a empty constructor or a constructor with IDistributedEventBus as parameter.

The following implementation should illustrate what I wish to accomplish:

using Stella.GGSensorData;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;

 public class GGSensorDataHandler : IDistributedEventHandler<GGSensorDataEntity>, ITransientDependency
    {
        private readonly IGGSensorDataRepository _gGsensorDataRepository;
        private readonly RawSensorDataParser _rawSensorDataParser;


        public GGSensorDataHandler(RawSensorDataParser rawSensorDataParser, IGGSensorDataRepository gGSensorDataRepository)
        {
            _rawSensorDataParser = rawSensorDataParser;
            _gGsensorDataRepository = gGSensorDataRepository;
        }

        public async Task HandleEventAsync(GGSensorDataEntity eventData)
        {
            await _rawSensorDataParser.ParseAndInsertRawSensorData(eventData);
            await InsertRawSensorDataStellaDb(eventData);
        }

        private async Task InsertRawSensorDataStellaDb(GGSensorDataEntity sensorData)
        {
            sensorData.Json = JsonSerializer.Serialize(sensorData);

            await _gGsensorDataRepository.InsertAsync(sensorData);
        }

How do I properly inject repositories/services in a class that implements IDistributedEventHandler like above?

I should note that the "GGSensorDataHandler" class is implemented in a project separate to our main ABP project and references the repositories via a project reference dependency:

The intention is simply to implement the project as a microservice.

Unit of work Using Unit of work as suggested here and similarly in the abp documentation does not solve this issue.

Project Details

  • ABP Framework version: v3.2.1
  • Project Type: .Net Core console app

I have been following the guide on how to customize the app modules with the intention of extending module entities with new properties and exposing these with a modified service/controller.

AppUser.cs I have extended IdentityUser from a module through AppUser.cs (which was already created in the startup template) with the following properties:

Added columns in AbpUsers (MySql table) I then mapped these new properties to the same database table as IdentityUser by updating DbContext.OnModelCreating and EfCoreEntityExtensionMappings and created a database-migration:

Exposing new properties with CRUD operations I now wish to expose these new properties with CRUD operations in the API but I don't think the guide on overriding services covers this subject.

I understand that I can override the virtual methods defined in application services, controllers and interfaces that originates from the module where the IdentityUser type exists, however I find that the return value of these methods will always be of this type (either IdentityUser or IdentityUserDTO). In other words, the returned object doesn't have the custom properties i defined.

For example: Overriding the GetAsync() method from the IdentityUserAppService will always map from a IdentityUser object because that is the type Usermanager.GetByIdAsync() returns. Custom properties defined in the new UserDto class will never get mapped to because they don't exist in IndentityUser. UserDto has the same custom properties as the AppUser class mentioned above.

Calling ".../api/identity/users/" will return the following: Summary To summarize, I wish to achieve the following:

  • Query Users from the database and receive an object like UserDto with the custom properties
  • Update values of custom properties in AppUser
  • Use the value of custom properties in AppUser with the properties originating from IdentityUser in business logic

How do I override methods from applications services and controllers in a way that enables me to meet the requirements I listed above?

  • ABP Framework version: v3.1.0
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): No
Showing 1 to 7 of 7 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06