Home Multi-App Support For Asp.Net Identity – Part 1
Post
Cancel

Multi-App Support For Asp.Net Identity – Part 1

So I was thinking about how a small organization could leverage single-sign-on without having to leverage a larger Identity server implementation such as Thinktecture’s Identity Server 3.

I reserve the right to change my mind and change course, but for now, I am looking to leverage Asp.Net’s Identity database to manage users and the applications the users are granted access to.

Out of the box, Asp.Net Identity does not support multi-applications. However, with a little work, we can extend Asp.Net Identity to allow users to be associated with different applications.

Start with the Data Store

This adventure will start with the database. We need an Identity database. As luck would have it, by creating an Asp.Net MVC application and using the Individual User Accounts for our Authentication method, we get a database created for us. Pretty nice, right?!

However, we don’t have the concept of an Application in our new database. How can we accomplish this? We will use EF’s Code First Migrations! That’s right, the Migrations will allow us to extend the database by making changes to our Identity classes that the MVC scaffolding provided for us. We can also add new classes that will define new tables to add to the database. Migrations will also allow us to update the database to reflect our changes.

So let’s start by just creating the database that we desire.

In the next series of blogs, I will outline

  1. We will change the default database name the Asp.Net Identity creates.
  2. I want to add a couple of fields to the AspNetUses table that Asp.Net Identity creates.
  3. I want to Add a new table to house Applications information.
  4. Then create a cross reference table between the AspNetUsers table and our new Applications table.
  5. Finally run the Migrations and create the database.
  6. House the new Identity database in a Visual Studio database project and add some seed data.

We will utilize a default Asp.Net MVC application but will only use it to create the database we need. We never actually run this project. We will just change some of the Identity classes and engage the Code First Migrations (which we will run from the Nuget Command Prompt.

This post is licensed under CC BY 4.0 by the author.