Mvc asp.net authentication with users from webapi

Thursday, July 3, 2014

I have this situation:



  1. I have a MVC4 ASP.NET website on first server.

  2. There is WebAPI server that connects to Oracle server.

  3. Users of application are stored in Oracle db.


How should I start to customize Web application? As I already read I suppose to use "Forms" authentication mode.



<authentication mode="Forms">
<forms loginUrl="~/Home/LogIn" timeout="2880"/>
</authentication>


I saw that there is



FormsAuthentication.SetAuthCookie(person.UserName, false);


to log on. There is



FormsAuthentication.Authenticate(...)


method that authenticates user.


I persume, I should override somehow Authenticate(...) method. In this implementation method would ask WebAPIServer\api is user and password valid.


Should I use something like CustomUser authentication? Or mybe there is some other solution?







http://ift.tt/1qqo5xm