Commit 89e07185 authored by James Edwards-Jones's avatar James Edwards-Jones

Remove Group SAML beta cookie restriction

parent f1adf825
...@@ -4,14 +4,6 @@ ...@@ -4,14 +4,6 @@
This allows SAML to be used for adding users to a group on GitLab.com and other instances where using [site-wide SAML](../../../integration/saml.md) is not possible. This allows SAML to be used for adding users to a group on GitLab.com and other instances where using [site-wide SAML](../../../integration/saml.md) is not possible.
## Enable the beta
Enable the beta by setting the `enable_group_saml` cookie. This can be done with the below JavaScript snippet:
```javascript
javascript:void((function(d){document.cookie='enable_group_saml=' + (document.cookie.indexOf('enable_group_saml=true') >= 0 ? 'false' : 'true') + ';domain=.' + window.location.hostname + ';path=/;expires=' + new Date(Date.now() + 31536000000).toUTCString(); location.reload();})(document));
```
## How to configure ## How to configure
1. Navigate to the group and click Settings -> SAML SSO. 1. Navigate to the group and click Settings -> SAML SSO.
......
...@@ -3,7 +3,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController ...@@ -3,7 +3,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController
before_action :authorize_manage_saml! before_action :authorize_manage_saml!
before_action :check_group_saml_available! before_action :check_group_saml_available!
before_action :check_group_saml_configured before_action :check_group_saml_configured
before_action :check_group_saml_beta_enabled
def show def show
@saml_provider = @group.saml_provider || @group.build_saml_provider @saml_provider = @group.saml_provider || @group.build_saml_provider
...@@ -35,10 +34,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController ...@@ -35,10 +34,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController
render_404 unless Gitlab::Auth::GroupSaml::Config.enabled? render_404 unless Gitlab::Auth::GroupSaml::Config.enabled?
end end
def check_group_saml_beta_enabled
render_404 unless Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
end
def require_top_level_group def require_top_level_group
render_404 if @group.subgroup? render_404 if @group.subgroup?
end end
......
...@@ -3,7 +3,6 @@ class Groups::SsoController < Groups::ApplicationController ...@@ -3,7 +3,6 @@ class Groups::SsoController < Groups::ApplicationController
before_action :unauthenticated_group before_action :unauthenticated_group
before_action :check_group_saml_configured before_action :check_group_saml_configured
before_action :check_group_saml_available! before_action :check_group_saml_available!
before_action :check_group_saml_beta_enabled
before_action :require_configured_provider before_action :require_configured_provider
before_action :check_user_can_sign_in_with_provider before_action :check_user_can_sign_in_with_provider
before_action :redirect_if_group_moved before_action :redirect_if_group_moved
...@@ -25,10 +24,6 @@ class Groups::SsoController < Groups::ApplicationController ...@@ -25,10 +24,6 @@ class Groups::SsoController < Groups::ApplicationController
route_not_found unless Gitlab::Auth::GroupSaml::Config.enabled? route_not_found unless Gitlab::Auth::GroupSaml::Config.enabled?
end end
def check_group_saml_beta_enabled
route_not_found unless Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
end
def unauthenticated_group def unauthenticated_group
@unauthenticated_group = Group.find_by_full_path(params[:group_id], follow_redirects: true) @unauthenticated_group = Group.find_by_full_path(params[:group_id], follow_redirects: true)
......
module EE module EE
module SamlProvidersHelper module SamlProvidersHelper
def group_saml_enabled? def group_saml_enabled?
group_saml_beta_enabled? && ::Gitlab::Auth::GroupSaml::Config.enabled? ::Gitlab::Auth::GroupSaml::Config.enabled?
end
def group_saml_beta_enabled?
::Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
end end
def show_saml_in_sidebar?(group) def show_saml_in_sidebar?(group)
......
...@@ -6,7 +6,6 @@ describe Groups::SamlProvidersController do ...@@ -6,7 +6,6 @@ describe Groups::SamlProvidersController do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
request.cookies['enable_group_saml'] = 'true'
sign_in(user) sign_in(user)
end end
......
require 'spec_helper' require 'spec_helper'
describe Groups::SsoController do describe Groups::SsoController do
include CookieHelper
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group, :private, name: 'our-group') } let(:group) { create(:group, :private, name: 'our-group') }
let(:enable_group_saml_cookie) { 'true' }
before do before do
request.cookies['enable_group_saml'] = enable_group_saml_cookie
stub_licensed_features(group_saml: true) stub_licensed_features(group_saml: true)
allow(Devise).to receive(:omniauth_providers).and_return(%i(group_saml)) allow(Devise).to receive(:omniauth_providers).and_return(%i(group_saml))
sign_in(user) sign_in(user)
...@@ -29,16 +25,6 @@ describe Groups::SsoController do ...@@ -29,16 +25,6 @@ describe Groups::SsoController do
expect(assigns[:group_name]).to eq 'our-group' expect(assigns[:group_name]).to eq 'our-group'
end end
context 'when beta cookie not set' do
let(:enable_group_saml_cookie) { 'false' }
it 'renders 404' do
get :saml, group_id: group
expect(response).to have_gitlab_http_status(404)
end
end
context 'when user is not signed in' do context 'when user is not signed in' do
it 'acts as route not found' do it 'acts as route not found' do
sign_out(user) sign_out(user)
......
...@@ -8,16 +8,11 @@ feature 'SAML provider settings' do ...@@ -8,16 +8,11 @@ feature 'SAML provider settings' do
let(:callback_path) { "/groups/#{group.path}/-/saml/callback" } let(:callback_path) { "/groups/#{group.path}/-/saml/callback" }
before do before do
set_beta_cookie
stub_config_setting(url: 'https://localhost') stub_config_setting(url: 'https://localhost')
stub_saml_config stub_saml_config
group.add_owner(user) group.add_owner(user)
end end
def set_beta_cookie
set_cookie('enable_group_saml', 'true')
end
def submit def submit
click_button('Save changes') click_button('Save changes')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment