使用 HTTP 重定向绑定时 URI 无效
Invalid URI while using HTTP Redirect Binding
我们正在使用 HTTP 重定向绑定 使用 omniauth-saml gem 提供 SAML 身份验证。出于测试目的,我们在 windows 实例中配置了 ADFS,并为登录页面创建了 URL。
我们可以通过直接点击浏览器中的 URL 使用一些凭据登录。
但是当我们使用 omniauth-saml gem 提供 HTTP 重定向绑定 时,它会显示 "Invalid 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 URL:
这是 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 使用自签名证书。但我不认为这应该是问题,因为日志没有显示与证书相关的错误。
最后,我能够通过更新依赖方信任的 "Relying Party Identifier" 类似于 "Display Name" 的名称来解决问题。
这里是 link 了解更多信息:https://kb.informatica.com/ipssolution/1/Pages/1/513730.aspx
我们正在使用 HTTP 重定向绑定 使用 omniauth-saml gem 提供 SAML 身份验证。出于测试目的,我们在 windows 实例中配置了 ADFS,并为登录页面创建了 URL。
我们可以通过直接点击浏览器中的 URL 使用一些凭据登录。
但是当我们使用 omniauth-saml gem 提供 HTTP 重定向绑定 时,它会显示 "Invalid 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 URL:
这是 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 使用自签名证书。但我不认为这应该是问题,因为日志没有显示与证书相关的错误。
最后,我能够通过更新依赖方信任的 "Relying Party Identifier" 类似于 "Display Name" 的名称来解决问题。
这里是 link 了解更多信息:https://kb.informatica.com/ipssolution/1/Pages/1/513730.aspx