Skip to content
Snippets Groups Projects
Commit ba3e9c64c673 authored by Ian Baum's avatar Ian Baum
Browse files

Merge branch 'ngala/namespace-in-path-auth-redirect-uri' into 'master'

Update default pages auth-redirect-uri when namespace-in-path is enabled

See merge request https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/7548



Merged-by: default avatarIan Baum <ibaum@gitlab.com>
Approved-by: default avatarVladimir Shushlin <vshushlin@gitlab.com>
Approved-by: default avatarMitchell Nielsen <mnielsen@gitlab.com>
Approved-by: default avatarIan Baum <ibaum@gitlab.com>
Co-authored-by: default avatarngala <ngala@gitlab.com>
No related branches found
No related tags found
2 merge requests!144heptapod#1622: making 17.0 the oldstable,!127Merge upstream Omnibus GitLab into Omnibus Heptapod
......@@ -89,7 +89,12 @@
pages_uri = URI(Gitlab['pages_external_url'].to_s)
parsed_port = [80, 443].include?(pages_uri.port) ? "" : ":#{pages_uri.port}"
Gitlab['gitlab_pages']['auth_redirect_uri'] = pages_uri.scheme + '://projects.' + pages_uri.host + parsed_port + '/auth'
Gitlab['gitlab_pages']['auth_redirect_uri'] = if Gitlab['gitlab_pages']['namespace_in_path']
"#{pages_uri.scheme}://#{pages_uri.host}#{parsed_port}/projects/auth"
else
"#{pages_uri.scheme}://projects.#{pages_uri.host}#{parsed_port}/auth"
end
end
def authorize_with_gitlab
......
......@@ -169,6 +169,44 @@
chef_run
end
end
context 'when namespace in path is enabled' do
before do
stub_gitlab_rb(
pages_external_url: 'https://pages.example.com',
gitlab_pages: {
access_control: true,
namespace_in_path: true,
}
)
end
it 'renders pages config file with default auth-redirect-uri' do
expect(chef_run).to render_file("/var/opt/gitlab/gitlab-pages/gitlab-pages-config").with_content { |content|
expect(content).to match(%r{auth-redirect-uri=https://pages.example.com/projects/auth})
expect(content).to match(%r{namespace-in-path=true})
}
end
end
context 'with custom port and namespace in path is enabled' do
before do
stub_gitlab_rb(
pages_external_url: 'https://pages.example.com:8443',
gitlab_pages: {
access_control: true,
namespace_in_path: true,
}
)
end
it 'renders pages config file with default auth-redirect-uri' do
expect(chef_run).to render_file("/var/opt/gitlab/gitlab-pages/gitlab-pages-config").with_content { |content|
expect(content).to match(%r{auth-redirect-uri=https://pages.example.com:8443/projects/auth})
expect(content).to match(%r{namespace-in-path=true})
}
end
end
end
context 'with custom port' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment