MVC3 + WIF - FederationResult 缺少“wctx”
我有一个 MVC3 应用程序,我想为其实现索赔支持。我的目标如下:
提供一个登录链接,单击该链接时会显示一个带有用户名/密码和 Facebook/WindowsLive/Google 等链接的弹出窗口
当访问受保护的控制器时自动重定向到我的登录页面,例如 /Order/Delete
我已在 AppFabricLabs.com 中设置了应用程序和提供程序,并将 STS 包含在我的项目中。我还创建了 IAuthorizationFilter 的实现,以便我可以将控制器标记为 [WifAuth] 并成功调用 OnAuthorization 方法。我已经实现了访问者尚未经过身份验证的用例,如下所示:
private static void AuthenticateUser(AuthorizationContext context)
{
var fam = FederatedAuthentication.WSFederationAuthenticationModule;
var signIn = new SignInRequestMessage(new Uri(fam.Issuer), fam.Realm);
context.Result = new RedirectResult(signIn.WriteQueryString());
}
并使用我的身份提供商选择成功获取 AppFabricLabs 页面(尚未弄清楚如何自定义该页面)。当我登录时,我的 returnUrl 被调用,因此我进入了控制器方法 /Home/FederationResult,但是发布给我的表单仅包含 wa 和 wresult 字段,但我需要 < strong>wctx 知道将用户发送到哪里...我一直无法弄清楚为什么。
wresult 是一个 XML 文档,其中包含(以及无数其他内容)登录用户的姓名和电子邮件地址,但遗憾的是不包含用户前往的 URL。
我是否配置失败,或者我是否偏离了基地?有人有什么想法吗?
- e
I have an MVC3 app for which I want to implement claims support. My goal is as follows:
provide a SignIn link, which when clicked displays a popup window with username/password and Facebook/WindowsLive/Google etc. links
automatically redirect to my SignIn page when a protected controller is accessed e.g. /Order/Delete
I've set up the application and providers in AppFabricLabs.com and included the STS in my project. I've also created an implementation of IAuthorizationFilter so I can mark my controllers as [WifAuth] and successfully get the OnAuthorization method called. I've implemented the use-case where the visitor has not been authenticated like this:
private static void AuthenticateUser(AuthorizationContext context)
{
var fam = FederatedAuthentication.WSFederationAuthenticationModule;
var signIn = new SignInRequestMessage(new Uri(fam.Issuer), fam.Realm);
context.Result = new RedirectResult(signIn.WriteQueryString());
}
and successfully get AppFabricLabs page with my Identity Provider choices (haven't figured out how to customise that page). When I log in my returnUrl gets called so I land in a controller method /Home/FederationResult, however the form posted to me contains only wa and wresult fields but I need wctx to know where to send the user... I haven't been able to figure out why.
the wresult is an XML document that contains (amongst a bzillion other things) the name and e-mail address of the user logging in but sadly does not contain the url to which the user was headed.
have I failed to configure something or am I just off base? thoughts anyone?
- e
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需为
SignInRequestMessage
指定一个上下文:wctx
参数包含在每个请求/响应中,也是最终发布到您网站的表单的一部分。Just specify a Context for the
SignInRequestMessage
:The
wctx
parameter is included in every request/response and also part of the form posted finally to your site.