如何在同一MVC应用程序中允许Windows和OpenIdIDS4身份验证

问题描述

我想拥有当前的MVC应用程序,以同时支持Windows和OpendId(IDS4)身份验证。

在Windows上运行的MVC( app-a )应用程序的web.config文件中包含<authentication mode="Windows" />。我还在项目Anonymous Authentication设置中启用了Windows Authenticationf4。我添加了Owin管道以使用CookiesopenIdConnect身份验证。此代码可以正常工作而不会出现问题。用户一旦进入 app-a ,就会带他们进入openId登录页面用户身份验证后,它将重定向 app-a

Startup.cs文件中,我有以下代码,并且工作正常。

      app.UseCookieAuthentication(new CookieAuthenticationoptions
        {
            CookieHttpOnly = true,AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,CookieName = "test",ExpireTimeSpan = TimeSpan.FromMinutes(30),SlidingExpiration = true,});

     app.USEOpenIdConnectAuthentication(
       new OpenIdConnectAuthenticationoptions
       {
           ClientId = clientId,MetadataAddress = MetadataAddress,RedirectUri = redirectUri,PostlogoutRedirectUri = postlogoutRedirectUri
       });

问题是如何现在作为Windows身份验证运行 app-a ?有些应用程序对 app-a 进行API调用。它不再工作了。

有没有办法劫持请求并寻找授权属性(WWW-Authenticate:NTLM)并仅在管道中运行某些中间件?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)