[英]use asp.net web api token to authenticate my asp.net mvc application
I have created a new web api project with individual user account authentication. 我已经使用个人用户帐户身份验证创建了一个新的Web api项目。
I followed this post and everything worked as expected 我关注了这篇文章,一切都按预期进行
http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api
Now, I have a token end point localhost:54452/Token 现在,我有一个令牌端点localhost:54452 / Token
Lets, say I create new asp.net mvc application. 假设我创建了一个新的asp.net mvc应用程序。 I want to use this token end point for authentication.
我想将此令牌端点用于身份验证。 How do I tell my controllers to use this token end point?
如何告诉我的控制器使用此令牌端点? How do I tell my controllers to pass the bearer access token on each request or how does these two work together.
我如何告诉我的控制器在每个请求上传递承载访问令牌,或者这两个如何一起工作。
asp.net mvc and asp.net web api are two different projects with different port numbers asp.net mvc和asp.net Web API是两个具有不同端口号的不同项目
Thanks, 谢谢,
Syed 赛德
I would create a wrapper class that uses HttpClient to issue HTTP requests to the Web API. 我将创建一个使用HttpClient向Web API发出HTTP请求的包装器类。 Then use this wrapper class when you're communicating with the Web API.
与Web API通信时,请使用此包装器类。 It will then handle adding the token to the HTTP request header.
然后它将处理将令牌添加到HTTP请求标头中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.