This project is read-only.

ASP Net Identity Multiple Application Support

Mar 3, 2014 at 11:27 AM
In the old Forms Authentication system for ASP.Net Web Forms there was an option to store users in the database for more than one application, this would mean there would obly be a need for one Security based database.

Is there an option to enable this type of option in the ASP.Net Identity database as when looking over the schema created by the examples it would appear that the DB only supports one application per database.

Any help in this would be great.

Regards,

Stuart
Mar 3, 2014 at 8:39 PM
@StuartFergusonTS3: ASP.NET Identity out of the box does not support multiple applications. This needs to be added implemented by the developer as needed. It can be done in multiple ways. You can have a property on the user class that holds the application Id and use that when getting the user for the application. You can encode the applicationId in the userId and verify that the user belongs to the application once the object is read. This approach helps if you don't want to additional properties on the user
Mar 4, 2014 at 9:22 AM
@suhasj Do you know if there are any plans to support this in the near future out of the box ?

Regards,

Stuart
Mar 4, 2014 at 8:52 PM
@StuartFergusonTS3: No we won't. This was a conscious decision made at the beginning of the project
Aug 28, 2014 at 2:45 AM
What would be the suggested solution for this? Extending user store and all relevant code needed to be extended or use a tenant/username as the username?
Aug 28, 2014 at 7:57 PM
Edited Aug 28, 2014 at 7:57 PM
We implemented this in ASP .NET Identity by creating our own classes and data stores.

Basically you just create your own user object that inherits from IUser
    public class IdentityUser : IUser<long>
    {
        public long Id { get; set; }
        public string UserName { get; set; }
        public string PasswordHash { get; set; }
        public string SecurityStamp { get; set; }
...
...
        public int ApplicationID { get; set; }

    }
We also created our own user and role stores (http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity)

But we did this mainly because this stuff uses Entity Framework, and there are no FREE entity framework drivers for DB2. NHibernate still rocks here and many other places.