Open Closed

Multiple domains for microservice auth-server #5786


User avatar
0
rogercprops created

Provide us with the following info:

  • ABP Framework version: v7.2.2 Commercial
  • UI Type: MVC / Vuejs
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: N/A
  • Steps to reproduce the issue: N/A

We're currently using the micro services template with the auth-server as an MVC application.

We're a SaaS provider with dozens of client tenants. Each has either their own domain or a subdomain under our brand domain. For example: auth.mydomain1.com auth.mydomain2.com etc.

What we want to do is have one auth-server application that is mapped to multiple domains and/or subdomains. However in the auth-server application configuration (appsettings) there is only one SelfUrl.

In our vue application we're using the oidc-client.ts NPM module to access the auth-server openiddict. In the oidc-client User Manager settings I can set the redirect url to ${window.location.origin}/signin-oidc, so it's correctly routed back to the Vue application after authentication. I can also specify the authority url to include the client domain auth.${window.location.origin}. In the above examples, if I specify auth.mydomain1.com as the authority, it won't find it since there's only 1 SelfUrl in the appsettings of the auth-server.

How do I have multiple "SelfUrls" based on tenant domain/subdomain in the auth server so I can call it from the Vue application (or any other application for that matter)?

I know one way is to have a different auth server application running for each domain instance but that gets expensive since we have over 80 clients today.

Looking forward to your response. Thank you.


2 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi

    You can resolve the aut.domain1.com in AUTH server project please see similar implementation and documentation https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-subdomain-tenant-resolver https://github.com/abpframework/abp-samples/tree/master/DomainTenantResolver

  • User Avatar
    0
    rogercprops created

    Thanks. That answered the question.

    We modified the tenant resolver to read from a database table to get the tenant based on the full URL. Happy to share it with others.

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