【发布时间】:2015-04-04 15:59:32
【问题描述】:
我会尽量明确。
我有一个前端应用程序 (MVC),它可以与 Facade Web Api(资源)通信并从身份验证服务器获取令牌。
我的问题是我无法在 MVC 应用程序中创建身份。这是 mu 启动类。
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
});
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
{
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
app.UseTwoFactorRememberBrowserCookie(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie);
}
当我尝试使用 [Authorize] 装饰的方法控制器时,我收到 401 错误,而不是被重定向到登录页面。
如果有任何帮助、建议或示例,我将不胜感激。
问候,
【问题讨论】:
标签: asp.net-mvc-4 oauth-2.0 asp.net-identity-2 jwt