diff --git a/Gemfile b/Gemfile index 65816b9a83393946cc82206eafe73f0ee15f812d..cc3d93e3db9dd8d5fc406d811c1cd17868833a06 100644 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,7 @@ gem 'omniauth-azure-activedirectory-v2', '~> 1.0' gem 'omniauth-azure-oauth2', '~> 0.0.9' # Deprecated v1 version gem 'omniauth-cas3', '~> 1.1.4' gem 'omniauth-dingtalk-oauth2', '~> 1.0' +gem 'omniauth-alicloud', '~> 1.0.1' gem 'omniauth-facebook', '~> 4.0.0' gem 'omniauth-github', '~> 1.4' gem 'omniauth-gitlab', '~> 1.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index dae55ebb0fd372c666433981a130f437eee14cdc..e53370f4ad757beec96533f12f610075074cfddb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -829,6 +829,8 @@ GEM omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) + omniauth-alicloud (1.0.1) + omniauth-oauth2 (~> 1.7.1) omniauth-atlassian-oauth2 (0.2.0) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.5) @@ -1570,6 +1572,7 @@ DEPENDENCIES ohai (~> 16.10) oj (~> 3.10.6) omniauth (~> 1.8) + omniauth-alicloud (~> 1.0.1) omniauth-atlassian-oauth2 (~> 0.2.0) omniauth-auth0 (~> 2.0.0) omniauth-authentiq (~> 0.3.3) diff --git a/app/assets/images/auth_buttons/alicloud_64.png b/app/assets/images/auth_buttons/alicloud_64.png new file mode 100644 index 0000000000000000000000000000000000000000..bd67a199e130369663ecf94cac649707c5e2dfe1 Binary files /dev/null and b/app/assets/images/auth_buttons/alicloud_64.png differ diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index ba6c0380edf4078ffa9a59c10ddf7f924a336fee..6ac4a12bcd5c1a137e3b3702a9e9baebc5f61fd4 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -2,6 +2,7 @@ module AuthHelper PROVIDERS_WITH_ICONS = %w( + alicloud atlassian_oauth2 auth0 authentiq diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 9ea6944de0213f34fc86056ea53bfaee7dbf3aea..57106120fb2aba663bf77cacbc9542976e6f44b7 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -1035,6 +1035,9 @@ production: &base # arguments, followed by optional 'args' which can be either a hash or an array. # Documentation for this is available at http://doc.gitlab.com/ce/integration/omniauth.html providers: + # - { name: 'alicloud', + # app_id: 'YOUR_APP_ID', + # app_secret: 'YOUR_APP_SECRET' } # See omniauth-cas3 for more configuration details # - { name: 'cas3', # label: 'cas3', @@ -1562,6 +1565,9 @@ test: external_providers: [] providers: + - { name: 'alicloud', + app_id: 'YOUR_APP_ID', + app_secret: 'YOUR_APP_SECRET' } - { name: 'cas3', label: 'cas3', args: { url: 'https://sso.example.com', diff --git a/lib/gitlab/auth/o_auth/provider.rb b/lib/gitlab/auth/o_auth/provider.rb index 41a8739b0b634b96b17d9563a62b312b64611f1d..1a25ed10d81bdf78d77034001945c0e6da7a3ea3 100644 --- a/lib/gitlab/auth/o_auth/provider.rb +++ b/lib/gitlab/auth/o_auth/provider.rb @@ -5,6 +5,7 @@ module Auth module OAuth class Provider LABELS = { + "alicloud" => "AliCloud", "dingtalk" => "DingTalk", "github" => "GitHub", "gitlab" => "GitLab.com", diff --git a/spec/controllers/profiles/accounts_controller_spec.rb b/spec/controllers/profiles/accounts_controller_spec.rb index 011528016ce59588f49541dffd5a6e7d9e751ef7..1b4b67eeaff6520be66731a8cbdba2ff0baf6f6d 100644 --- a/spec/controllers/profiles/accounts_controller_spec.rb +++ b/spec/controllers/profiles/accounts_controller_spec.rb @@ -31,7 +31,7 @@ end end - [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0, :authentiq, :dingtalk].each do |provider| + [:twitter, :facebook, :google_oauth2, :gitlab, :github, :bitbucket, :crowd, :auth0, :authentiq, :dingtalk, :alicloud].each do |provider| describe "#{provider} provider" do let(:user) { create(:omniauth_user, provider: provider.to_s) } diff --git a/spec/features/oauth_login_spec.rb b/spec/features/oauth_login_spec.rb index 93674057fed68ed6ba0eb39694a66c15d9560b15..ea5bb8c33b2cb4e80ba432f19ef9ffb87a949dd2 100644 --- a/spec/features/oauth_login_spec.rb +++ b/spec/features/oauth_login_spec.rb @@ -16,7 +16,7 @@ def stub_omniauth_config(provider) end providers = [:github, :twitter, :bitbucket, :gitlab, :google_oauth2, - :facebook, :cas3, :auth0, :authentiq, :salesforce, :dingtalk] + :facebook, :cas3, :auth0, :authentiq, :salesforce, :dingtalk, :alicloud] around do |example| with_omniauth_full_host { example.run }