炼油厂CMS + devise_cas_authenticatable

时间:2012-05-25 09:55:47

标签: ruby-on-rails devise refinerycms

我想弄清楚如何向Refinery添加CAS身份验证。到目前为止,我发现的最佳安排是使用devise_cas_authenticatable

我使用了rake refinery:override model=user并替换了:database_authenticatable

# /app/models/refinery/user.rb
if self.respond_to?(:devise)
  devise :cas_authenticatable, ...
end

但我无法找到设置CAS配置值的位置,例如:

Devise.setup do |config|
  ...
  config.cas_base_url = "https://cas.myorganization.com"
  ...
end

有没有人知道这是否属于现有的初始化程序?此外,任何关于使炼油厂与CAS合作的任何想法都会有所帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

在Rails初始化程序中设置CAS配置值,例如

$ cat config/initializers/devise.rb

Devise.setup do |config|
  config.cas_base_url = "https://cas.myorganization.com"

  # you can override these if you need to, but cas_base_url is usually enough
  # config.cas_login_url = "https://cas.myorganization.com/login"
  # config.cas_logout_url = "https://cas.myorganization.com/logout"
  # config.cas_validate_url = "https://cas.myorganization.com/serviceValidate"

  # The CAS specification allows for the passing of a follow URL to be displayed when
  # a user logs out on the CAS server. RubyCAS-Server also supports redirecting to a
  # URL via the destination param. Set either of these urls and specify either nil,
  # 'destination' or 'follow' as the logout_url_param. If the urls are blank but
  # logout_url_param is set, a default will be detected for the service.
  # config.cas_destination_url = 'https://cas.myorganization.com'
  # config.cas_follow_url = 'https://cas.myorganization.com'
  # config.cas_logout_url_param = nil

  # By default, devise_cas_authenticatable will create users.  If you would rather
  # require user records to already exist locally before they can authenticate via
  # CAS, uncomment the following line.
  # config.cas_create_user = false  
end