Carles Company
Carles Company

Reputation: 7216

Use OWIN to connect an ASP.NET MVC application to Azure AD or use the default templates

The default templates for Organizational accounts in ASP.NET MVC 5 applications use HttpModules to handle the response from Azure AD and create the corresponding ClaimsIdentity. Looking at the examples for the ADAL library, I saw that it is also possible to use an OWIN middleware for the same purpose. Which approach is better? Why do the templates use the HttpModules instead of using an OWIN middleware as the Individual accounts template does?

Thanks!

Upvotes: 2

Views: 542

Answers (1)

Aram
Aram

Reputation: 5705

I think HttpModules is the old way of handling things like AuthZ in the pipeline. HttpModules are part of the infrastructure that was built at the same time as web forms.

If you are making a modern web api like Web Api or an MVC app, i suggest forget about the HttpModule and go with Owin Middleware, but if you use Webforms better go with HttpModules (although it is possible to host OWIN in webforms but you wont have some of the benefits of OWIN).

There is an overview of OWIN here where you can see some points of using OWIN Middleware:

http://www.asp.net/aspnet/overview/owin-and-katana/an-overview-of-project-katana

Moreover, HttpModules are based on some events that happen but OWIN Challenges are independent of these events.

And about the question that you asked Why the templates use HttpModules, i'm not really sure, but i can guess that because they are more light weight in terms of dlls that you would need to run the samples..

Upvotes: 1

Related Questions