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

SamlProvider uses URL helpers for issuer and callback

parent c10d067f
......@@ -28,6 +28,8 @@ class SamlProvider < ActiveRecord::Base
end
class DefaultOptions
include Gitlab::Routing
NAME_IDENTIFIER_FORMAT = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified'.freeze
def initialize(group_path)
......@@ -38,16 +40,12 @@ class SamlProvider < ActiveRecord::Base
NAME_IDENTIFIER_FORMAT
end
def full_group_path
"#{host}/groups/#{@group_path}"
end
def issuer
full_group_path
group_canonical_url(@group_path)
end
def assertion_consumer_service_url
"#{full_group_path}/-/saml/callback"
callback_group_saml_providers_url(@group_path)
end
def to_h
......@@ -58,12 +56,6 @@ class SamlProvider < ActiveRecord::Base
idp_sso_target_url_runtime_params: { redirect_to: :RelayState }
}
end
private
def host
@host ||= Gitlab.config.gitlab.url
end
end
private
......
......@@ -8,7 +8,7 @@ describe 'SAML provider settings' do
let(:callback_path) { "/groups/#{group.path}/-/saml/callback" }
before do
stub_config_setting(url: 'https://localhost')
stub_default_url_options(protocol: "https")
stub_saml_config
group.add_owner(user)
end
......
......@@ -58,7 +58,7 @@ describe SamlProvider do
subject(:saml_provider) { create(:saml_provider, group: group) }
before do
stub_config_setting(url: 'https://localhost')
stub_default_url_options(protocol: "https")
end
it 'generates callback URL' do
......
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