代码之家  ›  专栏  ›  技术社区  ›  Rodolfo Ortiz

同时启用Cookie身份验证和ASP。MVC项目中的NET身份验证

  •  0
  • Rodolfo Ortiz  · 技术社区  · 8 年前

    我有一个MVC站点,其中包含使用cookie身份验证的MVC控制器和WebApi控制器。然而,我希望一些WebApi控制器使用Identity 3服务器进行身份验证。我检查了这个答案,但属性身份验证方案(property AuthenticationScheme)不可用,可能是因为我使用的是Identity 3(或者可能是.NET core的一部分,我目前没有使用)。

    How do I issue the corresponding Bearer and Cookie identity in ASP.NET with multiple Authorization schemes?

    1 回复  |  直到 8 年前
        1
  •  1
  •   Rodolfo Ortiz    8 年前

    我想,这是可能的使用方法应用程序。映射并在其中指示路径和身份验证方法。类似于

            app.Map("/mobile", idsrvApp =>
            {
                idsrvApp.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
                {
                   ...
                });
            });
    
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
             ...
            });