Base solution for your next web application

Activities of "aaron"

  • Why is a new 1 year token created every time the admin user logs in? Why are the old 1 year tokens not deleted automatically when the admin user logs in?

A user can log in from multiple devices and browsers. The token for a session is deleted when the user logs out properly via the API.

  • Is this the definition of the UserTokenExpirationWorker? It appears to only delete tokens that have expired. Am I missing something that explains how the 1 year tokens are supposed to be cleaned up?

Yes. Only expired tokens are cleaned up.

I just told you exactly how and even provided a code sample that you can copy and paste directly into your ASP .NET Zero solution.

172.16.1.1 is a private IP address. ​ You can configure it as a known proxy in app.UseForwardedHeaders(...) before app.UseAuthentication(). ​

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
    ...
​
    var forwardedHeadersOptions = new ForwardedHeadersOptions                                // Add this
    {                                                                                        // Add this
        ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto // Add this
    };                                                                                       // Add this
    forwardedHeadersOptions.KnownProxies.Add(IPAddress.Parse("::ffff:172.16.1.1"));          // Add this
    app.UseForwardedHeaders(forwardedHeadersOptions);                                        // Add this
​
    app.UseAuthentication();
    
    ...
}

​ Microsoft docs: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-3.1

Change .GetAll().ToList() to .GetAllList(), or begin your own unit of work.

Reference: aspnetboilerplate/aspnetboilerplate#3946 (comment 430319419)

Answer

I think your use case of matching exact query parameters is generally not appropriate, but you can achieve it as follows.

app-navigation.service.ts:

- new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}']),
+ new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}'], [], null, {}),
  new AppMenuItem('Event_Pools', 'Pages.Main.Event.Management.EventPool', 'flaticon2-next', '/app/main/event/management/event-pool/list', ['/app/main/event/management/event-pool/person/list/{event-pool-id}'], [], null, { eventType: 'Meeting' })

side-bar-menu.component.ts:

  isMenuItemIsActive(item): boolean {
      ...

-     let urlTree = this.router.parseUrl(this.currentRouteUrl.replace(/\/$/, ''));
+     let urlTree = this.router.parseUrl(this.router.url);
      let urlString = '/' + urlTree.root.children.primary.segments.map(segment => segment.path).join('/');
      let exactMatch = urlString === item.route.replace(/\/$/, '');
+     if (exactMatch & item.parameters) {
+         const itemParamsKeys = Object.keys(item.parameters);
+         exactMatch = itemParamsKeys.length === Object.keys(urlTree.queryParams).length && itemParamsKeys.every(key => item.parameters[key] === urlTree.queryParams[key]);
+     }
      ...
      return exactMatch;
  }

Try (abp as any):

- abp.libs.sweetAlert.config.error.button = abp.localization.localize('Ok', 'AbpZeroTemplate');
+ (abp as any).libs.sweetAlert.config.error.button = abp.localization.localize('Ok', 'AbpZeroTemplate');

I would recommend Option 1.2 below.

Option 1: Register custom ILanguageManagementConfig

Seems LanguageManagementConfig has been initialized together with Configuration.Modules before everything else.

Good conjecture. More accurately, ILanguageManagementConfig is instantiated on the first call to Configuration.Modules.Zero().

  • Configuration.Modules.Zero() is first called in YourProjectCoreModule.PreInitialize.
  • ReplaceService only runs in AbpKernalModule.Initialize, before other modules' Initialize.

Therefore, calling ReplaceService for this in YourProjectWebCoreModule.PreInitialize is too late.

Option 1.1: Directly register as default before ILanguageManagementConfig is instantiated

You can directly register CustomLanguageManagementConfig as the default implementation before that first call.

IocManager.IocContainer.Register(                        // Add this
    Component.For<ILanguageManagementConfig>()           // Add this
        .ImplementedBy<CustomLanguageManagementConfig>() // Add this
        .IsDefault()                                     // Add this
);                                                       // Add this

//Declare entity types                                            // Existing code
Configuration.Modules.Zero().EntityTypes.Tenant = typeof(Tenant); // Existing code
Option 1.2: Add service before ILanguageManagementConfig is registered

You can AddSingleton to IServiceCollection in your Web project's ConfigureServices.

services.AddSingleton<ILanguageManagementConfig, CustomLanguageManagementConfig>();

Option 2: Instantiate custom ILanguageManagementConfig without replacing

Is there any concern of calling customized EnableDbLocalization() in this way?

In general, it is not preferable since Configuration.Modules.Zero().LanguageManagement would have the unexpected implementation if used elsewhere — but it's not used elsewhere.

Therefore, in this case, there is no concern.

Hi Robin, it is injected and you could do that.

Duplicate of #8925

Showing 1 to 10 of 1543 entries