I have a slightly unique situation here. I am making a web application that will be able to login with the credentials of different web applications. For example, you can login / register on my site, or you can login / register in your YouTube account. I do not use OpenID, because in this case I need to have access to YouTube data.
I am using ASP.NET MVC 3 EF4 with custom members, roles, profile providers.
The problem is that usernames cannot be unique, because someone with a YouTube username may have the same username as on my site. Thus, I walked around by specifying the user type in my user table. This is a fairly complex key (user ID and user type).
I have a custom authorize attribute that checks the role the user is in, but now I need to implement a custom IPrincipal because I need to pass the user type. Only problem is where do I store it? session?
Initially, I thought that this was what the application table was for, and I had short-term success, but I read that there were problems with the threads, and I was getting session errors everywhere, it wasn’t so cool :(
I am wondering what is the best way to do this because I cannot use the overridden methods of the providers, because I need to add the UserType parameter to some of the methods, but then this violates the functionality of the provider.
EDIT: I basically should be able to change the application name at runtime programmatically. I tried to do this, the only problem was that when I stopped my development server but left my browser open and then started my dev server again, it did not save the application name.
EDIT: I changed my application to use OAuth, I did not find a good solution.