Aperto Chiuso

Change current principal based on current tenant #4048


User avatar
0
mhuxley creato
  • ABP Framework version: v6.0.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Steps to reproduce the issue:

Hi there,

I need to implement something similar to the example code that was posted on this git issue: https://github.com/abpframework/abp/issues/2611#issuecomment-786072008

  • I have a multi-tenant application. I have created a host user with a linked tenant user.
  • I am using the domain tenant resolver
  • I need to create middleware for the web host which will change the user based on the current tenant.

The middleware will need to:

  • get the current tenant id
  • use IdentityUserManager and IdentityLinkUserManager to retrieve the user with the above tenant id which is linked to the current user
  • use ICurrentPrincipalAccessor to change the current user

However, it doesn't seem possible to use IdentityUserManager and IdentityLinkUserManager from within the web host.

Can you tell me if this is possible to do, and how?

Let me know if I can provide any additional details.

Thanks, Matt


1 risposte
  • User Avatar
    0
    maliming creato
    Team di supporto Fullstack Developer

    hi

    However, it doesn't seem possible to use IdentityUserManager and IdentityLinkUserManager from within the web host.

    By design, you should use the application service interface in web.host. You can create application services for IdentityUserManager and IdentityLinkUserManager.

Made with ❤️ on ABP v8.2.0-preview Updated on marzo 25, 2024, 15:11