Open Closed

Change current principal based on current tenant #4048


User avatar
0
mhuxley created
  • 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 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team 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 v9.1.0-preview. Updated on December 10, 2024, 06:38