【发布时间】:2015-10-18 21:25:04
【问题描述】:
按照本指南在 Owin 上使用 MVC 5 进行外部身份验证 - External login providers with owinkatana。
我已将以下内容添加到我的 Owin Nancy 应用程序
Startup.cs -
app.Properties["Microsoft.Owin.Security.Constants.DefaultSignInAsAuthenticationType"] = "ExternalCookie";
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "ExternalCookie",
AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Passive,
});
app.UseTwitterAuthentication(new TwitterAuthenticationOptions
{
ConsumerKey = "mykey",
ConsumerSecret = "mypass"
});
LoginModule.cs(nancy 模块)
Post["ExternalLogin"] = _ =>
{
var provider = Request.Form.name;
var auth = Context.GetAuthenticationManager();
auth.Challenge(new AuthenticationProperties
{
RedirectUri = String.Format("/?provder={0}", provider)
}, provider);
return HttpStatusCode.Unauthorized;
};
现在在挑战点这里什么都没有发生。它只显示一个带有重定向 URL 的空白页面。我已经确认我可以按照 MVC 中的示例让它工作。 有人知道这部分的正确 Nancy 代码吗?
【问题讨论】:
-
曾经在这个问题上取得任何进展吗?我遇到了我想在 Nancy 中创建“/login”路由的同一条船,并让它触发通过 UseOpenIdConnectAuthentication(...) 中间件配置的登录过程。
-
很遗憾没有。我切换到正常的 Asp.net owin。
标签: c# asp.net owin nancy katana