Commit f6875416 authored by James Edwards-Jones's avatar James Edwards-Jones

Fix GroupSAML metadata feature flag

parent 7713cb08
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
end end
def group def group
Group.find_by_full_path(path) @group ||= Group.find_by_full_path(path)
end end
def saml_provider def saml_provider
......
...@@ -51,7 +51,7 @@ module OmniAuth ...@@ -51,7 +51,7 @@ module OmniAuth
end end
def metadata_enabled? def metadata_enabled?
Feature.enabled?(:group_saml_metadata_available) Feature.enabled?(:group_saml_metadata_available, group_lookup.group)
end end
def group_lookup def group_lookup
......
...@@ -133,6 +133,15 @@ describe OmniAuth::Strategies::GroupSaml, type: :strategy do ...@@ -133,6 +133,15 @@ describe OmniAuth::Strategies::GroupSaml, type: :strategy do
expect(last_response.status).to eq 404 expect(last_response.status).to eq 404
end end
it 'suceeds when feature enabled for an individual group' do
stub_feature_flags(group_saml_metadata_available: false)
allow(Feature).to receive(:enabled?).with(:group_saml_metadata_available, group) { true }
post '/users/auth/group_saml/metadata', group_path: 'my-group', token: group.saml_discovery_token
expect(last_response.status).to eq 200
end
it 'returns metadata when a valid token is provided' do it 'returns metadata when a valid token is provided' do
post '/users/auth/group_saml/metadata', group_path: 'my-group', token: group.saml_discovery_token post '/users/auth/group_saml/metadata', group_path: 'my-group', token: group.saml_discovery_token
......
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