Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 15 02:16
    project-orcon commented #96
  • Apr 08 06:23
    MuratGOZCU closed #103
  • Apr 07 21:13
    Marcel0024 commented #103
  • Jan 21 07:26
    MuratGOZCU opened #103
  • Jan 21 07:19
    MuratGOZCU closed #102
  • Jan 19 22:48
    aldari closed #92
  • Jan 17 04:22
    aceptra closed #53
  • Dec 12 2018 13:24
    MuratGOZCU edited #102
  • Dec 12 2018 13:24
    MuratGOZCU opened #102
  • Dec 05 2018 13:23
    chernihiv commented #96
  • Nov 07 2018 14:14
    flauberjp commented #96
  • Sep 18 2018 16:33
    grayniall commented #96
  • Aug 10 2018 18:46
    ani2479 opened #101
  • Jul 23 2018 16:24
    whizkidwwe1217 commented #88
  • Jul 17 2018 10:31
    whizkidwwe1217 opened #100
  • Jun 29 2018 07:53
    ovidiaconescu commented #96
  • May 21 2018 18:12
    TomBeckett commented #96
  • May 15 2018 20:47
    TomBeckett commented #96
  • May 02 2018 03:45
    himalpatel81 commented #96
  • May 02 2018 03:06
    himalpatel81 commented #96
devJ0n
@devJ0n
At least not for the AddAuthentication().AddCookie(..).AddOpenIdConnect(...) middleware
devJ0n
@devJ0n
Seems like this PR are about same issue: saaskit/saaskit#96
Sindre Smistad
@DownGoat
@devJ0n We include a tenant id in our JWT token. The TenantResolver then looks for that claim.
devJ0n
@devJ0n
@DownGoat Nice, we have a strange situation where users need to be able to access multiple tenants :smile: Have you managed to run one web application with different OIDC options or are all tenants running as same OIDC client?
Sindre Smistad
@DownGoat
We don't use Open Id, we have our login users in a separate database which also has a table for tenants. We then load the settings for the tenants from this DB. You might consider creating different OIDC clients based on which tenant the user wants to access.
Josh Kerbaugh
@jkerb135
@devJ0n Look at implementing IOptionsMonitor for the Authentication mechanism you are using and storing the relevant configuration options on each tenant.
public void ConfigureServices(IServiceCollection services)
        {
services.AddSingleton<IOptionsMonitor<GoogleOptions>, GoogleOptionsSnapshot>();
//will now use GoogleOptionsSnapshot
services.AddGoogle(); 
}
public GoogleOptions CurrentValue => ResolveOptions(GoogleDefaults.AuthenticationScheme);
public GoogleOptions Get(string name) => ResolveOptions(name);

private GoogleOptions ResolveOptions(string scheme)
        {
            var tenant = mHttpContextAccessor.HttpContext.GetTenant<SiteInfo>();

            var options = new GoogleOptions{
                ClientId = "",
                ClientSecret = ""   
            };

            //Code to configure options.StateDataFormat and options.Backchannel omitted for brevity
            //https://github.com/aspnet/Security/issues/1338
            //https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthPostConfigureOptions.cs

            //Grab configuration from Tenant information loaded from the dbcontext
            if (!string.IsNullOrWhiteSpace(tenant?.ClientId))
            {
                options.ClientId = tenant.ClientId;
                options.ClientSecret = tenant.ClientSecret;
                options.SignInScheme = IdentityConstants.ExternalScheme;
                options.AccessType = "offline";
                options.SaveTokens = true;

                foreach (var scope in tenant.Scopes)
                {
                    options.Scope.Add(scope);
                }
            }

            return options;

        }
