diff --git a/Gemfile b/Gemfile
index 9466727bd29..c87b63d9e87 100644
--- a/Gemfile
+++ b/Gemfile
@@ -114,7 +114,6 @@ gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-github'
gem 'omniauth-oauth2', require: false
-gem 'omniauth-cas'
gem 'oj'
# while resolving https://groups.google.com/forum/#!topic/ruby-pg/5_ylGmog1S4
gem 'pg', '0.15.1'
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index b00b3578960..ad5c2be4db4 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -10,8 +10,7 @@ class Users::OmniauthCallbacksController < ApplicationController
Auth::OpenIdAuthenticator.new("google", "https://www.google.com/accounts/o8/id", trusted: true),
Auth::OpenIdAuthenticator.new("yahoo", "https://me.yahoo.com", trusted: true),
Auth::GithubAuthenticator.new,
- Auth::TwitterAuthenticator.new,
- Auth::CasAuthenticator.new
+ Auth::TwitterAuthenticator.new
]
skip_before_filter :redirect_to_login_if_required
diff --git a/app/models/cas_user_info.rb b/app/models/cas_user_info.rb
deleted file mode 100644
index 2366e3e3dab..00000000000
--- a/app/models/cas_user_info.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-class CasUserInfo < ActiveRecord::Base
- belongs_to :user
-end
-
-# == Schema Information
-#
-# Table name: cas_user_infos
-#
-# id :integer not null, primary key
-# user_id :integer not null
-# cas_user_id :string(255) not null
-# username :string(255) not null
-# first_name :string(255)
-# last_name :string(255)
-# email :string(255)
-# gender :string(255)
-# name :string(255)
-# link :string(255)
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-# Indexes
-#
-# index_cas_user_infos_on_cas_user_id (cas_user_id) UNIQUE
-# index_cas_user_infos_on_user_id (user_id) UNIQUE
-#
-
diff --git a/app/models/user.rb b/app/models/user.rb
index 540a320806f..3f06f1156a0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -35,7 +35,6 @@ class User < ActiveRecord::Base
has_one :facebook_user_info, dependent: :destroy
has_one :twitter_user_info, dependent: :destroy
has_one :github_user_info, dependent: :destroy
- has_one :cas_user_info, dependent: :destroy
has_one :oauth2_user_info, dependent: :destroy
has_one :user_stat, dependent: :destroy
belongs_to :approved_by, class_name: 'User'
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 8a05f493daa..eae213f98bd 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -478,9 +478,6 @@ en:
facebook:
title: "with Facebook"
message: "Authenticating with Facebook (make sure pop up blockers are not enabled)"
- cas:
- title: "Log In with CAS"
- message: "Authenticating with CAS (make sure pop up blockers are not enabled)"
yahoo:
title: "with Yahoo"
message: "Authenticating with Yahoo (make sure pop up blockers are not enabled)"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index cc63edff0df..7894fb35365 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -482,7 +482,6 @@ en:
queue_size_warning: 'The number of queued jobs is %{queue_size}, which is high. This could indicate a problem with the Sidekiq process(es), or you may need to add more Sidekiq workers.'
memory_warning: 'Your server is running with less than 1 GB of total memory. At least 1 GB of memory is recommended.'
facebook_config_warning: 'The server is configured to allow signup and log in with Facebook (enable_facebook_logins), but the app id and app secret values are not set. Go to the Site Settings and update the settings. See this guide to learn more.'
- cas_config_warning: 'The server is configured to allow signup and log in with CAS (enable_cas_logins), but the hostname and domain name values are not set.'
twitter_config_warning: 'The server is configured to allow signup and log in with Twitter (enable_twitter_logins), but the key and secret values are not set. Go to the Site Settings and update the settings. See this guide to learn more.'
github_config_warning: 'The server is configured to allow signup and log in with GitHub (enable_github_logins), but the client id and secret values are not set. Go to the Site Settings and update the settings. See this guide to learn more.'
s3_config_warning: 'The server is configured to upload files to s3, but at least one the following setting is not set: s3_access_key_id, s3_secret_access_key or s3_upload_bucket. Go to the Site Settings and update the settings. See "How to set up image uploads to S3?" to learn more.'
@@ -675,10 +674,6 @@ en:
facebook_app_id: "App id for Facebook authentication, registered at https://developers.facebook.com/apps"
facebook_app_secret: "App secret for Facebook authentication, registered at https://developers.facebook.com/apps"
- enable_cas_logins: "Enable CAS authentication"
- cas_hostname: "Hostname for cas server"
- cas_domainname: "Domain name generated email addresses for cas server"
-
enable_github_logins: "Enable Github authentication, requires github_client_id and github_client_secret"
github_client_id: "Client id for Github authentication, registered at https://github.com/settings/applications"
github_client_secret: "Client secret for Github authentication, registered at https://github.com/settings/applications"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index eed6fa01e35..33c6190b1e2 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -103,11 +103,6 @@ users:
default: true
facebook_app_id: ''
facebook_app_secret: ''
- enable_cas_logins:
- client: true
- default: false
- cas_hostname: ''
- cas_domainname: ''
enable_github_logins:
client: true
default: false
diff --git a/db/migrate/20140211230222_move_cas_settings.rb b/db/migrate/20140211230222_move_cas_settings.rb
new file mode 100644
index 00000000000..dc21545419c
--- /dev/null
+++ b/db/migrate/20140211230222_move_cas_settings.rb
@@ -0,0 +1,36 @@
+class MoveCasSettings < ActiveRecord::Migration
+ def change
+ #As part of removing the build in CAS authentication we should
+ #convert the data over to be used by the plugin.
+ cas_hostname = SiteSetting.where(name: 'cas_hostname').first
+ cas_sso_hostname = SiteSetting.where(name: 'cas_sso_hostname').first
+ if cas_hostname && ! cas_sso_hostname
+ #convert the setting over for use by the plugin
+ cas_hostname.update_attribute(:name, 'cas_sso_hostname')
+ elsif cas_hostname && cas_sso_hostname
+ #copy the setting over for use by the plugin and delete the original setting
+ cas_sso_hostname.update_attribute(:value,cas_hostname.value)
+ cas_hostname.destroy
+ end
+
+ cas_domainname = SiteSetting.where(name: 'cas_domainname').first
+ cas_sso_email_domain = SiteSetting.where(name: 'cas_sso_email_domain').first
+ if cas_domainname && ! cas_sso_email_domain
+ #convert the setting over for use by the plugin
+ cas_domainname.update_attribute(:name, 'cas_sso_email_domain')
+ elsif cas_domainname && cas_sso_email_domain
+ #copy the setting over for use by the plugin and delete the original setting
+ cas_sso_email_domain.update_attribute(:value,cas_domainname.value)
+ cas_domainname.destroy
+ end
+
+ cas_logins = SiteSetting.where(name: 'cas_logins').first
+ if cas_logins
+ cas_logins.destroy
+ end
+
+ #remove the unused table
+ drop_table :cas_user_infos
+
+ end
+end
diff --git a/lib/auth.rb b/lib/auth.rb
index 10a8bd272de..3acb5891a12 100644
--- a/lib/auth.rb
+++ b/lib/auth.rb
@@ -6,4 +6,3 @@ require_dependency 'auth/facebook_authenticator'
require_dependency 'auth/open_id_authenticator'
require_dependency 'auth/github_authenticator'
require_dependency 'auth/twitter_authenticator'
-require_dependency 'auth/cas_authenticator'
diff --git a/lib/auth/cas_authenticator.rb b/lib/auth/cas_authenticator.rb
deleted file mode 100644
index 3c9fc4f46ec..00000000000
--- a/lib/auth/cas_authenticator.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-class Auth::CasAuthenticator < Auth::Authenticator
-
- def name
- 'cas'
- end
-
- def after_authenticate(auth_token)
- result = Auth::Result.new
-
- email = auth_token[:info][:email] if auth_token[:info]
- email ||= if SiteSetting.cas_domainname.present?
- "#{auth_token[:extra][:user]}@#{SiteSetting.cas_domainname}"
- else
- auth_token[:extra][:user]
- end
-
- result.email = email
- result.email_valid = true
-
- result.username = username = auth_token[:extra][:user]
-
- result.name = name = if auth_token[:info] && auth_token[:info][:name]
- auth_token[:info][:name]
- else
- auth_token["uid"]
- end
-
- cas_user_id = auth_token["uid"]
-
- result.extra_data = {
- cas_user_id: cas_user_id
- }
-
- user_info = CasUserInfo.where(:cas_user_id => cas_user_id ).first
-
- result.user = user_info.try(:user)
- result.user ||= User.where(email: email).first
- # TODO, create CAS record ?
-
- result
- end
-
- def register_middleware(omniauth)
- omniauth.provider :cas,
- :host => SiteSetting.cas_hostname
- end
-end
diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb
index 8888a8cb339..27f274589b5 100644
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -216,7 +216,7 @@ class Plugin::Instance
spec = Gem::Specification.load spec_file
spec.activate
unless opts[:require] == false
- require name
+ require opts[:require_name] ? opts[:require_name] : name
end
else
puts "You are specifying the gem #{name} in #{path}, however it does not exist!"
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 8a6b2e4251e..656a8791d9a 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -24,7 +24,6 @@ describe User do
it { should have_one(:facebook_user_info).dependent(:destroy) }
it { should have_one(:twitter_user_info).dependent(:destroy) }
it { should have_one(:github_user_info).dependent(:destroy) }
- it { should have_one(:cas_user_info).dependent(:destroy) }
it { should have_one(:oauth2_user_info).dependent(:destroy) }
it { should have_one(:user_stat).dependent(:destroy) }
it { should belong_to(:approved_by) }