0

我试图弄清楚如何将 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

有谁知道它所属的现有初始化程序是否存在?此外,有关使 Refinery 与 CAS 合作的任务的任何想法都会有所帮助。谢谢!

4

1 回答 1

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
于 2013-01-13T23:39:13.907 回答