/Multitenancy-Microservice-FederatedIdentity-Example

Multitenancy Federated Identity Example ASP.NET MVC C#

Primary LanguageC#GNU General Public License v3.0GPL-3.0

Multitenancy and Federated Identity example

Alt text

Repository objective: To supplement blog articles on multitenancy, microservices and federated identity (see below), and to create easy to follow code repository that makes sense (if it still makes no sense then please do let me know).

Please do note that this repository currently does not contain microservice examples just yet, right now it covers multitenancy and federated identity. Please use this for theoretical / educational purposes only.

Articles

ASP.NET MVC Multitenancy - Introduction & Architecture Overview

ASP.NET MVC Multitenancy, Part 0 - Subdomain VS URL Path

ASP.NET MVC Multitenancy, Part 1 - Routing with OWIN

ASP.NET MVC Multitenancy, Part 2 - OpenID Connect authentication

ASP.NET MVC Multitenancy, Part 3 - NHibernate Tenant Data Filtering and Shared Database

ASP.NET MVC Multitenancy, Part 4 - Authorisation

Basic SaaS conversion guide, migrate your application to the Azure Cloud

alt text

Setup Instructions

Step 1 - Create SQL Server

Step 2 - Run baseline.sql

alt text

This will create stoptheline database in your SQL server.

Step 3 - Update Web.config connection string

alt text

Step 4 - Run the web project

Step 5 - Create authentication keys

To use this project you will need authenticate using Open ID Connect protocol. To do this you can use Google, Azure AD, etc.

I am going to use Google to keep things simple, you will need to setup Auth 2.0 credentials, this Google page explains how you can do this.

Once you are done you should see something like this: alt text

alt text

Fill everything in use the client id that Google has given you when you have created your auth 2.0 credentials. For authority just use https://accounts.google.com

Before you press "create account", please whitelist your URL, how do you know what your URL is? You get a preview:

alt text

Now that you know what it is go to your Google web application credential account and add your URL to the "Authorized redirect URIs":

alt text

Press "create account".

If you don't do this, when you will press "create account" you will get a screen that will look like this:

alt text

Step 7 - Sign Up

alt text

Step 8 - You are in, just use the app