OpenProject OmniAuth SAML单点登录集成

ano*_*oop 8 ruby-on-rails saml single-sign-on openproject

我尝试使用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?
Run Code Online (Sandbox Code Playgroud)

的价值auth_hash看起来是空的.由于属性映射或其他原因,这可能是一个问题吗?我来自PHP bacnkground,没有铁轨上的红宝石经验.因此很难调试问题.我已经尝试过谷歌搜索,但找不到任何有用的东西.

任何帮助是极大的赞赏.

谢谢

小智 1

替换以下代码

uid { @name_id }
Run Code Online (Sandbox Code Playgroud)

用下面的代码

  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
Run Code Online (Sandbox Code Playgroud)

在 - 的里面

策略/saml.rb

文件。它在 def other_phase函数内部

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