Add Authentication to ASP.NET WebApi 2.2

吃可爱长大的小学妹 提交于 2019-12-09 09:31:57

问题


I have created a WebApi 2.2 project (from an Empty New ASP.NET Project) to prove some implementation concepts and I now want to add Authentication to it.

I notice that the only way to add Authentication on a new WebApi app is to use one of the (VS 2013, in my case) Templates.

Is there a sure-fire way of adding Authentication to an already existing WebApi 2.2 app?

I will only want to use bearer tokens, if that makes a difference to any answers I may receive.


回答1:


Yes you can add the bearer authentication from scratch, I'm not big fan of the VS 2013 templates because they mix between cookies and tokens authentication. You can check my detailed blog post on how to add bearer tokens only to new or existing Web API project. Let me know if you need further help.



来源:https://stackoverflow.com/questions/26178888/add-authentication-to-asp-net-webapi-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!