Sha256: c3656cebbe138a49b8b4f2b1b58521207161aff9a948c739abc5d2dcc0f8eab6

Contents?: true

Size: 1.89 KB

Versions: 4

Compression:

Stored size: 1.89 KB

Contents

############################################################
# Load credentials from config/credentials.yml
############################################################

credentials_file = Rails.root.join('config/credentials.yml')
credentials = File.exists?(credentials_file) ? YAML.load_file(credentials_file) : {}

############################################################
# UCB::LDAP
############################################################

UCB::LDAP.host = 'nds.berkeley.edu'
ldap_credentials = credentials["ldap"] || credentials[Rails.env].try(:[], "ldap")
UCB::LDAP.authenticate(ldap_credentials['username'], ldap_credentials['password']) if ldap_credentials

############################################################
# OmniAuth
############################################################

Rails.application.config.middleware.use OmniAuth::Builder do
  provider(:developer, fields: [:uid], uid_field: :uid) unless RailsEnvironment.production?
  
  cas_host = RailsEnvironment.production? ? 'auth.berkeley.edu/cas' : 'auth-test.berkeley.edu/cas'
  provider :cas, host: cas_host
end

UcbRails.config do |config|
  
  #########################################################
  # manage login authorization, current user, etc.
  #########################################################

  # config.user_session_manager = "UcbRails::UserSessionManager::InPeopleOu"
  # config.user_session_manager = "UcbRails::UserSessionManager::InPeopleOuAddToUsersTable"
  config.user_session_manager = "UcbRails::UserSessionManager::ActiveInUserTable"
  # config.user_session_manager = "UcbRails::UserSessionManager::AdminInUserTable"
  
  #########################################################
  # omniauth authentication provider
  #########################################################

  config.omniauth_provider = :cas        # goes to CalNet
  # config.omniauth_provider = :developer  # Users test ldap entries
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ucb_rails-0.0.5 lib/generators/ucb_rails/templates/config/initializers/local/ucb_rails.rb
ucb_rails-0.0.4 lib/generators/ucb_rails/templates/config/initializers/local/ucb_rails.rb
ucb_rails-0.0.3 lib/generators/ucb_rails/templates/config/initializers/local/ucb_rails.rb
ucb_rails-0.0.2 lib/generators/ucb_rails/templates/config/initializers/local/ucb_rails.rb