0

I am trying to figure out how to add CAS authentication to Refinery. The best arrangement I have found so far is to use devise_cas_authenticatable.

I used rake refinery:override model=user and replaced :database_authenticatable:

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

But I can't find where to set the CAS configuration values, e.g.:

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

Does anyone know if there is an existing initializer where this belongs? Also, any thoughts on the task of making Refinery work with CAS would be helpful. Thanks!

Jay
  • 2,861
  • 3
  • 29
  • 51

1 Answers1

0

Set the CAS configuration values in a Rails initializer, e.g.

$ 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
qnm
  • 521
  • 3
  • 14