Does Angular site support custom domains? (e.g. <a class="postlink" href="http://www.mysite.com">www.mysite.com</a>) Is there a way to set something like this up? It seems there are a few hurdles for this, such as CORS config on the Host site. Does anyone have this working?
Thanks, ~Leo
I'm having issues with redirects to public site after logging in when I have subdomains configured on Public site.
Public site config: App:WebSiteRootAddress = https://{TENANCY_NAME}.pub.mysite.com/ App:AdminWebSiteRootAddress = https://{TENANCY_NAME}.mvc.mysite.com/
MVC site config: App:WebSiteRootAddress = https://{TENANCY_NAME}.mvc.mysite.com/ App:RedirectAllowedExternalWebSites = https://{TENANCY_NAME}.pub.mysite.com/
When I navigate to Public home page and do a Login, it navigates to MVC site to render login UI, but does NOT return to the Public site after login. The URL does show a correct returnUrl in the query string (e.g. <a class="postlink" href="https://tenant.mvc.mysite.com/account/login?ss=true&returnUrl=https://tenant.pub.mysite.com/Account/Login">https://tenant.mvc.mysite.com/account/l ... ount/Login</a>)
Does Public site support {TENANCY_NAME} subdomains? I'm using version 5.6
Thanks.
The Timezone setting options are not showing up for me in the settings.
I see there is this code that may be preventing it from showing in App\Views\Settings\Index.cshtml
@if (!ViewBag.IsMultiTenancyEnabled || Clock.SupportsMultipleTimezone)
What is the reason for clock.SupportsMultipleTimezone? Is that another setting or detected automatically?
Thanks!
I'm seeing an issue where data for Tenant_A is shown for Tenant_B in the case where user is Anonymous. It appears that either incorrect TenantId is being read from TenantCache for Anonymous users, or some other issue is present - or maybe I'm incorrectly surfacing the TenantId in my Session object. Incorrect TenantId is present in AbpSession object in DbPerTenantConnnectionStringResolver - GetCurrentTenantId() method.
This behavior does not happen for users that are signed in.
A little about my setup... I set up tenant detection by hostname using SaasKit (<a class="postlink" href="https://github.com/saaskit/saaskit">https://github.com/saaskit/saaskit</a>), which works quite well.
SaasKit plugs into ConfigureServices in Startup.cs where it resolves the tenant using hostname via TenantManager - at the point I create the Tenant object (load it using TenantManager) and makes it available via IoC.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddMultitenancy<Tenant, TenantResolverService>();
//MVC
services.AddMvc(options =>
{
options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
});
...
options.IocManager.Register<IAbpSession, MtfSession>(DependencyLifeStyle.Transient);
TenantResolverService:
public class TenantResolverService : ITenantResolver<Tenant>
{
private readonly TenantManager _tenantManager;
public TenantResolverService(TenantManager tenantManager)
{
_tenantManager = tenantManager;
}
public Task<TenantContext<Tenant>> ResolveAsync(HttpContext context)
{
TenantContext<Tenant> tenantContext = null;
var hostname = context.Request.Host.Value;
var hostnameParts = hostname.Split('.');
var tenant = _tenantManager.FindByHostnameAsync(hostname).Result;
if (tenant == null && hostnameParts.Length > 0)
{
var subdomain = hostnameParts[0];
tenant = _tenantManager.FindByTenancyNameAsync(subdomain).Result;
}
if (tenant != null)
{
tenantContext = new TenantContext<Tenant>(tenant);
}
return Task.FromResult(tenantContext);
}
}
I extend the ClaimsAbpSession class (IAbpSession) to return TenantId from the Tenant object created above.
public class MtfSession : ClaimsAbpSession
{
private readonly Tenant _tenant;
public override int? TenantId
{
get
{
if (base.PrincipalAccessor.Principal.Identity.IsAuthenticated)
{
return base.TenantId;
}
if (_tenant != null)
{
// Special case TenantID 1, this is the Host tenant
return _tenant.Id == MultiTenancyConsts.DefaultTenantId ? new int?() : _tenant.Id;
}
return base.TenantId;
}
}
public MtfSession(IMultiTenancyConfig multiTenancy, Tenant tenant) : base(multiTenancy)
{
_tenant = tenant;
}
}
If I inject my session object directly into a View, it always shows correct Tenant info - however, when session object reads TenantId from DbPerTenantConnnectionStringResolver.cs, it shows incorrect TenantId.
Any help with this is really appreciated!!