devJ0n
@devJ0n
@jkerb135 Thank you! Where is the ResolveOptions method located, is it in the Startup.cs file?
devJ0n
@devJ0n
Or is is a concrete class named "GoogleOptionsSnapshot" which implements the IOptionsMonitor interface
Josh Kerbaugh
@jkerb135
@devJ0n it would be a concrete class that implements the IOptionsMonitor interface
devJ0n
@devJ0n
Thx!
Madhu Babu
@madhuchowlur
Hi, am developing a single page SaaS application (Angular 5, WebAPI 2) can you help how to implement multitenancy in this approach
Prince269090
@Prince269090
![alt](https://github.com/Boriszn/DeviceManager.Api/raw/feature/ISS-1-Add-Automapper/assets/arhitecture-diag.png)
Hi All,
I am using multi tenancy with multi database.
  1. Master DB
2 TenantDB - 1
3 TenantDB -2
I have successfully mapped all the tenant with Host and also successfully able to call all the existing different tenant databases.
My question is support i am logged with MasterDB - host : localhost:9000 and i want to access all the data of TenantDB - 1(host : localhost:9001) and TenantDB-2 (host: localhost:9002) when i am logged in with the MasterDB.
Please let me know how do i achieve this as the tenant context is already binded with MasterDB database.
suzeen
@suzeen_gitlab
Hi,
Hi,
I am trying to built a multi tenant application with separate database for each tenant. Can any one help me how do I configure dbcontext based on tenant.
devJ0n
@devJ0n
I'm running two ASP.NET Core MVC webb apps on my localhost and both applications is using cookies. Should CookieDomain separation of cookies be working if I specify custom domain names in my hosts file?
devJ0n
@devJ0n
Hi guys (and girls), does NLog.Web have support for .NET Standard?
It seems it doesn't have support, so what to do?
I have a class library using .NET standard library 2.0 which have a type inheriting the AspNetLayoutMultiValueRendererBase
Eric Gitonga Njue
@EricNjue

Hi,
Maybe this question has been answered, if so I would appreciate a link to it.
I want to load the tenants from a Db & create their respective databases (Each tenant to have their own database). I've tried overriding my DbContext onConfiguring but tenant is always null. See below code,

` public class CounterServeDefaultDbContext : DbContext
{
private readonly AppTenant tenant;

    public CounterServeDefaultDbContext(AppTenant tenant)
    {
        this.tenant = tenant;
        Database.EnsureCreated();
    }       

    #region DbSets

    public DbSet<AppTenantTuple> AppTenants { get; set; }

    #endregion


    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
       optionsBuilder.UseNpgsql(tenant.ConnectionString);
        base.OnConfiguring(optionsBuilder);
    }      
} `

StartUp Class

` public void ConfigureServices(IServiceCollection services)
{
services.AddMultitenancy<AppTenant, AppTenantResolver>();

        services.AddMvcCore()
            .AddAuthorization()
            .AddJsonFormatters()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

        // AddAuthentication adds the authentication services to DI and configures "Bearer" as the default scheme
        services.AddAuthentication("Bearer")
            // AddIdentityServerAuthentication adds the IdentityServer access token validation handler into DI for use by the authentication services
            .AddIdentityServerAuthentication(options =>
            {
                options.Authority = AUTHORITY;
                options.RequireHttpsMetadata = false;
                options.ApiName = "***";
            });


        services.AddEntityFrameworkNpgsql()
            .AddDbContext<CounterServeDefaultDbContext>();


        services.AddOptions();
        services.AddSingleton<IConfigureOptions<MultitenancyOptions>, ConfigureMultitenancyOptions>();


        // services.Configure<MultitenancyOptions>(Configuration.GetSection("Multitenancy"));


    }`
EssentialAgility
@EssentialAgility
Just wondering if anyone has had success getting a saaskit Multi-Tenant app working in Azure using subdomains. if so, any pointers?
ovidiaconescu
@ovidiaconescu
@EssentialAgility sure, using custom domains. Where did u get stuck?
Marcin Sulecki
@sulmar

Hi, I've just started using SaasKit.Multitenancy library. I'm looking for a way for Per-Tenant Options. Somethink like that in Finbuckle.MultiTenant:

services.AddMultiTenant()...
    .WithPerTenantOptionsConfig<CookieAuthenticationOptions>((o, tenantContext) =>
    {
        o.Cookie.Name += tenantContext.Id;
    });

How can you do it with SaasKit.Multitenancy?

Michael Dadashyan
@mebymyself
Hello @benfoster , I am trying to use the SaasKit and following the blogpost http://benfoster.io/blog/aspnet-core-multi-tenancy-data-isolation-with-entity-framework.
Got stuck where I want to inject Tenant to DbContext to change the connection string.
I am getting error: InvalidOperationException: No service for type 'Models.Tenant' has been registered..
Injection to view works just fine.
My DbContext is in different assembly if it matter
GOVINDA ALWANI
@govi2010
Hello team
John Nyingi
@j0nimost
I have the same question @mebymyself has if anyone has a link to the solution please provide
saikiranguptak53
@saikiranguptak53
i have a requirement mulitple clients login independently with same login credentials for different clients(websites) . Is this possible with identity server 4?
Edwardenis De los santos
@Edwardenis
This Awasome Library is for .net core so I cannot used. Do you know an alternative to implement on MVC 5 App?
Ben Meredith
@bmeredith
@Edwardenis The 0.0.2-pre version of SaasKit uses full framework (MVC 5/WebApi 2) instead of .net core.
Alan Leite de Rezende
@alanrezendee

Good morning guys!
I need to implement the filters in my services to get the data of the tenance you are requesting.
Given this scenario, will I have to inject the tenance resolver into my service and do a where in all methods manually, or is there any native saaskit implementation that solves this?

Example Today:
var accounts = _accountAppService.GetAsync (). Where (x => x.tenantId == _tenantResolver.Id)

Master Whiz
@whizkidwwe1217
@alanrezendee You should inject the TenantContext that holds the Tenant object instead of injecting the tenant resolver
eddyjl077
@eddyjl077
@sulmar Where you able to create this function 'WithPerTenantOptionsConfig' or something similar?
stefano-corricelli
@stefano-corricelli
Is this channel still active ?
Márton Balassa
@BalassaMarton
Hi, is this project active in any way? I like the idea and I have some of my own to contribute.
Reagan Chu
@presiden999_twitter
I'm trying to dding tenant-specific files with SaasKit in ASP.NET Core

and can't find any working example for core 2.0
this was the old code for core 1.0

var routeBuilder = new RouteBuilder(app);
var routeTemplate = "tenant/{*filePath}";
routeBuilder.MapRoute(routeTemplate, (IApplicationBuilder fork) =>
{
//Add middleware to rewrite our path for tenant specific files
fork.UseMiddleware<TenantSpecificPathRewriteMiddleware>();
fork.UseStaticFiles();
});
var router = routeBuilder.Build();
app.UseRouter(router);

but core 2.0 no longer use this. is there anyone with example on how to get this to work

Joe Audette
@joeaudette
@presiden999_twitter I would avoid rewriting and instead if tenant routes need a folder segment in the url use a routecontstraint, that is what we do in cloudscribe, we do use sasskit to resolve the tenant per request and we use it to branch static files middleware per tenant, but most other middleware is singleton and can't be branched in 2.0 and higher. https://www.cloudscribe.com/
Master Whiz
@whizkidwwe1217
Hi, has anyone used SaasKit in ASP.NET Core 3.0?
vodkadom75
@vodkadom75
hi has anyone done any multitenancy handling events, eg event property sets tenant ?
DominicQuickpic
@DominicQuickpic
Does saaskit use websockets?
Sanchit Chawla
@SanchitChawla12_twitter
I am using SAAS Kit and loading tenant information from an external data source, I am planning to implement CachingAppTenantResolver to avoid calling database on every request. But just wanted to check how would i invalidate the cache if tenant is updated/deleted
slacker-king
@slacker-king
this project seems semi-dead. anything better, or at least maintained, out there? I know of cloudscribe from above.