简体   繁体   English

如何在angularjs Web API SPA中使用现有的基于Web表单的身份验证和授权?

[英]How to use existing web form based authentication and authorization in angularjs web api SPA?

I am planning to add new functionalities using angularjs and web api over an existing asp.net webform site. 我计划在现有的asp.net网站表单站点上使用angularjs和Web API添加新功能。 Once finished, both the webforms and the angularjs will coexist. 完成后,Web表单和angularjs将共存。 In all the sample applications of angularjs and web api, I see a login page being created and OAuth authentication is being used through the token service. 在angularjs和Web api的所有示例应用程序中,我看到正在创建登录页面,并且正在通过令牌服务使用OAuth身份验证。 Is there any way I could use the existing webform based authentication/authorization in the newly added angular/web api project? 有什么办法可以在新添加的angular / web api项目中使用基于现有Webform的身份验证/授权? If you know any sample code please let me know. 如果您知道任何示例代码,请告诉我。

Thanks 谢谢

您可以使用Basic身份验证标头查看此示例http://jasonwatmore.com/post/2014/05/26/AngularJS-Basic-HTTP-Authentication-Example.aspx ,在身份验证服务中,调用后端以执行身份验证,并在响应中返回“令牌”(哈希/ base64),并将其分配给Authorization标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM