Commit 27e4d45b authored by Douwe Maan's avatar Douwe Maan

Merge branch 'jej/remove-group-saml-cookie-restriction' into 'master'

Remove Group SAML beta cookie restriction

See merge request gitlab-org/gitlab-ee!6126
parents 59225872 89e07185
......@@ -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.
## 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
1. Navigate to the group and click Settings -> SAML SSO.
......
......@@ -3,7 +3,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController
before_action :authorize_manage_saml!
before_action :check_group_saml_available!
before_action :check_group_saml_configured
before_action :check_group_saml_beta_enabled
def show
@saml_provider = @group.saml_provider || @group.build_saml_provider
......@@ -35,10 +34,6 @@ class Groups::SamlProvidersController < Groups::ApplicationController
render_404 unless Gitlab::Auth::GroupSaml::Config.enabled?
end
def check_group_saml_beta_enabled
render_404 unless Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
end
def require_top_level_group
render_404 if @group.subgroup?
end
......
......@@ -3,7 +3,6 @@ class Groups::SsoController < Groups::ApplicationController
before_action :unauthenticated_group
before_action :check_group_saml_configured
before_action :check_group_saml_available!
before_action :check_group_saml_beta_enabled
before_action :require_configured_provider
before_action :check_user_can_sign_in_with_provider
before_action :redirect_if_group_moved
......@@ -25,10 +24,6 @@ class Groups::SsoController < Groups::ApplicationController
route_not_found unless Gitlab::Auth::GroupSaml::Config.enabled?
end
def check_group_saml_beta_enabled
route_not_found unless Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
end
def unauthenticated_group
@unauthenticated_group = Group.find_by_full_path(params[:group_id], follow_redirects: true)
......
module EE
module SamlProvidersHelper
def group_saml_enabled?
group_saml_beta_enabled? && ::Gitlab::Auth::GroupSaml::Config.enabled?
end
def group_saml_beta_enabled?
::Gitlab::Utils.to_boolean(cookies['enable_group_saml'])
::Gitlab::Auth::GroupSaml::Config.enabled?
end
def show_saml_in_sidebar?(group)
......
......@@ -6,7 +6,6 @@ describe Groups::SamlProvidersController do
let(:user) { create(:user) }
before do
request.cookies['enable_group_saml'] = 'true'
sign_in(user)
end
......
require 'spec_helper'
describe Groups::SsoController do
include CookieHelper
let(:user) { create(:user) }
let(:group) { create(:group, :private, name: 'our-group') }
let(:enable_group_saml_cookie) { 'true' }
before do
request.cookies['enable_group_saml'] = enable_group_saml_cookie
stub_licensed_features(group_saml: true)
allow(Devise).to receive(:omniauth_providers).and_return(%i(group_saml))
sign_in(user)
......@@ -29,16 +25,6 @@ describe Groups::SsoController do
expect(assigns[:group_name]).to eq 'our-group'
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
it 'acts as route not found' do
sign_out(user)
......
......@@ -8,16 +8,11 @@ feature 'SAML provider settings' do
let(:callback_path) { "/groups/#{group.path}/-/saml/callback" }
before do
set_beta_cookie
stub_config_setting(url: 'https://localhost')
stub_saml_config
group.add_owner(user)
end
def set_beta_cookie
set_cookie('enable_group_saml', 'true')
end
def submit
click_button('Save changes')
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