Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

MVC 4 Custom Membership Providers With 3rd field for login

$
0
0

Hello,

I'm trying to learn ASP.Net MVC. I'm already decent at just plain c# for desktop applications and php. So I figured I would take a stab at learning the web side of the .NET now.

I figured I would dive right in the deep end and port a existing system I made in php (using Zend Framework which is similar in a number of ways to MVC). Everything has been going ok. I have the Data first Entity Models created and the base "template" and bundles.

I was now moving on to a Login when I hit a road block. I've spent the past 4 days reading and going through articles on the Membership and Role providers. As i wanted to try and using as much stock as I could. The problem is however the user system is a little different then a standard site.

A user logs in 3 pieces of information. A Company ID, username, and password. The Login validation in the existing system goes like so:
1. Checks the company record to make sure it's real and if they are not disabled.
2. Queries the login table for a username with that company.
3. makes sure the password matches.
4. Final set a cookie and which to the companies database if authentication has passed. (1 central database for company information and logins. All other data is stored in segregated databases for each company.)

However everything I've read leads me to believe I can not do it this way with the built in components of ASP.Net MVC like the MembershipProvider, Identity, Principal, and Roles. Which results in me having to a complete custom Authentication and prevents me from using annotations like [Authorize(Roles = "SuperAdmin")].

Because I'm learning this perhaps I've over looked something and was wanting a confirmation. if this is and someone has a link to tutorial that examples things that would be great.


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>