【问题标题】:404 error for /saml2/idp/ after upgrading Kentor.AuthServices to Sustainsys.Saml2将 Kentor.AuthServices 升级到 Sustainsys.Saml2 后 /saml2/idp/ 出现 404 错误
【发布时间】:2019-01-15 09:07:00
【问题描述】:

与 Kentor.AuthServices.Owin 0.18.0 和通常此流量日志一起工作。

200 GET https://some-saml2-idp.com/saml2/idp/SSO_1..39%3D&RelayState=Os..j
302 POST https://demo.local/AuthServices/Acs
200 GET for the set RedirectUri

升级到 Sustainsys.Saml2.Owin 2.2.0 后,我收到此流量日志...

200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f5..sy%2Fh9rebTw%3D%3D&RelayState=1M..3c
302 POST https://demo.local/AuthServices/Acs
303 GET https://demo.local/login?error=access_denied
200 GET https://some-saml2-idp.com/saml2/idp/SSO_1a7f..NfLr6E299uPwE%3D&RelayState=cS..L
302 POST https://demo.local/AuthServices/Acs
404 GET https://demo.local/saml2/idp/SSO_1..39?SAMLRequest=hZ..bTw==&RelayState=1M..c&error=access_denied

我尝试过清除所有地方的 cookie,并试图找到任何负责错误或错误参数的“自己的”代码。

如果我可以在不改变 IDP 方面的任何内容的情况下让我的两个分支机构都工作,我会更愿意。

我的 Web.config 具有以下结构...

<sustainsys.saml2 entityId="https://demo.local/AuthServices"
        returnUrl="https://demo.local"
        publicOrigin="https://demo.local"
        modulePath="/AuthServices">
    <serviceCertificates>
        <add fileName="~/somename.pfx"
            use="Signing" />
    </serviceCertificates>
    <identityProviders>
        <add entityId="My-IDP"
            allowUnsolicitedAuthnResponse="true"
            loadMetadata="true"
            metadataLocation="https://some-saml2-idp.com/metadata" />
    </identityProviders>
</sustainsys.saml2>

还有我的 Owin 创业公司……

var defaultSignInAsAuthType = "Cookies";

app.SetDefaultSignInAsAuthenticationType(defaultSignInAsAuthType);

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    AuthenticationType = defaultSignInAsAuthType,
    ReturnUrlParameter  = "returnUrl",
    LoginPath = new PathString("/login"),
    LogoutPath = new PathString("/logout")
});

var saml2Options = new Saml2AuthenticationOptions(true);
app.UseSaml2Authentication(saml2Options);
app.UseStageMarker(PipelineStage.Authenticate);

AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.Name;

为了模仿旧包设置的行为,我缺少什么?

【问题讨论】:

  • 看起来第一次访问 /AuthServices/Acs 会导致某种错误。请启用 katana 日志记录,看看是否有任何信息。
  • 啊,谢谢。在添加 minIncomingSigningAlgorithm="w3.org/2000/09/xmldsig#rsa-sha1" 作为日志显示我时得到了进一步的结果。
  • 是的,这是另一个已更改的默认设置(从安全角度来看更好)现在可以使用吗?在这种情况下,我会将其添加为下一个有相同问题的人的问题的答案。
  • 是的!在那之后并添加一个触发我的 ClaimsAuthenticationManager 的 HttpModule 我回到了与我希望的旧设置相同的状态。还将 .NET Framework 升级到 4.7.2 和解决方案中的许多包。
  • 好 - 我总结了一个答案。请检查 HttpModule - 你在做一些奇怪的事情。使用 AcsCommandResultCreated 通知而不是 ClaimsAuthenticationManager。

标签: owin sustainsys-saml2


【解决方案1】:

这些版本之间存在许多可能引发问题的重大更改。

Katana 日志记录将包含错误消息。一些相关的事情是:

  1. 现在默认接受的最小传入签名算法是 SHA-256。可以通过minIncomingSigninAlgorithm config 设置。
  2. 模块路径(所有端点的基本路径)现在默认为/Saml2,而不是/AuthServices。在问题中,它已正确配置为 /AuthServices 以向后兼容。
  3. ClaimsAuthenticationManager 在 2.X 上不再受支持,因为它不再使用 System.IdentityModel 令牌处理程序。请改用AcsCommandResultCreated 通知来修改创建的身份。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-07
    • 2020-01-19
    • 2014-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多