Open Closed

Subdomain Tenant URL change with Linked Accounts #7425


User avatar
0
dhill created
  • ABP Framework version: v8.2.0
  • UI Type: Blazor Server
  • Database System: EF Core
  • **Azure Web App with AzureSignalR We've successfully implemented subdomain tenant mapping. However, when using linked accounts the subdomain does not change when the tenant change happens. How can we get the subdomain url to reflect the change in tentant?

Here is our WebModule configuration. PreConfigure<OpenIddictBuilder>(builder => { _ = builder.AddValidation(options => { _ = options.AddAudiences("SafetyPlusWeb"); _ = options.UseLocalServer(); _ = options.UseAspNetCore(); }); });

    if (!hostingEnvironment.IsDevelopment())
    {
        PreConfigure&lt;AbpOpenIddictAspNetCoreOptions&gt;(options =>
        {
            options.AddDevelopmentEncryptionAndSigningCertificate = false;
        });

        PreConfigure&lt;OpenIddictServerBuilder&gt;(serverBuilder =>
        {
            // In production, it is recommended to use two RSA certificates, 
            // one for encryption, one for signing.
            _ = serverBuilder.AddEncryptionCertificate(
                    GetEncryptionCertificate(context.Services.GetConfiguration()));
            _ = serverBuilder.AddSigningCertificate(
                    GetSigningCertificate(context.Services.GetConfiguration()));
        });

        var domainFormat = GetDomainFormatForEnvironment(hostingEnvironment);
        PreConfigure&lt;AbpOpenIddictWildcardDomainOptions&gt;(options =>
        {
            options.EnableWildcardDomainSupport = true;
            _ = options.WildcardDomainsFormat.Add($"https://{domainFormat}");
            _ = options.WildcardDomainsFormat.Add($"https://{domainFormat}/signin-oidc");
            _ = options.WildcardDomainsFormat.Add($"https://{domainFormat}/signout-callback-oidc");
        });
    }
}

public override void ConfigureServices(ServiceConfigurationContext context)
{
    var hostingEnvironment = context.Services.GetHostingEnvironment();
    var configuration = context.Services.GetConfiguration();

    var domainFormat = GetDomainFormatForEnvironment(hostingEnvironment);

    Configure&lt;AbpTenantResolveOptions&gt;(options =>
    {
        options.AddDomainTenantResolver(domainFormat);
    });

    if (!configuration.GetValue&lt;bool&gt;("App:DisablePII"))
    {
        Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
    }

    if (!configuration.GetValue&lt;bool&gt;("AuthServer:RequireHttpsMetadata"))
    {
        Configure&lt;OpenIddictServerAspNetCoreOptions&gt;(options =>
        {
            options.DisableTransportSecurityRequirement = true;
        });
    }

    if (!hostingEnvironment.IsDevelopment())
    {
        _ = context.Services.AddSignalR(options =>
        {
            options.AddFilter&lt;AbpMultiTenantHubFilter&gt;();
        }).AddAzureSignalR();
    }

    ConfigureOptions(context, configuration);
    ConfigureAuthentication(context);
    ConfigureUrls(configuration);
    ConfigureBundles();
    ConfigureImpersonation(context, configuration);
    ConfigureAutoMapper();
    ConfigureVirtualFileSystem(hostingEnvironment);
    ConfigureMultiTenancy();
    ConfigureSwaggerServices(context.Services);
    ConfigureExternalProviders(context, configuration);
    ConfigureAutoApiControllers();
    ConfigureBlazorise(context);
    ConfigureRouter(context);
    ConfigureMenu(context);
    ConfigureCookieConsent(context);
    ConfigureAuditingOptions(context);
    ConfigureTheme();

    Configure&lt;SettingManagementComponentOptions&gt;(options =>
    {
        options.Contributors.Add(new SafetyPlusWebSettingsComponentContributor());
    });

    if (!hostingEnvironment.IsDevelopment())
    {
        Configure&lt;AbpTenantResolveOptions&gt;(options =>
        {
            options.AddDomainTenantResolver(domainFormat);
        });
    }
}

No answer yet!
Made with ❤️ on ABP v8.2.0-preview Updated on března 25, 2024, 15:11