Rails – Onelogin ruby​​-saml集成问题

我在Rails应用程序中使用 ruby-saml时遇到了问题.我是 Ruby世界的新手.

here开始,我知道我可以使用ruby-saml工具包进行SAML SP.

现在,当我试图在我的控制器中引用OneLogin时(如下所示),我收到错误“未初始化的常量Onelogin :: Saml”.

OneLogin::RubySaml::Authrequest.new

当我尝试在控制器中包含以下行时,我会遇到不同的错误.

require 'onelogin/saml'
or
require 'onelogin/ruby-saml'

得到错误,

cannot load such file -- onelogin/saml
or
cannot load such file -- onelogin/ruby-saml

我安装了gem ruby​​-saml,我也在我的rails应用程序的GemFile中包含了它,并运行了bundle install.

[root@localhost SP]# bundle show ruby-saml  
/usr/local/rvm/gems/ruby-2.1.1/gems/ruby-saml-0.8.1  
[root@localhost SP]#

我的控制器:

#require 'onelogin/saml'

require 'onelogin/ruby-saml'

class SamlController < ApplicationController
  skip_before_filter :verify_authenticity_token,:only => [:consume]  

  def index
    #settings = Account.get_saml_settings
    settings = :get_saml_settings
    request = Onelogin::Saml::Authrequest.new
    redirect_to(request.create(settings))
  end

  def consume
    response = Onelogin::Saml::Response.new(params[:SAMLResponse])
    response.settings = Account.get_saml_settings

    logger.info "NAMEID: #{response.name_id}"

    if response.is_valid?
      session[:userid] = response.name_id
      redirect_to :action => :complete
    else
      redirect_to :action => :fail
    end
  end

  def complete
  end

  def fail
  end

def get_saml_settings
end

end

我不确定我错过了什么.思考?

解决方法

我认为声明应该是这样的:OneLogin :: RubySaml根据源代码.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...