netcoreapp2.0 preview2。身份配置

时间:2017-07-27 15:07:26

标签: c# cookies asp.net-core asp.net-identity postman

Cookie配置存在问题。在chrome中一切正常,但Postman存在一些问题。它没有定义所有的cookie。 (拦截器开启)。

这是我的身份配置

ConfigureServices()
{
    services.AddAuthentication(auth =>
    {
        auth.DefaultChallengeScheme =CookieAuthenticationDefaults.AuthenticationScheme;
        auth.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    }).AddCookieAuthentication(auth =>
    {
        auth.LoginPath = "/account/login";
        auth.LogoutPath = "/account/logout";
    }
}

Configure()
{
     app.UseAuthentication();
}

使用netcoreapp1.1和此配置

Configure()
{
     app.UseIdentity();
}
ConfigureServices()
{
     services.Configure<IdentityOptions>(options =>
     {
        options.Cookies.ApplicationCookie.LoginPath = new PathString("/account/login");
        options.Cookies.ApplicationCookie.LogoutPath = new PathString("/account/logout");
     }
}

一切正常

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

问题在于Postman(仅适用于桌面应用) https://github.com/postmanlabs/postman-app-support/issues/3146