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
end
def group
Group.find_by_full_path(path)
@group ||= Group.find_by_full_path(path)
end
def saml_provider
......
......@@ -51,7 +51,7 @@ module OmniAuth
end
def metadata_enabled?
Feature.enabled?(:group_saml_metadata_available)
Feature.enabled?(:group_saml_metadata_available, group_lookup.group)
end
def group_lookup
......
......@@ -133,6 +133,15 @@ describe OmniAuth::Strategies::GroupSaml, type: :strategy do
expect(last_response.status).to eq 404
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
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