首页 > 解决方案 > 使用 HTTP 重定向绑定时 URI 无效

问题描述

我们正在使用HTTP 重定向绑定来提供 SAML 身份验证,使用 omniauth-saml gem。出于测试目的,我们在 windows 实例中配置了 ADFS,并为登录页面创建了一个 URL。

我们可以通过直接在浏览器中点击 URL 来使用一些凭据登录。

但是当我们使用 omniauth-saml gem 提供HTTP 重定向绑定时,它会显示“无效 URI”错误。这是错误回溯:

System.UriFormatException: Invalid URI: The format of the URI could not be determined.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
   at Microsoft.IdentityServer.Web.Protocols.Saml.SamlSignInContext.ValidateCore()
   at Microsoft.IdentityServer.Web.Protocols.ProtocolContext.Validate()
   at Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.GetRequiredPipelineBehaviors(ProtocolContext pContext)
   at Microsoft.IdentityServer.Web.PassiveProtocolListener.EvaluateHomeRealm(PassiveProtocolHandler protocolHandler, ProtocolContext protocolContext)
   at Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext context)

这是 SAML 网址:

https://ads.DOMAIN.com/adfs/ls/idpinitiatedSignOn.aspx?SAMLRequest=fZHBbsIwEER%2FJTefEjtpwMEiSFG5oFJVAsqhl8pxXLDi2KnXRnx%2BHVAleulxtDNPs7tL4IMeWRP82ezkd5DgkwZAOq%2BsebYGwiDdXrqLEvJ9t63R2fuRYSzFjNCuzDNzcrbPlMUhhgDzCMITEwuudctFj5J1hCrDJ%2BI9DxHAO8h6sPoiIRN2iPoLsAasulEZ5RX3sturk3kzGYfxipLNukafdJ7n7YyWKVks8rRsiUx5O6%2FSednmtGwFoQWNVoAgNwY8N75GBcmrlFRpUR0IZU8FK2YfKDnGtrdCRUZQch20ATb1rlFwhlkOCpjhgwTmBds3r1sWjYz%2FnuYxMv6fGZ31VliNVsvJzW7t3OrlvvzBBfBL%2FDi5q79PWf0

这是 Omniauth SAML 配置:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :saml,
    :assertion_consumer_service_url     => "https://www.google.com", # Tried some more callback URLs as well
    :issuer                             => "MyTrust",
    :idp_sso_target_url                 =>  "https://ads.DOMAIN.com/adfs/ls/idpinitiatedSignOn.aspx",
    :idp_cert                           => '-----BEGIN CERTIFICATE-----
MIIDBzCCAe+gAwIBAgIJAIuOuO5YI79hMA0GCSqGSIb3DQEBBQUAMBoxGDAWBgNV
BAMMD2Fkcy5rc29s.........
-----END CERTIFICATE-----'
end

此外,我们正在为 ADFS 使用自签名证书。但我认为这不应该是问题,因为日志没有显示与证书相关的错误。

标签: rubysamlomniauthadfs

解决方案


Atlast,我可以通过更新类似于依赖方信任的“显示名称”的“依赖方标识符”名称来解决问题。

以下是更多信息的链接:https ://kb.informatica.com/ipssolution/1/Pages/1/513730.aspx


推荐阅读