2018-10-22 03:00:50 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-04 16:52:00 -04:00
|
|
|
module Gitlab
|
2020-07-28 05:09:41 -04:00
|
|
|
module Pages
|
2017-09-04 16:52:00 -04:00
|
|
|
VERSION = File.read(Rails.root.join("GITLAB_PAGES_VERSION")).strip.freeze
|
2021-03-23 08:09:33 -04:00
|
|
|
INTERNAL_API_REQUEST_HEADER = 'Gitlab-Pages-Api-Request'
|
2019-12-20 04:24:38 -05:00
|
|
|
MAX_SIZE = 1.terabyte
|
2019-09-06 00:06:25 -04:00
|
|
|
|
|
|
|
include JwtAuthenticatable
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def verify_api_request(request_headers)
|
2022-01-06 01:10:35 -05:00
|
|
|
decode_jwt(request_headers[INTERNAL_API_REQUEST_HEADER], issuer: 'gitlab-pages')
|
2019-09-06 00:06:25 -04:00
|
|
|
rescue JWT::DecodeError
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def secret_path
|
|
|
|
Gitlab.config.pages.secret_file
|
|
|
|
end
|
2020-01-14 13:08:31 -05:00
|
|
|
|
|
|
|
def access_control_is_forced?
|
|
|
|
::Gitlab.config.pages.access_control &&
|
|
|
|
::Gitlab::CurrentSettings.current_application_settings.force_pages_access_control
|
|
|
|
end
|
2019-09-06 00:06:25 -04:00
|
|
|
end
|
2017-09-04 16:52:00 -04:00
|
|
|
end
|
|
|
|
end
|