@benfoster benfoster released this Jul 17, 2016 · 2 commits to master since this release

  • Fixed #27 Memory Cache eviction issue. All cache entries for the same tenant instance will be evicted when any of the entries expire. This behaviour can be configured by providing MemoryCacheTenantResolverOptions.
  • Added ITenant<TTenant> wrapper to handle cases where the current tenant instance be null (similar to IOptions<TOptions> in ASP.NET Core).

Thanks to @rdefreitas for his contributions to this release.


@benfoster benfoster released this Jul 2, 2016 · 15 commits to master since this release

Upgrade to ASP.NET Core 1.0 RTM. Contributed by @joeaudette.


@benfoster benfoster released this Jun 14, 2016 · 18 commits to master since this release


@benfoster benfoster released this May 25, 2016 · 21 commits to master since this release

  • Upgrade to ASP.NET Core RC2 - Thanks to @rdefreitas for the bulk of the work
  • Fixed #23

Note: This is is a breaking release and not compatible with DNX-based ASP.NET Core projects.


@benfoster benfoster released this Mar 23, 2016 · 35 commits to master since this release


  • Added unique TenantContext<T>.Id for easier debugging.
  • MemoryCacheTenantResolver now includes tenant context Id in all debug messages.
  • Changed default memory cache options to use sliding expiration of 1 hour instead of absolute expiration.
  • Added TenantContext<T>.Dispose() which is called by MemoryCacheTenantResolver when cache entries are evicted.


Adds support for tenant-scoped dependencies. See this blog post for full details.


@benfoster benfoster released this Mar 1, 2016 · 48 commits to master since this release

Added support for tenant middleware pipelines.

The main purpose of this feature is to enable ASP.NET Authentication middleware to be used in multi-tenant applications. As described in this GitHub issue, most of the ASP.NET Auth middleware components require their options to be specified at the time the middleware is registered. This is a problem in multi-tenant applications since it means every tenant must have the same configuration e.g. all tenants use the same Google API keys.

This release adds the UsePerTenant extension to IApplicationBuilder which enables forked middleware pipelines to be created per tenant, thus allowing the authentication middleware to be configured per tenant:

        app.UsePerTenant<AppTenant>((ctx, builder) =>
            builder.UseCookieAuthentication(options =>
                options.AuthenticationScheme = "Cookies";
                options.LoginPath = new PathString("/account/login");
                options.AccessDeniedPath = new PathString("/account/forbidden");
                options.AutomaticAuthenticate = true;
                options.AutomaticChallenge = true;

                options.CookieName = $"{ctx.Tenant.Id}.AspNet.Cookies";

            builder.UseGoogleAuthentication(options =>
                options.AuthenticationScheme = "Google";
                options.SignInScheme = "Cookies";

                options.ClientId = Configuration[$"{ctx.Tenant.Id}:GoogleClientId"];
                options.ClientSecret = Configuration[$"{ctx.Tenant.Id}:GoogleClientSecret"];

It's highly recommended that your tenant class implements IEquatable<TTenant> to avoid potential possible race conditions when resolving tenants, as per https://github.com/saaskit/saaskit/blob/master/samples/AspNetMvcAuthDemo/AppTenant.cs.

For more details please see this blog post.


@benfoster benfoster released this Jan 21, 2016 · 66 commits to master since this release

Multitenant support for ASP.NET 5.

Breaking Changes

The existing OWIN-based middleware and libraries for MVC 5 and Web API 2 have been removed from the main development branch as they will no longer be actively developed.

You can continue to install these packages from nuget.


@benfoster benfoster released this Jan 18, 2016 · 68 commits to master since this release

Multitenancy middleware for OWIN compatible applications.
Includes extensions for Microsoft MVC and Web API frameworks.