Base solution for your next web application

Activities of "leop"

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

Hi ismcagdas, if I navigate to Public site with tenant subdomain, the page shows up fine, everything appears to work OK in regards to detecting tenant on Public site.

It seems the problem is on MVC site with App:RedirectAllowedExternalWebSites setting when public site is configured to support subdomains.

Yes, before I added subdomain config redirects worked fine.

It seems Public site is detecting tenant name correctly from subdomain, but redirect after login is not working.

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.

I'm looking for something similar. I need a way to build front-end pages for customers, and ability for them to do some theme editing and such. Recently I've been looking into Headless CMS system, one looks interesting - <a class="postlink" href="https://github.com/Squidex">https://github.com/Squidex</a> . Also for theme editing, I've been looking at grapesjs. I haven't done any POC yet ... interested to see what people here think about such an integration.

Squidex in particular looks interesting, would be great if it can be tightly integrated on things like user management, tenant management and such.

Any thoughts?

I found a solution that seems to be working - the solution is referenced here: <a class="postlink" href="http://stackoverflow.com/questions/36475209/signalr-2-fails-on-azure">http://stackoverflow.com/questions/3647 ... s-on-azure</a>

To fix this, I added a reference to Owin.Security.AesDataProtectorProvider (NuGet package) and then added app.UseAesDataProtectorProvider() in ConfigureOwinServices() right before app.MapSIgnalR();

using Owin.Security.AesDataProtectorProvider;
...

namespace App.Web.Startup
{
    public class Startup
    {
        private static void ConfigureOwinServices(IAppBuilder app)
        {
            app.Properties["host.AppName"] = "App";

            app.UseAbp();

            app.UseAesDataProtectorProvider();
            app.MapSignalR();
        }
    }
}

Thanks for the info, this resolved my issue.
More info on this can be found here: <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Timing">http://aspnetboilerplate.com/Pages/Documents/Timing</a>

I set the value in the Core module PreInitialize() -- is this the correct location to set the value, or should it be set in Web module? It appears to work correctly.

Clock.Provider = ClockProviders.Utc;

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!!

Showing 1 to 9 of 9 entries