简体   繁体   English

ACS 不处理子应用程序中的 SAML 响应

[英]ACS doesn't process SAML response in a sub-application

I'm struggling to find the cause of this behavior.我正在努力寻找这种行为的原因。 I have a simple MVC application with the SustainSys package configured.我有一个配置了 SustainSys 包的简单 MVC 应用程序。 I've tried configuring it for both our internal SecureAuth server and also the https://stubidp.sustainsys.com test server.我已经尝试为我们的内部 SecureAuth 服务器和https://stubidp.sustainsys.com测试服务器配置它。

It all works on localhost and when it's the root application of our internal IIS server.当它是我们内部 IIS 服务器的根应用程序时,这一切都适用于 localhost。

When I place it in an IIS sub-application folder, it redirects to the sso server login, comes back to the ~/Saml2/Acs route with the authentication info (I see it in fiddler2), but the Acs doesn't seem to process it at that point and I remain unauthenticated and therefore it heads back to the login page and I start looping.当我将它放在 IIS 子应用程序文件夹中时,它会重定向到 sso 服务器登录名,返回到带有身份验证信息的 ~/Saml2/Acs 路由(我在 fiddler2 中看到它),但 Acs 似乎没有在那一点处理它,我仍然未经身份验证,因此它返回到登录页面,我开始循环。

I'm aware of sub-app web.config inheritance, so I've even removed the web.config from the root so nothing is conflicting with the one in the sub-app.我知道子应用程序的 web.config 继承,所以我什至从根目录中删除了 web.config,所以没有任何与子应用程序中的冲突。 I've played with the returnURL parameter to no effect (with or without sudirectory included).我使用 returnURL 参数无效(包括或不包括 sudirectory)。

The applications in IIS (root and sub-app) are configured the same for authentication. IIS 中的应用程序(根应用程序和子应用程序)的身份验证配置相同。

I'm running out of ideas to test.我已经没有想法可以测试了。 Anyone have any thoughts?有人有什么想法吗?

<sustainsys.saml2 entityId="https://apps.xxxxx.com" returnUrl="https://apps.xxxxx.com/yyyyy">
    <identityProviders>
        <add entityId="https://sso.xxxxx.com/SecureAuthXX" signOnUrl="https://sso.xxxxx.com/SecureAuthXX" allowUnsolicitedAuthnResponse="true" binding="HttpRedirect">
            <signingCertificate fileName="~/App_Data/SecureAuth03VM.xxxxx.com.cer" />
        </add>
    </identityProviders>
    <federations>
        <add metadataLocation="https://apps.xxxxx.com/Federation" allowUnsolicitedAuthnResponse="true" />
    </federations>
</sustainsys.saml2>
<system.identityModel.services>
    <federationConfiguration>
        <cookieHandler requireSsl="true" name="CookieAuth" />
    </federationConfiguration>
</system.identityModel.services>

I solved the problem and I wanted to post what fixed it as maybe it might help someone else one day.我解决了这个问题,我想发布修复它的内容,因为也许有一天它可能会帮助其他人。

The issue was not with the SAML response or the Sustainsys library, but rather an attribute missing the from the web.config.问题不在于 SAML 响应或 Sustainsys 库,而在于 web.config 中缺少 的属性。 After adding "path='/'" to the cookiehandler element in the federation configuration (see below), it begin persisting the authorization state in the System.Security.Principal and now works perfectly in the root application as well as all sub-applications.将“path='/'”添加到联合配置中的 cookiehandler 元素后(见下文),它开始在 System.Security.Principal 中持久化授权状态,现在在根应用程序以及所有子应用程序中完美运行.

<system.identityModel.services>
    <federationConfiguration>
        <cookieHandler requireSsl="true" name="FedAuth" path="/" />
    </federationConfiguration>
</system.identityModel.services>

There are two steps where <edit>I thought</edit> this could go wrong: <edit>我认为</edit>这可能会出错有两个步骤:

  1. The Acs Url in the genereated AuthnRequest is incorrect.生成的 AuthnRequest 中的 Acs Url 不正确。 Please check the displayed XML content on the StubIdp to see if it correctly reflects the sub-application directory.请检查 StubIdp 上显示的 XML 内容,看看它是否正确反映了子应用程序目录。 If not, this is a bug/missing feature in the Sustainsys.Saml2.Mvc package.如果没有,这是 Sustainsys.Saml2.Mvc 包中的一个错误/缺失功能。
  2. The application does not correctly invoke the MVC controller embedded in the Sustainsys.Mvc package when deployed to a sub directory.部署到子目录时,应用程序无法正确调用嵌入在 Sustainsys.Mvc 包中的 MVC 控制器。 You can test this by hitting http://yoursite.com/SubDir/Saml2 - if it works it should return the metadata XML.您可以通过点击http://yoursite.com/SubDir/Saml2来测试它 - 如果它有效,它应该返回元数据 XML。 If this is the case, you need to review the route configuration in your application to ensure that the path is correctly routed to the controller in the MVC package.如果是这种情况,您需要检查应用程序中的路由配置,以确保路径正确路由到 MVC 包中的控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM