8

我正在尝试使用OpenProject OmniAuth SAML 单点登录插件设置与 OpenProject 的 SSO(单点登录)集成。我已经用相关的细节配置了它。生成元数据并将其注册到由 Shibboleth 提供支持的 IDP。该插件确实在 openproject 登录表单上显示了一个额外的登录按钮。单击它会正确重定向到 IDP 的登录页面。提供凭据后,它会正确重定向到我提到的 AssertionConsumerService URL。它的形式是https://example.com/openproject/auth/saml/callback. 但是该页面显示了错误的请求错误。调试文件app/controllers/concerns/omniauth_login.rb显示,在omniauth_login函数内部,以下代码行导致 400 错误。

auth_hash = request.env['omniauth.auth']

return render_400 unless auth_hash.valid?

的值auth_hash看起来是空的。由于属性映射或其他原因,这可能是一个问题吗?我来自 PHP 背景,对 ruby​​ on rails 没有经验。所以很难调试这个问题。我尝试了很多谷歌搜索,但找不到任何有用的东西。

任何帮助是极大的赞赏。

谢谢

4

1 回答 1

1

替换以下代码

uid { @name_id }

使用以下代码

  uid do
        if options.uid_attribute
          ret = find_attribute_by([options.uid_attribute])
          if ret.nil?
            raise OmniAuth::Strategies::SAML::ValidationError.new("SAML response missing '#{options.uid_attribute}' attribute")
          end
          ret
        else
          @name_id
        end
      end

在 - 的里面

策略/saml.rb

文件。它在 def other_phase函数内部

作为参考,请查看以下 github 链接 https://github.com/omniauth/omniauth-saml/blob/master/lib/omniauth/strategies/saml.rb第 90 行

于 2017-09-14T13:39:50.077 回答