MVC 5 use old forms authentication instead of OWIN - asp.net

How can i use the forms authentication found in asp.net mvc 3/4 in mvc 5 ?
I have an mvc 4 app that i want to hook up with admin dashboard in mvc 5 and eventually convert the main app to mvc 5 but i want to keep the authentication AS IS or convert it somehow to the new auth method.
I searched for a while but all i found was on how to use the new OWIN authentication ( imo ms` version of dotnetopenauth). If you guys know a link with useful info or can answer me here, please do so.
Thanks!

I was able to get both, OWIN and Forms, to work together by doing this: MVC 5 External authentication with authentication mode=Forms

Related

Asp.net MVC 5 and Angular 2: Get Authenticate in both side from Angular

Currently, I'm working on a project that needs to be merged their back-end and front-end. the back-end is written in asp.net MVC 5 with jwt authentication mechanism, and front-end written in angular 4 with jwt mechanism.
My issue is I need to get authenticate from front-end side which is angular and can go to an old part of the project that is written in asp.net MVC 5 and Razor view.
I finally find the solution:
Get authenticate from ASP.net and add the authentication info into the cookies and then access it from angular

Best architecture for new web site calling existing services (ASP.NET Web API with authentication and authorisation)

What I am trying to achieve:
I currently have mobile apps on top of services and would like to add a web site on top of the same services.
Services details:
ASP.NET Web API project using OAuth (bearer token) and Identity for authentication and authorisation.
Microsoft.AspNet.WebApi 5.2.3
Microsoft.Owin.Security.OAuth 3.0.1
Microsoft.AspNet.Identity.Core 2.2.1
Mobile details:
Xamarin projects.
Xamarin.Forms 2.3.3.193
What architecture should I use for the web site?
Create a new ASP.NET MVC project and call my current services from the MVC controllers? This seems bad because:
I would have 2 layers of controllers (web site MVC controllers calling services API controllers)
I would need to store bearer tokens in cookies
I would need to manage the tokens and cookies expirations
Create a new ASP.NET MVC project and call current services database directly? This seems bad because:
I would have to duplicate the models in the services project and in the web site project
Create a new ASP.NET project and call my current services using ajax? This seems bad because:
I would need to create my own register/login pages
I would need to store bearer tokens in cookies
I would need to manage the tokens and cookies expirations
I would need to say bye to future social authentication (OAUTH2) implementation because I wouldn’t be using OWIN
Thanks,
fcorbeil
If you already have the API a brand new MVC app shouldn't be such a bad choice. If you have your models stored in a different project just reference them to the MVC one. As for the services, them would work perfectly with the new application. This all can be achieved without changing almost nothing to the current implementation.
I am working on a project and using a similar architecture.
I decided to create an Angular project for the website front end and all it does is talk to the Web API. Angular handles the JWT authentication really well. If you've never worked with Angular before, it is really nice to work with.
However, a vanilla ASP.NET MVC web app would work just as well.
It depends on how comfortable you are with Angular, or how willing you are are to learning it! :)

Angular 2 With .NET Core 1.1 API

I am wondering what the best (most efficient, best practice, etc.) way to implement an user login using Angular 2, for the client side, and ASP.NET Core for the backend. I have seen various ways of implementing this type of project but I have not come across a definitive answer.
Specifically, if I have a seperate Angular 2 application, should I create an API for user login/registration that is also a tokenizer and then create a seperate business logic API? Or should I combine the two and have one, do-it-all, API for the web app? Thank you!
You can use either ASP.Net Identity or OpenID authentication, or both.
If you want more control over Authentication and Authorization, you want to use ASP.Net Identity. However, it is not uncommon to see both authentication methods in a lot of website these days.
Valerio De Sanctis explains both authentication methods in his ASP.NET Core and Angular 2 book. I highly recommend you to use read this book if you plan to implement authentication in ASP.NET Core and Angular 2. Here is my review on this book at Amazon.

SSO Umbraco 7 using UmbracoIdentity with MVC 5 Authentication

I have tried to use Single Sign On method to my Umbraco sites (Umbraco sites using UmbracoIdentity for authentication) and my MVC 5 Apps, but I get problem when authentication has expired in Umbraco sites, it did not automatically clear authentication session in my MVC 5 apps. It happens vice versa.
Is there any event or something else which will be trigerred when the session has expired in one app?
Thanks,
Delly
Umbraco does not currently support MVC 5. There are breaking changes so I wouldn't recommend trying to get them to work together just yet. Umbraco 8 will be MVC 5 and probably soon, but they are reducing the number of DLL's first.
The way I would handle this is probably to use the request pipeline and check if session is authenticated each time. See more about the pipeline here.

ASP.NET MVC and User Authentication with NHibernate

I am about to start a new application and am excited about using asp.net mvc and nhibernate. However, the big "problem" is how I handle the user authentication stuff. What are some ways those used to using nhibernate and MVC solve this problem?
My thought is let asp.net do its own thing and I do my own thing database wise. Am curios if I should role my own using the provider model and nhibernate, if I can figure out how. Or is there a way to integrate current code that is in the mvc example into nhibernate?
You can still use the ASP .NET 2.0 Membership APIs from ASP .NET MVC.
Same question here and Manuel Abadia has written a custom NHMembershipProvider here.
4 guys from rolla have an excellent post if you want to buil your own provider on top of the asp.net membership API : https://web.archive.org/web/20211020114106/https://www.4guysfromrolla.com/articles/110310-1.aspx

Resources