MVC 5和Web API之间Owin认证(单独的IIS应用程序) [英] Owin authentication between MVC 5 and Web API (separate IIS applications)

查看:154
本文介绍了MVC 5和Web API之间Owin认证(单独的IIS应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MVC5和使用窗体身份验证和承载网络令牌API(这两个不同的IIS应用程序)工作程序。是的,他们必须保持两个独立的IIS应用程序。我使用的身份验证令牌在我的窗体身份验证cookie的用户名,这就是我是如何能够从MVC和Web API传递令牌来回。

I have a working app with MVC5 and Web API (both different IIS applications) using Forms Authentication and Bearer token. Yes, they must remain two separate IIS applications. I am using the auth token as the username in my Forms Authentication cookie and that's how I am able to pass the token back and forth from MVC and Web API.

我也是用Asp.net 2.0身份。

I am also using Asp.net Identity 2.0.

我想借此Forms身份验证的方程,只需使用Owin认证,但User.Identity.IsAuthenticate永远是假的,我的MVC应用程序时,我有一个承载令牌发放。

I would like to take Forms Authentication out of the equation and just use Owin Authentication but the User.Identity.IsAuthenticate is always false in my MVC app when I do have a Bearer Token issued.

任何人都可以点我到code展示我怎么能记得MVC和Web API之间的身份验证令牌W / O型窗体身份验证?

Can anyone point me to code showing how I can remember auth token between MVC and Web API w/o Forms Authentication?

推荐答案

您在web..config所有machineyKey应该是统一的,不使用任何在线工具生成的machineKey,请在使用电源外壳生成它们。您可以通过阅读找到更多关于这个我的<一个href=\"http://bitoftech.net/2014/09/24/decouple-owin-authorization-server-resource-server-oauth-2-0-web-api/\"相对=nofollow>博客文章这里。

All your machineyKey on web..config should be the unified, do not generate machineKey using any online tool, please generate them using power-shell. You can find more about this by reading my blog post here.

这篇关于MVC 5和Web API之间Owin认证(单独的IIS应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